You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey all, I'm seeing some confusing behaviour when trying to run this as part of a systemd unit an not sure what I need to install to work correctly.
Basically I am able to call this Notification show as expected with
Notification::new()
.summary("Posture Watcher")
.urgency(notify_rust::Urgency::Critical)
.body(&format!(
"Time to change to a {} position",
next_state.as_ref()
))
.show()?;
when i just run as a bin installed in $HOME/.cargo/bin/myprogram. However if I set up a systemd unit I get the error
Nov 12 23:46:21 blade posture-notifier[443468]: thread 'main' panicked at 'just work: Error { kind: Zbus(Io(Os { code: 2, kind: NotFound, message: "No such file or directory....
This seems kinda similar to #140, but I think this is more so something to do with the user systemd runs under (which i'm pretty sure is just root in this case), but if the only dep is libdbus-1-dev i have a hard time believing that something that varies user to user on desktop linux.
Is there something I need to install under my systemd user? or what's the play here?
The text was updated successfully, but these errors were encountered:
Looks like you are using the zbus dependency, so you don't even need libdbus-1-dev at all. You'd only need this if you built the notify-rust dependency with the d feature, but that is only there as a fallback.
I'm not a huge dbus expert, but I think you need to run as the same user to be able to send notifications. You are basically talking to your desktop-environment (kde/gnome/etc) and that might only accept requests from the same user.
Granted the "No such file or directory" message is confusing, I would assume that is because the underlying implementation uses some proc file (waves hands). But this sounds very similar to #54, so I would say the rule of thumb is "desktop notifications can only be sent by you own user".
Thanks for the tip @hoodie . I managed to get this working by running it with systemctl --user. So no problem with the crate, just my understanding of systemd.
Hey all, I'm seeing some confusing behaviour when trying to run this as part of a systemd unit an not sure what I need to install to work correctly.
Basically I am able to call this Notification show as expected with
when i just run as a bin installed in $HOME/.cargo/bin/myprogram. However if I set up a systemd unit I get the error
This seems kinda similar to #140, but I think this is more so something to do with the user systemd runs under (which i'm pretty sure is just root in this case), but if the only dep is libdbus-1-dev i have a hard time believing that something that varies user to user on desktop linux.
Is there something I need to install under my systemd user? or what's the play here?
The text was updated successfully, but these errors were encountered: