From 986e760687a2d34051934d410bec71fa2efc349b Mon Sep 17 00:00:00 2001 From: Igor Soarez Date: Mon, 5 Oct 2026 11:27:00 +0300 Subject: 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. --- tmuxrdr/plugin/bin/last | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 tmuxrdr/plugin/bin/last (limited to 'tmuxrdr/plugin/bin/last') 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 -- cgit v1.2.3