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/clock-mode | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 tmuxrdr/plugin/bin/clock-mode (limited to 'tmuxrdr/plugin/bin/clock-mode') diff --git a/tmuxrdr/plugin/bin/clock-mode b/tmuxrdr/plugin/bin/clock-mode new file mode 100755 index 00000000..220d53d3 --- /dev/null +++ b/tmuxrdr/plugin/bin/clock-mode @@ -0,0 +1,34 @@ +#!/bin/sh +# tmux prefix+t (clock-mode): a big 24-hour clock in clock-mode-colour (blue), +# centred, until any key. Run as a popup. +trap 'stty "$tty"; printf "\033[0m\033[?25h"' EXIT +tty="$(stty -g)" +stty -icanon -echo min 0 time 10 +printf '\033[?25l' +while :; do + set -- $(stty size) + printf '\033[H\033[2J\033[34m' + date '+%H:%M' | awk -v rows="$1" -v cols="$2" ' + BEGIN { + f["0"] = "###|#.#|#.#|#.#|###"; f["1"] = "..#|..#|..#|..#|..#" + f["2"] = "###|..#|###|#..|###"; f["3"] = "###|..#|###|..#|###" + f["4"] = "#.#|#.#|###|..#|..#"; f["5"] = "###|#..|###|..#|###" + f["6"] = "###|#..|###|#.#|###"; f["7"] = "###|..#|..#|..#|..#" + f["8"] = "###|#.#|###|#.#|###"; f["9"] = "###|#.#|###|..#|###" + f[":"] = ".|#|.|#|." + } + { + for (r = 1; r <= 5; r++) line[r] = "" + for (i = 1; i <= length($0); i++) { + split(f[substr($0, i, 1)], g, "|") + for (r = 1; r <= 5; r++) line[r] = line[r] g[r] "." + } + w = length(line[1]) * 2 + for (i = 1; i <= int((rows - 5) / 2); i++) print "" + for (r = 1; r <= 5; r++) { + s = line[r]; gsub(/#/, "██", s); gsub(/\./, " ", s) + printf "%" int((cols - w) / 2) "s%s\n", "", s + } + }' + [ -n "$(dd bs=1 count=1 2>/dev/null)" ] && break +done -- cgit v1.2.3