diff options
| author | Igor Soarez <igor@soarez.org> | 2026-10-05 11:27:00 +0300 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-10-05 11:27:00 +0300 |
| commit | 986e760687a2d34051934d410bec71fa2efc349b (patch) | |
| tree | f57dcc4ba0d7690fdf90eeb2f0970a8ebbefc45a /tmuxrdr/plugin/bin/last | |
| parent | 7b116c05bfda646af39d2524c54e70c751f57ee8 (diff) | |
tmuxrdr: tmux-mode plugin
The tmux default prefix bindings herdr has no built-in action for, as a
herdr plugin built on its CLI and socket: break-pane, swap-pane and
rotate-window by pane order (focus behaviour measured on tmux 3.7c),
mark/clear-mark, last-window and switch-client -l (from focus events, per
session), select-window and move-window by index, paste-buffer -p,
display-message in tmux's default format, select-layout -E, kill-pane and
kill-window behind tmux's y/n prompts, a command prompt taking tmux's
commands, clock-mode, show-messages, and automatic-rename.
Also a .gitignore for secrets scoped to tmuxrdr/, leaving herdr's own
untouched.
Diffstat (limited to 'tmuxrdr/plugin/bin/last')
| -rwxr-xr-x | tmuxrdr/plugin/bin/last | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tmuxrdr/plugin/bin/last b/tmuxrdr/plugin/bin/last new file mode 100755 index 00000000..2d3e137d --- /dev/null +++ b/tmuxrdr/plugin/bin/last @@ -0,0 +1,25 @@ +#!/bin/sh +# tmux prefix+L (switch-client -l): back to the previously focused workspace -- +# herdr's workspace is tmux's session. `last window` is tmux's prefix+l +# (last-window): this machine's tmux.conf took l for select-pane -R, so it has +# no key there and none here, but the : prompt has it. Going back focuses the +# old one, which track-focus records, so repeating toggles -- as in tmux. +. "$(dirname "$0")/../lib.sh" + +dir="$(state_dir)" +case "${1:-}" in +window) + ws="$(pane_info "$(active_pane)" workspace_id)" + t="$(cat "$dir/tab.$(key_of "$ws").previous" 2>/dev/null || true)" + [ -n "$t" ] && "$H" tab get "$t" >/dev/null 2>&1 || fail "no last window" + "$H" tab focus "$t" >/dev/null + ;; +session) + w="$(cat "$dir/workspace.previous" 2>/dev/null || true)" + [ -n "$w" ] && "$H" workspace get "$w" >/dev/null 2>&1 || fail "can't find last session" + "$H" workspace focus "$w" >/dev/null + ;; +*) + fail "usage: last window|session" + ;; +esac |
