testsAndMisc/linux_configuration/i3/wait_for_x.sh
Krzysztof kuhy Rudnicki 6fecf148eb
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (mypy, mypy) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (pylint, pylint) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (rest, ) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (shellcheck, shellcheck) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / lib-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
Start xfce4-notifyd only once X answers
notifyd is D-Bus-activated by a user manager that outlives X. Each
activation during a night-lockdown X restart exited with 'cannot open
display' until the start limit failed the bus name, so notify-send
got NameHasNoOwner (2026-11-18). A drop-in waits up to 15 s for X
and drops the start limit; i3 refreshes the activation environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWWLoUxxSPf1m8KUVo8
2026-11-18 21:33:55 +01:00

18 lines
705 B
Bash
Executable File

#!/bin/bash
# ExecStartPre for xfce4-notifyd.service: hold the start until $DISPLAY
# answers, up to WAIT_FOR_X_SECS (default 15). The notifier is D-Bus
# activated and the systemd --user manager outlives X sessions, so a request
# that lands while X restarts (night lockdown, lightdm) used to fail five
# times at once, hit the start limit and fail the activation. Waiting turns
# that into one start that succeeds as soon as X is back.
set -euo pipefail
readonly deadline=$((SECONDS + ${WAIT_FOR_X_SECS:-15}))
until xset q >/dev/null 2>&1; do
if ((SECONDS >= deadline)); then
echo "wait_for_x: DISPLAY=${DISPLAY:-unset} not answering after ${WAIT_FOR_X_SECS:-15}s" >&2
exit 1
fi
sleep 0.25
done