Closed nightly-brew closed 2 years ago
To start the daemon automatically when receiving a notification, we'll need the .service
file that you provided above and a small service file that'll need to be copied into /usr/share/dbus-1/services/
Let me search the one mako uses, if it could be of help.
Alright, let me finish my lunch and I'll take a look at it, and see if d-feet reports swaync as activable after that.
Ok, got it working!
Quick note, the systemd service is called swaync.service.
The dbus service file instead is "/usr/share/dbus-1/org.erikreider.swaync.service", with the following content:
[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=/usr/bin/swaync
SystemdService=swaync.service
With this, dbus happily starts the service when a notification pops up!
Cool! Now it just needs some meson work and we'll be done :)
First time using meson, but I think I almost got it right. https://github.com/nightly-brew/SwayNotificationCenter/commit/8e8cf9384beae0b42e9a51317c2358e4db668b2a
Though, I would definitely be happy to hear other's opinions on always including the SystemdService key in the dbus activation file.
The specification says dbus should try invoking the systemd service only if the dbus instance itself was started with "--systemd-activation", falling back to Exec when that parameter is not used. Would you leave it be or would you prefer meson to generate a different file?
I also couldn't decide where to put said files in the project tree, so let me know if services is good or not.
edit: almost forgot. On arch, to get meson to put files in the right location I had to explicity set --prefix /usr, otherwise files going into /usr/share would've been placed into /usr/local/share. Still, you don't seem to use the prefix in the README. Do I need to change something?
I was also thinking, should the systemd service be enabled on install or should it be left to the user to decide? In the latter case, we could provide a preset file.
Could you create a pull request so that we can continue the conversation there?
Sure!
Closing since the pull request was accepted.
Would it be possible to have swaync shipped by default with a systemd unit file? I wrote a simple one based on the file that comes with mako, if it may help.