aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/i3blocks
diff options
context:
space:
mode:
authorToby Vincent <tobyv@tobyvin.dev>2024-06-07 11:04:07 -0500
committerToby Vincent <tobyv@tobyvin.dev>2024-06-07 11:04:07 -0500
commit84baec871151358221faa800cb3a192fb6fcc6a2 (patch)
tree5f040022a0b18e96b99bb6e0b7fd745fc5ecea39 /i3blocks
parent4ec1572889fc5cb525e23bc776d44922247ecd12 (diff)
refactor(i3blocks): clean up dunst blocklet code
Diffstat (limited to 'i3blocks')
-rwxr-xr-xi3blocks/.local/lib/i3blocks/i3blocks-dunst20
1 files changed, 11 insertions, 9 deletions
diff --git a/i3blocks/.local/lib/i3blocks/i3blocks-dunst b/i3blocks/.local/lib/i3blocks/i3blocks-dunst
index 46e7f5f..c2b07db 100755
--- a/i3blocks/.local/lib/i3blocks/i3blocks-dunst
+++ b/i3blocks/.local/lib/i3blocks/i3blocks-dunst
@@ -8,23 +8,25 @@ import json
from dbus_next.aio import MessageBus
+BUS_NAME = "org.freedesktop.Notifications"
+OBJECT_PATH = "/org/freedesktop/Notifications"
+DUNST_INTERFACE = "org.dunstproject.cmd0"
+PROPERTIES_INTERFACE = "org.freedesktop.DBus.Properties"
+
+
class Dunst:
@classmethod
async def connect(cls):
self = cls()
self.bus = await MessageBus().connect()
- introspection = await self.bus.introspect(
- "org.freedesktop.Notifications", "/org/freedesktop/Notifications"
- )
-
self.obj = self.bus.get_proxy_object(
- "org.freedesktop.Notifications",
- "/org/freedesktop/Notifications",
- introspection,
+ BUS_NAME,
+ OBJECT_PATH,
+ await self.bus.introspect(BUS_NAME, OBJECT_PATH),
)
- self.dunst = self.obj.get_interface("org.dunstproject.cmd0")
+ self.dunst = self.obj.get_interface(DUNST_INTERFACE)
self.paused = await self.dunst.get_paused()
self.displayed = await self.dunst.get_displayed_length()
self.waiting = await self.dunst.get_waiting_length()
@@ -71,7 +73,7 @@ class Dunst:
self.print_status()
async def listener(self):
- properties = self.obj.get_interface("org.freedesktop.DBus.Properties")
+ properties = self.obj.get_interface(PROPERTIES_INTERFACE)
properties.on_properties_changed(self.on_properties_changed)
await self.bus.wait_for_disconnect()