From 0fd5456fd6710f8a3e204cc50d9eb7a043f977f0 Mon Sep 17 00:00:00 2001 From: piotr Date: Tue, 16 Jul 2024 02:52:10 +0200 Subject: [PATCH] mark #workspace-occupied --- nwg_panel/glade/config_sway_workspaces.glade | 3 ++- nwg_panel/modules/sway_workspaces.py | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/nwg_panel/glade/config_sway_workspaces.glade b/nwg_panel/glade/config_sway_workspaces.glade index f848404..035ed56 100644 --- a/nwg_panel/glade/config_sway_workspaces.glade +++ b/nwg_panel/glade/config_sway_workspaces.glade @@ -266,7 +266,8 @@ start <span size="small"><b>CSS IDs</b>: #sway-workspaces, #sway-workspaces-item, -#sway-workspaces-icon, #sway-workspaces-name</span> +#sway-workspaces-icon, #sway-workspaces-name +#workspace-occupied</span> True True diff --git a/nwg_panel/modules/sway_workspaces.py b/nwg_panel/modules/sway_workspaces.py index d81e0b4..7daccbe 100644 --- a/nwg_panel/modules/sway_workspaces.py +++ b/nwg_panel/modules/sway_workspaces.py @@ -171,10 +171,13 @@ class SwayWorkspaces(Gtk.Box): else: lbl.hide() + # mark non-empty WS with CSS ID + if int_num in non_empty: + lbl.set_property("name", "workspace-occupied") + # mark non-empty WS with a dot if self.settings["mark-content"]: if int_num in non_empty: - lbl.set_property("name", "workspace-occupied") if not text.endswith("."): text += "." else: @@ -263,13 +266,13 @@ class SwayWorkspaces(Gtk.Box): for item in tree.descendants(): if item.type == "workspace": # find non-empty workspaces - if self.settings["mark-content"] or self.settings["hide-empty"]: - tasks_num = 0 - for d in item.descendants(): - if d.type == "con" and d.name: - tasks_num += 1 - if tasks_num > 0: - non_empty.append(item.num) + # if self.settings["mark-content"] or self.settings["hide-empty"]: + tasks_num = 0 + for d in item.descendants(): + if d.type == "con" and d.name: + tasks_num += 1 + if tasks_num > 0: + non_empty.append(item.num) for node in item.floating_nodes: if str(node.workspace().num) in self.settings["numbers"]: