Let tmux alerts actually reach the bar
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>
This commit is contained in:
co-authored by
Claude Opus 5
parent
ec7cd9f039
commit
ec1553d720
@@ -40,6 +40,13 @@ fi
|
||||
[[ -n ${OMARCHY_PATH:-} ]] || fail "OMARCHY_PATH is not set"
|
||||
[[ -f $OMARCHY_PATH/shell/shell.qml ]] || fail "omarchy-shell config not found: $OMARCHY_PATH/shell/shell.qml"
|
||||
|
||||
# qs matches instances by display, and tmux run-shell strips WAYLAND_DISPLAY
|
||||
# from hooks, so recover it from the compositor socket when it is missing.
|
||||
if [[ -z ${WAYLAND_DISPLAY:-} ]]; then
|
||||
socket=$(ls -t "${XDG_RUNTIME_DIR:-/run/user/$UID}"/wayland-[0-9]* 2>/dev/null | grep -v '\.lock$' | head -n1)
|
||||
[[ -n $socket ]] && export WAYLAND_DISPLAY=${socket##*/}
|
||||
fi
|
||||
|
||||
if [[ $1 == "shell" && ( $2 == "summon" || $2 == "toggle" ) ]] && (( $# == 3 )); then
|
||||
set -- "$1" "$2" "$3" "{}"
|
||||
fi
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/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"
|
||||
Reference in New Issue
Block a user