Repository navigation
Custom commands in the sidebar session context menu #1002
Replies: 1 comment
|
I tend to decline this one, it looks like the wrong thing to do. If it went in, these commands would most likely sit in a submenu, which is not a direct way to pick an action, and the row menu would grow by however many commands people add. It also doesn't fit the flow you describe. A row-menu item runs on the clicked row, but the chord on the same to run a command on another session without switching to it, you can chain two pickers: pick the command, then pick the session. #!/bin/sh
# Pick a custom command, then a session, and run the command on that session without switching to it.
self="Run on Session"
ctl() { agtermctl "$@" --socket "$AGT_SOCKET"; }
cmd=$(ctl keymap list --json \
| jq --arg self "$self" '[.result.keymap.commands[] | select(.name != $self)
| {id: .name, label: .name} + (if .shortcut then {subtitle: .shortcut} else {} end)]' \
| ctl pick --prompt "Command to run" --window "$AGT_WINDOW_ID" \
| jq -r 'select(.result == "picked") | .id')
[ -n "$cmd" ] || exit 0
sid=$(ctl tree --json --window "$AGT_WINDOW_ID" \
| jq '[.result.tree.workspaces[] as $w | $w.sessions[]
| {id, label: .name, subtitle: $w.name}]' \
| ctl pick --prompt "Run \"$cmd\" on" --select "$AGT_SESSION_ID" --window "$AGT_WINDOW_ID" \
| jq -r 'select(.result == "picked") | .id')
[ -n "$sid" ] || exit 0
ctl keymap run "$cmd" --target "$sid" --window "$AGT_WINDOW_ID"save it as the picked command gets the target session's this is the extension model in general, https://agterm.com/docs#extend has the rest, and the agterm agent skill can write variations of it for you. |
Uh oh!
There was an error while loading. Please reload this page.
Let a
keymap.confcommandopt into the session row's context menu, e.g.command "Fork" ctrl+opt+f --menu session ./fork.sh. The menu item runs the command withAGT_SESSION_ID,AGT_WINDOW_IDandAGT_SESSION_PWDof the right-clicked row, not of the active session.Why: I use agterm only for agent chats, one session per Claude Code or Codex chat. Per-chat actions ("fork this chat into a background agent", "open this chat's trace view") work today as chords and in the custom command palette, but those always act on the active session. The row context menu is where per-session actions already live (Duplicate Session, Reveal in Files), and it is the only way to act on a row other than the active one.
Workaround today: chords plus
custom_command_palette. agterm 0.33.1+linux.1.All reactions