feat(ags bar workspace): handle urgent windows

This commit is contained in:
matt1432 2023-11-04 17:37:46 -04:00
parent 353800f52b
commit ad27c6d6fc
2 changed files with 29 additions and 7 deletions

View file

@ -19,11 +19,27 @@ const Workspace = ({ i } = {}) =>
child: Box({
valign: 'center',
className: 'button',
connections: [[Hyprland, self => {
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);
}],
],
}),
}),
});

View file

@ -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 {