aboutsummaryrefslogtreecommitdiff
path: root/tmuxrdr/plugin/bin/mark
blob: 1a3aaaaddf1225b03c652258fd34904126c00e82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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