From ad27c6d6fcac4f61b29adaf4c80a5c4f87ea0753 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sat, 4 Nov 2023 17:37:46 -0400 Subject: [PATCH] feat(ags bar workspace): handle urgent windows --- devices/wim/config/ags/js/bar/workspaces.js | 26 +++++++++++++++---- .../config/ags/scss/widgets/workspaces.scss | 10 +++++-- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/devices/wim/config/ags/js/bar/workspaces.js b/devices/wim/config/ags/js/bar/workspaces.js index 82376d18..55fe6ce6 100644 --- a/devices/wim/config/ags/js/bar/workspaces.js +++ b/devices/wim/config/ags/js/bar/workspaces.js @@ -19,11 +19,27 @@ const Workspace = ({ i } = {}) => child: Box({ valign: 'center', className: 'button', - connections: [[Hyprland, self => { - const occupied = Hyprland.getWorkspace(i)?.windows > 0; - self.toggleClassName('occupied', occupied); - self.toggleClassName('empty', !occupied); - }]], + setup: self => { + self.update = addr => { + const occupied = Hyprland.getWorkspace(i)?.windows > 0; + self.toggleClassName('occupied', occupied); + self.toggleClassName('empty', !occupied); + + // Deal with urgent windows + if (Hyprland.getClient(addr)?.workspace.id === i) + self.toggleClassName('urgent', true); + }; + }, + connections: [ + [Hyprland, self => self.update()], + + // Deal with urgent windows + [Hyprland, (self, addr) => self.update(addr), 'urgent-window'], + [Hyprland.active.workspace, self => { + if (Hyprland.active.workspace.id === i) + self.toggleClassName('urgent', false); + }], + ], }), }), }); diff --git a/devices/wim/config/ags/scss/widgets/workspaces.scss b/devices/wim/config/ags/scss/widgets/workspaces.scss index f23783d7..0f213e33 100644 --- a/devices/wim/config/ags/scss/widgets/workspaces.scss +++ b/devices/wim/config/ags/scss/widgets/workspaces.scss @@ -14,13 +14,19 @@ .empty { border: 2px solid transparent; - transition: border-color 0.25s linear; + transition: background-color 0.6s ease-in-out; } .occupied { border: 2px solid $bg; background: $contrast-bg; - transition: border-color 0.25s linear; + transition: background-color 0.6s ease-in-out; +} + +.urgent { + border: 2px solid $bg; + background: red; + transition: background-color 0.6s ease-in-out; } .active {