aboutsummaryrefslogtreecommitdiff
path: root/tmuxrdr/plugin/bin/display-message
diff options
context:
space:
mode:
Diffstat (limited to 'tmuxrdr/plugin/bin/display-message')
-rwxr-xr-xtmuxrdr/plugin/bin/display-message15
1 files changed, 15 insertions, 0 deletions
diff --git a/tmuxrdr/plugin/bin/display-message b/tmuxrdr/plugin/bin/display-message
new file mode 100755
index 00000000..e2ff0192
--- /dev/null
+++ b/tmuxrdr/plugin/bin/display-message
@@ -0,0 +1,15 @@
+#!/bin/sh
+# tmux prefix+i (display-message), in tmux's default template -- measured on
+# tmux 3.7c: "[0] 0:zsh, current pane 0 - (10:30 05-Oct-26)", i.e.
+# [#S] #I:#W, current pane #P - (%H:%M %d-%b-%y). Session is the workspace,
+# window index its place in the tab bar, window name the tab label.
+. "$(dirname "$0")/../lib.sh"
+
+p="$(active_pane)"
+ws="$(pane_info "$p" workspace_id)"
+tab="$(pane_info "$p" tab_id)"
+session="$("$H" workspace get "$ws" | jq -r '.result.workspace.label // empty')"
+line="$(workspace_tabs "$ws" | grep -n -F "$tab " | head -n 1)"
+window_index="${line%%:*}"
+window_name="$(printf '%s' "${line#*:}" | cut -f2)"
+say "[$session] $window_index:$window_name, current pane $(pane_index "$p") - ($(date '+%H:%M %d-%b-%y'))"