aboutsummaryrefslogtreecommitdiff
path: root/tmuxrdr/plugin/bin/clock-mode
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/clock-mode
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/clock-mode')
-rwxr-xr-xtmuxrdr/plugin/bin/clock-mode34
1 files changed, 34 insertions, 0 deletions
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