fix: deliver test notifications into the classroom session
The classroom desktop belongs to the classroom user and mako sits on that user's D-Bus session. An administrator over SSH is in a different session where nothing owns org.freedesktop.Notifications, so notify-send asked D-Bus to start a second mako, which had no display to open and timed out with NoReply. Find the running sway process for the classroom user and deliver into its session instead. XDG_RUNTIME_DIR and the bus address are read from that process, falling back to /run/user/<uid> and its bus socket when the environment cannot be read — root has ptrace access on the endpoint, but that is not somewhere to be brittle. The Wayland display is read the same way, and failing that from the wayland-N.lock sway holds open, so no socket name is ever assumed. notify-send only needs the bus, so a display that cannot be resolved is not worth refusing to send over. Refuses to send when mako is not already running, rather than letting D-Bus start one, and says plainly what is wrong when there is no session, no privileges, or no bus socket. --dry-run reports what it resolved without sending. Behaviour inside the session is unchanged, and the sample notifications and styling are untouched. The tests stand a real background process in for sway so /proc/<pid>/environ is genuine rather than mocked, and cover both invocation paths plus the fallbacks and every refusal. The build runs them. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
59fbc54d65
commit
ffd18edf7e
@@ -56,6 +56,28 @@ hook. Minimising is the dock's Browser button or `Super+M`.
|
||||
renders in the critical style and does not time out
|
||||
- [ ] Notifications appear over a fullscreen video
|
||||
|
||||
Over SSH from an administrator account, run it with sudo:
|
||||
|
||||
```
|
||||
sudo classroom-notify-test --dry-run # show the session it resolved
|
||||
sudo classroom-notify-test # send into the classroom desktop
|
||||
```
|
||||
|
||||
The classroom desktop belongs to the classroom user, and mako sits on
|
||||
that user's D-Bus session. A plain notify-send from an SSH session lands
|
||||
in the administrator's own session, where nothing owns
|
||||
org.freedesktop.Notifications, so D-Bus tries to start a second mako with
|
||||
no display and the call times out with NoReply. The script finds the
|
||||
running sway process for the classroom user and delivers into its
|
||||
session instead. It never starts mako.
|
||||
|
||||
- [ ] `sudo classroom-notify-test` from an SSH session displays on the
|
||||
classroom screen
|
||||
- [ ] `sudo classroom-notify-test --dry-run` reports the resolved
|
||||
XDG_RUNTIME_DIR, bus address and Wayland display
|
||||
- [ ] Running it as an unprivileged admin account explains it needs sudo
|
||||
- [ ] `tests/test-classroom-notify-test.sh` passes (also run by the build)
|
||||
|
||||
## DVD
|
||||
|
||||
With `DVD_ENABLED=false`:
|
||||
|
||||
Reference in New Issue
Block a user