Skip to content

Commit

Permalink
fix: improve the UI on activity
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenngoclongdev authored Oct 4, 2024
1 parent 3910121 commit 044a1fb
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 27 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-planes-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"terminal-keeper": patch
---

fix: improve the UI on activity
69 changes: 45 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@
{
"command": "terminal-keeper.generate",
"category": "Terminal Keeper",
"title": "Generate Configuration File"
"title": "Generate Configuration"
},
{
"command": "terminal-keeper.kill-all",
"category": "Terminal Keeper",
"title": "Kill All Terminals"
"title": "Kill All"
},
{
"command": "terminal-keeper.active",
"category": "Terminal Keeper",
"title": "Active Terminal Session",
"title": "Active Session",
"icon": "$(run-all)"
},
{
Expand All @@ -121,36 +121,41 @@
{
"command": "terminal-keeper.save",
"category": "Terminal Keeper",
"title": "Save Terminal Session",
"title": "Save Session",
"enablement": "false"
},
{
"command": "terminal-keeper.remove",
"category": "Terminal Keeper",
"title": "Remove Terminal Session"
"title": "Remove Session"
},
{
"command": "terminal-keeper.refresh-activity",
"title": "Refresh Activity",
"title": "Refresh",
"icon": "$(refresh)"
},
{
"command": "terminal-keeper.collapse-all-activity",
"title": "Collapse All"
"title": "Collapse All",
"icon": "$(collapse-all)"
},
{
"command": "terminal-keeper.active-session-activity",
"title": "Active Session",
"icon": "$(run)"
},
{
"command": "terminal-keeper.active-terminal-activity",
"title": "Active Terminal",
"icon": "$(run)"
"command": "terminal-keeper.send-to-new-terminal-activity",
"title": "Send to new Terminal",
"icon": "$(send)"
},
{
"command": "terminal-keeper.send-to-current-terminal-activity",
"title": "Send to current Terminal"
},
{
"command": "terminal-keeper.copy-command-activity",
"title": "Copy Commands"
"title": "Copy"
}
],
"menus": {
Expand All @@ -161,28 +166,34 @@
"group": "navigation@1"
},
{
"command": "terminal-keeper.active",
"when": "view == terminalKeeperActivityView"
"command": "terminal-keeper.open",
"when": "view == terminalKeeperActivityView",
"group": "navigation@2"
},
{
"command": "terminal-keeper.open",
"when": "view == terminalKeeperActivityView"
"command": "terminal-keeper.collapse-all-activity",
"when": "view == terminalKeeperActivityView",
"group": "navigation@3"
},
{
"command": "terminal-keeper.refresh-activity",
"when": "view == terminalKeeperActivityView"
"when": "view == terminalKeeperActivityView",
"group": "activity@1"
},
{
"command": "terminal-keeper.remove",
"when": "view == terminalKeeperActivityView"
"command": "terminal-keeper.kill-all",
"when": "view == terminalKeeperActivityView",
"group": "activity@2"
},
{
"command": "terminal-keeper.kill-all",
"when": "view == terminalKeeperActivityView"
"command": "terminal-keeper.save",
"when": "view == terminalKeeperActivityView",
"group": "tk@1"
},
{
"command": "terminal-keeper.collapse-all-activity",
"when": "view == terminalKeeperActivityView"
"command": "terminal-keeper.remove",
"when": "view == terminalKeeperActivityView",
"group": "tk@2"
}
],
"view/item/context": [
Expand All @@ -192,14 +203,24 @@
"group": "inline@1"
},
{
"command": "terminal-keeper.active-terminal-activity",
"command": "terminal-keeper.send-to-new-terminal-activity",
"when": "viewItem == terminal-array-context || viewItem == terminal-context",
"group": "inline@1"
},
{
"command": "terminal-keeper.copy-command-activity",
"command": "terminal-keeper.send-to-new-terminal-activity",
"when": "viewItem == terminal-context",
"group": "terminal@1"
},
{
"command": "terminal-keeper.send-to-current-terminal-activity",
"when": "viewItem == terminal-context",
"group": "terminal@2"
},
{
"command": "terminal-keeper.copy-command-activity",
"when": "viewItem == terminal-context",
"group": "terminal@3"
}
],
"explorer/context": [
Expand Down
3 changes: 2 additions & 1 deletion src/explorer/tree-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ export class TreeProvider implements TreeDataProvider<TKTreeItem> {
terminal: terminalOrTerminalArray,
theme: themeService,
sessionId: sessionName,
terminalArrayIndex: index
terminalArrayIndex: index,
terminalGroupName: terminalOrTerminalArray.name
});
})
});
Expand Down
11 changes: 10 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,23 @@ export async function activate(context: ExtensionContext) {
commands.registerCommand(extCommands.collapseAllActivity, async () => {
await commands.executeCommand(`workbench.actions.treeView.${activityId}.collapseAll`);
}),
commands.registerCommand(extCommands.activeTerminalActivity, async (sessionTreeItem: TKTreeItem) => {
commands.registerCommand(extCommands.sendToNewTerminalActivity, async (sessionTreeItem: TKTreeItem) => {
const { sessionId, terminalArrayIndex, label, contextValue } = sessionTreeItem;
if (contextValue === 'terminal-array-context') {
await activeByTerminalAsync(sessionId, terminalArrayIndex, undefined);
} else {
await activeByTerminalAsync(sessionId, terminalArrayIndex, label as string);
}
}),
commands.registerCommand(extCommands.sendToCurrentTerminalActivity, async (sessionTreeItem: TKTreeItem) => {
const { sessionId, terminalArrayIndex, label, description } = sessionTreeItem;
const { activeTerminal } = window;
if (activeTerminal) {
activeTerminal.sendText(`${description || ''}`, false);
} else {
await activeByTerminalAsync(sessionId, terminalArrayIndex, label as string);
}
}),
commands.registerCommand(extCommands.copyCommandActivity, async (sessionTreeItem: TKTreeItem) => {
const { description } = sessionTreeItem;
env.clipboard.writeText(`${description || ''}`);
Expand Down
3 changes: 2 additions & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export const extCommands = {
killAll: 'terminal-keeper.kill-all',
refresh: 'terminal-keeper.refresh-activity',
activeSessionActivity: 'terminal-keeper.active-session-activity',
activeTerminalActivity: 'terminal-keeper.active-terminal-activity',
sendToNewTerminalActivity: 'terminal-keeper.send-to-new-terminal-activity',
sendToCurrentTerminalActivity:'terminal-keeper.send-to-current-terminal-activity',
copyCommandActivity: 'terminal-keeper.copy-command-activity',
collapseAllActivity: 'terminal-keeper.collapse-all-activity'
};
Expand Down

0 comments on commit 044a1fb

Please sign in to comment.