diff --git a/bar/main.py b/bar/main.py index 20f36cf..0bacb20 100644 --- a/bar/main.py +++ b/bar/main.py @@ -33,6 +33,7 @@ dummy = Window(visible=False) finder = FuzzyWindowFinder() bar_windows = [] +notmuch_widget = None app = Application("bar", dummy, finder) @@ -54,6 +55,7 @@ else: def spawn_bars(): + global notmuch_widget logger.info("[Bar] Spawning bars after river ready") outputs = river.outputs @@ -66,6 +68,8 @@ def spawn_bars(): for i, output_id in enumerate(output_ids): bar = StatusBar(display=output_id, tray=tray if i == 0 else None, monitor=i) bar_windows.append(bar) + if i == 0 and bar.notmuch: + notmuch_widget = bar.notmuch return False diff --git a/flake.nix b/flake.nix index 7f4b4e3..3b8aa80 100644 --- a/flake.nix +++ b/flake.nix @@ -37,6 +37,9 @@ makku = pkgs.writeShellScriptBin "makku" '' dbus-send --session --print-reply --dest=org.Fabric.fabric.bar /org/Fabric/fabric org.Fabric.fabric.Evaluate string:"finder.show()" > /dev/null 2>&1 ''; + notmuch-refresh = pkgs.writeShellScriptBin "notmuch-refresh" '' + dbus-send --session --print-reply --dest=org.Fabric.fabric.bar /org/Fabric/fabric org.Fabric.fabric.Evaluate string:"notmuch_widget.service.update_unread_count() if notmuch_widget else None" > /dev/null 2>&1 + ''; }; apps.default = { type = "app";