systemd: support user systemd units
@@ -14,6 +14,7 @@ Configuration parameters:
'inactive' the output is suppressed if the unit is inactive
(default 'off')
unit: specify the systemd unit to use (default 'dbus.service')
+ user: specify if this is a user service (default False)
Format of status string placeholders:
{unit} unit name, eg sshd.service
@@ -51,7 +52,7 @@ not-found
{'color': '#FFFF00', 'full_text': 'sshd.service: not-found'}
"""
-from pydbus import SystemBus
+from pydbus import SessionBus, SystemBus
class Py3status:
@@ -64,8 +65,12 @@ class Py3status:
hide_extension = False
hide_if_default = "off"
unit = "dbus.service"
+ user = False
def post_config_hook(self):
+ if self.user:
+ bus = SessionBus()
+ else:
bus = SystemBus()
systemd = bus.get("org.freedesktop.systemd1")
self.systemd_unit = bus.get(".systemd1", systemd.LoadUnit(self.unit))
