Indicate and jump to tmux panes waiting for attention
Show a bar indicator whenever tmux has flagged a window, the same state that highlights the tab, and jump to it on click or with Super + Ctrl + J. Tmux hooks push the state to the shell, so nothing polls while no pane is waiting. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
98e88723ae
commit
a382be2645
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
source "$(dirname "$0")/base-test.sh"
|
||||
|
||||
require_command jq
|
||||
|
||||
test_dir=$(mktemp -d)
|
||||
trap 'rm -rf "$test_dir"' EXIT
|
||||
|
||||
cat >"$test_dir/tmux" <<'STUB'
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $1 == "list-windows" ]]; then
|
||||
cat "$TMUX_STUB_WINDOWS"
|
||||
fi
|
||||
STUB
|
||||
chmod +x "$test_dir/tmux"
|
||||
|
||||
export TMUX_STUB_WINDOWS="$test_dir/windows"
|
||||
export PATH="$test_dir:$PATH"
|
||||
|
||||
cat >"$TMUX_STUB_WINDOWS" <<'WINDOWS'
|
||||
000|Work|1|editor
|
||||
100|Work|2|claude
|
||||
001|Side|1|server|with|pipes
|
||||
WINDOWS
|
||||
|
||||
output=$("$ROOT/bin/omarchy-tmux-alert" show --json)
|
||||
expected='{"count":2,"tooltip":"claude (Work:2), server|with|pipes (Side:1)"}'
|
||||
[[ $output == "$expected" ]] || fail "tmux alert reports alerted windows" "expected: $expected"$'\n'"actual: $output"
|
||||
pass "tmux alert reports alerted windows"
|
||||
|
||||
output=$("$ROOT/bin/omarchy-tmux-alert" show)
|
||||
[[ $output == "claude (Work:2), server|with|pipes (Side:1)" ]] || fail "tmux alert describes alerted windows" "$output"
|
||||
pass "tmux alert describes alerted windows"
|
||||
|
||||
cat >"$TMUX_STUB_WINDOWS" <<'WINDOWS'
|
||||
000|Work|1|editor
|
||||
WINDOWS
|
||||
|
||||
output=$("$ROOT/bin/omarchy-tmux-alert" show --json)
|
||||
[[ $output == '{"count":0,"tooltip":""}' ]] || fail "tmux alert reports no alerted windows" "$output"
|
||||
pass "tmux alert reports no alerted windows"
|
||||
|
||||
[[ -z $("$ROOT/bin/omarchy-tmux-alert" show) ]] || fail "tmux alert stays quiet without alerts"
|
||||
pass "tmux alert stays quiet without alerts"
|
||||
|
||||
: >"$TMUX_STUB_WINDOWS"
|
||||
output=$("$ROOT/bin/omarchy-tmux-alert" show --json)
|
||||
[[ $output == '{"count":0,"tooltip":""}' ]] || fail "tmux alert handles a missing tmux server" "$output"
|
||||
pass "tmux alert handles a missing tmux server"
|
||||
Reference in New Issue
Block a user