summaryrefslogtreecommitdiff
path: root/tmuxsh/_tmux_bell_next,--.jump.to.next.window.with.bell.alert
diff options
context:
space:
mode:
Diffstat (limited to 'tmuxsh/_tmux_bell_next,--.jump.to.next.window.with.bell.alert')
-rwxr-xr-xtmuxsh/_tmux_bell_next,--.jump.to.next.window.with.bell.alert16
1 files changed, 16 insertions, 0 deletions
diff --git a/tmuxsh/_tmux_bell_next,--.jump.to.next.window.with.bell.alert b/tmuxsh/_tmux_bell_next,--.jump.to.next.window.with.bell.alert
new file mode 100755
index 0000000..8ed81a4
--- /dev/null
+++ b/tmuxsh/_tmux_bell_next,--.jump.to.next.window.with.bell.alert
@@ -0,0 +1,16 @@
+#!/usr/bin/env sh
+# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry|odysee)
+# https://www.youtube.com/user/gotbletu
+# NOTE: simulate a bell alert on a window: $ sleep 3 && echo -e "\a"
+
+# tmux list-pane formating
+TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:"
+LIST_DATA="#{window_name} #{pane_title} #{window_bell_flag} #{pane_current_path} #{pane_current_command}"
+
+# select pane
+LINE="$(tmux list-panes -a -F "$TARGET_SPEC $LIST_DATA" | awk '$4 == "1" {print $0}' | head -n 1)" || exit 0
+SESSION="$(echo "$LINE" | cut -d ':' -f1)"
+WINDOW_NUM="$(echo "$LINE" | cut -d ':' -f2)"
+PANE_NUM="$(echo "$LINE" | cut -d ':' -f3)"
+
+tmux select-pane -t "$PANE_NUM" && tmux select-window -t "$WINDOW_NUM" && tmux switch-client -t "$SESSION"