From 5994b8a0fd965cea10575108b733082d5120e6de Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 18 Jul 2021 09:13:57 +0200 Subject: [PATCH] i3-companion: remove duplicate code --- bin/i3-companion | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/bin/i3-companion b/bin/i3-companion index 9f5ed87..999785b 100755 --- a/bin/i3-companion +++ b/bin/i3-companion @@ -628,7 +628,7 @@ async def bluetooth_notifications(i3, event, path, interface, changed, invalid): @retry(2) @debounce(0.2) async def bluetooth_status(i3, event, *args): - """Update bluetooth status for polybar.""" + """Update bluetooth status for Polybar.""" if event is StartEvent: # Do we have a bluetooth device? if not os.path.exists("/sys/class/bluetooth"): @@ -720,11 +720,7 @@ async def bluetooth_status(i3, event, *args): ) ) async def dunst_status_update(i3, event, path, interface, changed, invalid): - """Update notification status in polybar.""" - if interface != "org.dunstproject.cmd0": - return - if "paused" not in changed: - return + """Update notification status in Polybar.""" polybar( "dunst", icons[ @@ -735,14 +731,13 @@ async def dunst_status_update(i3, event, path, interface, changed, invalid): @on(StartEvent) async def dunst_status_check(i3, event): - """Display notification status for polybar.""" + """Display notification status for Polybar.""" conn = i3.session_bus["org.freedesktop.Notifications"] obj = conn["/org/freedesktop/Notifications"] dunst = await obj.get_async_interface("org.dunstproject.cmd0") paused = await dunst.paused polybar( - "dunst", - icons[paused and "notifications-disabled" or "notifications-enabled"], + "dunst", icons[paused and "notifications-disabled" or "notifications-enabled"] )