From 30938eeaeef0675cdd661d70fde5da1588538294 Mon Sep 17 00:00:00 2001 From: djairoh Date: Wed, 7 Oct 2026 11:48:30 +0200 Subject: [PATCH] fx: wyabar notifs module --- scripts/WMScripts/dunst_bar.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/scripts/WMScripts/dunst_bar.py b/scripts/WMScripts/dunst_bar.py index cb2df93..cdd58a4 100755 --- a/scripts/WMScripts/dunst_bar.py +++ b/scripts/WMScripts/dunst_bar.py @@ -6,21 +6,29 @@ from json import dumps from dbus_fast.aio import MessageBus from dbus_fast.proxy_object import BaseProxyInterface, BaseProxyObject + +def output(msg: string, clss: string = "unmuted-notifs"): + print(dumps({ + "text": msg, + "alt": "", + "tooltip": "", + "class": clss, + "percentage": 0 + }, ensure_ascii=False), flush=True) + + def update_dbus_state(interface, changed, _) -> None: if interface != 'org.dunstproject.cmd0': + output("", "error") return if 'paused' in changed: update_output(changed['paused'].value) + def update_output(paused: bool) -> None: - print(dumps({ - "text": "󱙍" if paused else "󰍡", - "alt": "", - "tooltip": "", - "class": "muted-notifs" if paused else "unmuted-notifs", - "percentage": 0 - }, ensure_ascii=False)) + output("󱙍" if paused else "󰍡", "muted-notifs" if paused else "unmuted-notifs") + async def main() -> None: bus = await MessageBus().connect() @@ -37,6 +45,6 @@ async def main() -> None: await Event().wait() + if __name__ == "__main__": run(main()) -