workspace for ags much more lokig

This commit is contained in:
joygnu 2024-08-22 18:42:32 +02:00
parent fca32e6bf6
commit 1549bd56d9

View file

@ -9,12 +9,16 @@ const date = Variable("", {
})
function Workspaces() {
const activeId = hyprland.active.workspace.bind("id")
const workspaces = hyprland.bind("workspaces")
.as(ws => ws.map(({ id }) => Widget.Button({
on_clicked: () => hyprland.messageAsync(`dispatch workspace ${id}`),
child: Widget.Label(`${id}`),
class_name: activeId.as(i => `${i === id ? "focused" : ""}`),
const activeId = hyprland.active.workspace.bind("id");
const workspaces = hyprland.bind("workspaces").as((ws) =>
ws
.filter(({ id }) => id > 0)
.sort((a, b) => a.id - b.id)
.map(({ id }) =>
Widget.Button({
on_clicked: () => hyprland.messageAsync(`dispatch workspace ${id}`),
child: Widget.Label(`${id}`),
class_name: activeId.as(i => `${i === id ? "focused" : ""}`),
})))
return Widget.Box({