mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-19 16:24:22 +01:00
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
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
42 lines
1.8 KiB
Bash
Executable File
42 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# Check: a D-Bus-activated xfce4-notifyd survives an X server that is still
|
|
# coming up (night lockdown / lightdm restart). Never touches the live X: the
|
|
# user manager's DISPLAY is pointed at a private Xvfb that starts 3 s late,
|
|
# and the original environment and notifier are restored on exit.
|
|
# Exit 0 = notify-send worked; non-zero = the 2026-11-18 failure reproduced.
|
|
set -euo pipefail
|
|
|
|
readonly TEST_DISPLAY=":98"
|
|
readonly UNIT="xfce4-notifyd.service"
|
|
orig_display="$(systemctl --user show-environment | sed -n 's/^DISPLAY=//p')"
|
|
orig_xauth="$(systemctl --user show-environment | sed -n 's/^XAUTHORITY=//p')"
|
|
xvfb_pid=""
|
|
|
|
cleanup() {
|
|
if [[ -n "$xvfb_pid" ]]; then kill "$xvfb_pid" 2>/dev/null || true; fi
|
|
systemctl --user stop "$UNIT" 2>/dev/null || true
|
|
systemctl --user reset-failed "$UNIT" 2>/dev/null || true
|
|
if [[ -n "$orig_display" ]]; then systemctl --user set-environment "DISPLAY=$orig_display"; fi
|
|
if [[ -n "$orig_xauth" ]]; then systemctl --user set-environment "XAUTHORITY=$orig_xauth"; fi
|
|
# Bring the live notifier back (starting it shows no toast).
|
|
systemctl --user start "$UNIT" || echo "WARN: live $UNIT did not restart" >&2
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
[[ ! -e /tmp/.X11-unix/X98 ]] || {
|
|
echo "X98 already in use" >&2
|
|
exit 2
|
|
}
|
|
systemctl --user stop "$UNIT" 2>/dev/null || true
|
|
systemctl --user reset-failed "$UNIT" 2>/dev/null || true
|
|
systemctl --user set-environment "DISPLAY=$TEST_DISPLAY"
|
|
systemctl --user unset-environment XAUTHORITY
|
|
|
|
# X "restarts" 3 s after the notification request.
|
|
(sleep 3 && exec Xvfb "$TEST_DISPLAY" -nolisten tcp -screen 0 640x480x24) >/dev/null 2>&1 &
|
|
xvfb_pid=$!
|
|
|
|
# The summary is the display name: the toast only ever lands on the private Xvfb.
|
|
systemd-run --user --wait --collect --quiet notify-send -t 1 -- "$TEST_DISPLAY"
|
|
echo "OK: notify-send succeeded while X came up late"
|