aboutsummaryrefslogtreecommitdiff
path: root/tmuxrdr/plugin/bin/mark
diff options
context:
space:
mode:
Diffstat (limited to 'tmuxrdr/plugin/bin/mark')
-rwxr-xr-xtmuxrdr/plugin/bin/mark23
1 files changed, 23 insertions, 0 deletions
diff --git a/tmuxrdr/plugin/bin/mark b/tmuxrdr/plugin/bin/mark
new file mode 100755
index 00000000..1a3aaaad
--- /dev/null
+++ b/tmuxrdr/plugin/bin/mark
@@ -0,0 +1,23 @@
+#!/bin/sh
+# tmux prefix+m (select-pane -m) toggles the mark on the current pane; prefix+M
+# (select-pane -M) clears it. tmux shows the mark as a highlighted border,
+# which herdr cannot draw, so marking says so in a toast instead. Used by
+# `swap-pane marked` (the : prompt's swap-pane with no target).
+. "$(dirname "$0")/../lib.sh"
+
+f="$(state_dir)/marked"
+case "${1:-toggle}" in
+toggle)
+ p="$(active_pane)"
+ if [ "$(cat "$f" 2>/dev/null || true)" = "$p" ]; then
+ rm -f "$f"
+ say "pane $(pane_index "$p") unmarked"
+ else
+ printf '%s\n' "$p" >"$f"
+ say "pane $(pane_index "$p") marked"
+ fi
+ ;;
+clear)
+ rm -f "$f"
+ ;;
+esac