With the basics working in my PR, I started thinking about the types of actions the session agent should perform. As mentioned in the original post, I suspect the primary ones will be:
- start or stop user systemd units.
- tell the user systemd instance to refresh its config
- post desktop notifications
Controlling user systemd instance
We already have an interface for controlling systemd in the form of github.com/snapcore/snapd/systemd, which issues appropriate systemctl commands. It is fairly simple to extend this to issue systemctl --user commands.
Desktop Notifications
There are two standards for Linux desktop notifications in use today:
These are supported on various desktops as:
- GNOME: both GTK and FDO
- KDE: FDO
- MATE: FDO
- XFCE: FDO
- Unity 7: FDO, with no support for actions
Note: the fact that Unity 7 has no support for actions means all use of notifications should assume the user may ignore or not see the notification.
While the FDO standard covers everything, it may still be worth supporting GTK notifications. It is a better fit for a background service that exits on idle, and should give better integration on modern GNOME desktops.
Both standards rely on D-Bus, with the GTK standard also requiring the app posting notifications hold an activatable D-Bus well known name. On all modern systems this is not a problem. I believe we can have this work on Xenial systems: since Unity 7 only supports the FDO standard, it doesn’t matter that we can’t perform bus activation of the session agent on that distro.