Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add service files for systemd and D-Bus #1

Open
orhun opened this issue Dec 3, 2022 · 1 comment
Open

Add service files for systemd and D-Bus #1

orhun opened this issue Dec 3, 2022 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@orhun
Copy link
Owner

orhun commented Dec 3, 2022

I tried to utilize the following service files for running runst automatically via D-Bus activation but couldn't access the DISPLAY from systemd unit:

/usr/share/dbus-1/services/org.orhun.runst.service:

[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=/usr/bin/runst
SystemdService=runst.service

/usr/lib/systemd/user/runst.service:

[Unit]
Description=Runst notification daemon
Documentation=man:runst(1)
PartOf=graphical-session.target

[Service]
Type=dbus
BusName=org.freedesktop.Notifications
ExecStart=/usr/bin/runst

Couldn't get this to work. It needs more investigation.

@orhun orhun added enhancement New feature or request help wanted Extra attention is needed labels Dec 3, 2022
@orhun orhun pinned this issue Mar 3, 2023
@julianandrews
Copy link

I tried to fiddle with this and ran into the a similar issue.

Mar 06 18:45:58 madagascar systemd[1859]: Starting Runst notification daemon...
Mar 06 18:45:58 madagascar runst[15414]: 2023-03-06T23:45:58.472377Z  INFO runst: starting
Mar 06 18:45:58 madagascar systemd[1859]: Started Runst notification daemon.
Mar 06 18:46:12 madagascar runst[15414]: Failed to handle X11 events: X11 connection error: `Unknown connection error`

What I noted that is that if I run

systemctl --user restart runst.service

after login, then everything works fine.

I suspect what's going on here is that runst is trying to connect to the X server before it's ready. There may be some sort of fix by configuring the systemd service to not launch right away, but it also occurs to me that the cleanest fix might be to delay opening the X connection until the first notification comes in. There's no real need to open an X connection right on startup, so delaying that initialization would be pretty reasonable.

I haven't checked, but this might be how dunst is avoiding the issue (since it uses nearly identical systemd/d-bus service files and works fine on my computer).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants