From 1549bd56d972af5e19d18faf100d86070cf9cfbe Mon Sep 17 00:00:00 2001 From: joygnu Date: Thu, 22 Aug 2024 18:42:32 +0200 Subject: [PATCH] workspace for ags much more lokig --- home/ags/bar/config.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/home/ags/bar/config.js b/home/ags/bar/config.js index c66b691..2a12735 100644 --- a/home/ags/bar/config.js +++ b/home/ags/bar/config.js @@ -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({