aboutsummaryrefslogtreecommitdiff
path: root/tmuxrdr/plugin/bin/break-pane
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-10-05 11:27:00 +0300
committerIgor Soarez <igor@soarez.org>2026-10-05 11:27:00 +0300
commit986e760687a2d34051934d410bec71fa2efc349b (patch)
treef57dcc4ba0d7690fdf90eeb2f0970a8ebbefc45a /tmuxrdr/plugin/bin/break-pane
parent7b116c05bfda646af39d2524c54e70c751f57ee8 (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/break-pane')
-rwxr-xr-xtmuxrdr/plugin/bin/break-pane14
1 files changed, 14 insertions, 0 deletions
diff --git a/tmuxrdr/plugin/bin/break-pane b/tmuxrdr/plugin/bin/break-pane
new file mode 100755
index 00000000..f2683c93
--- /dev/null
+++ b/tmuxrdr/plugin/bin/break-pane
@@ -0,0 +1,14 @@
+#!/bin/sh
+# tmux prefix+! (break-pane): the current pane becomes a tab of its own, at the
+# end of the tab bar, and that tab is selected. Same message as tmux when the
+# pane is alone.
+. "$(dirname "$0")/../lib.sh"
+
+p="$(active_pane)"
+[ "$(tab_panes "$p" | wc -l)" -gt 1 ] || fail "can't break with only one pane"
+tab="$("$H" pane move "$p" --new-tab --workspace "$(pane_info "$p" workspace_id)" \
+ --no-focus | jq -r '.result.move_result.pane.tab_id // empty')"
+[ -n "$tab" ] || fail "break-pane failed"
+# Focused separately: a move's own --focus emits no tab.focused event, so
+# track-focus would miss it and `last window` would not lead back.
+"$H" tab focus "$tab" >/dev/null