The tmux alert hooks fire omarchy-shell through run-shell, and run-shell builds its own environment rather than passing the server's along, so the hook ran without WAYLAND_DISPLAY. qs matches instances by display, so every refresh from a bell died at "omarchy-shell is not running", which -q then swallowed by design. That left the indicator with no way to turn itself on. Its five second poll only runs while the indicator is already active, so an alert raised after startup was invisible until the shell happened to restart with the window still flagged. The icon appeared roughly never. Recovering the display from the socket in XDG_RUNTIME_DIR fixes it in the one place that needs it, and covers any other caller reaching the shell from a stripped environment rather than just the tmux hooks. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
31 lines
978 B
Bash
Executable File
31 lines
978 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
source "$(dirname "$0")/base-test.sh"
|
|
|
|
test_dir=$(mktemp -d)
|
|
trap 'rm -rf "$test_dir"' EXIT
|
|
|
|
mkdir -p "$test_dir/bin" "$test_dir/run"
|
|
touch "$test_dir/run/wayland-1" "$test_dir/run/wayland-1.lock"
|
|
|
|
cat >"$test_dir/bin/qs" <<'STUB'
|
|
#!/bin/bash
|
|
echo "display=[$WAYLAND_DISPLAY]"
|
|
STUB
|
|
chmod +x "$test_dir/bin/qs"
|
|
|
|
export PATH="$test_dir/bin:$PATH"
|
|
export OMARCHY_PATH="$ROOT"
|
|
export XDG_RUNTIME_DIR="$test_dir/run"
|
|
|
|
# tmux hooks run without WAYLAND_DISPLAY, and qs matches instances by display.
|
|
output=$(env -u WAYLAND_DISPLAY "$ROOT/bin/omarchy-shell" omarchy.indicators refresh)
|
|
[[ $output == "display=[wayland-1]" ]] || fail "shell ipc recovers a missing display" "$output"
|
|
pass "shell ipc recovers a missing display"
|
|
|
|
output=$(WAYLAND_DISPLAY=wayland-9 "$ROOT/bin/omarchy-shell" omarchy.indicators refresh)
|
|
[[ $output == "display=[wayland-9]" ]] || fail "shell ipc keeps an existing display" "$output"
|
|
pass "shell ipc keeps an existing display"
|