-
I am coming from Waybar and use Hyprland, and dabbled slightly in Eww, but I am not a fan of how Hyprland does workspaces so I use this plugin. On Waybar and Eww it just worked and on monitor 1 I have worspaces Waybar:AgsI assume I just need to change something, but in all honesty the JavaScript is rather confusing. I am just using the example config here. It would be great if there was a commented out example on how to use this functionality correctly. The only change I made to this config was change the line to get the date to use a JavaScript implementation, but shouldn't matter. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Underestimated the power of just asking ChatGPT tbh function Workspaces(monitor) {
const activeId = hyprland.active.workspace.bind("id")
const workspaces = hyprland.bind("workspaces")
.as(ws => ws.filter(({ id }) => {
if (monitor === 1) {
return id >= 1 && id <= 10
} else if (monitor === 0) {
return id >= 11 && id <= 20
}
}).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({
class_name: "workspaces",
children: workspaces,
})
} function Bar(monitor = 0) {
return Widget.Window({
name: `bar-${monitor}`, // name has to be unique
class_name: "bar",
monitor,
anchor: ["top", "left", "right"],
exclusivity: "exclusive",
child: Widget.CenterBox({
start_widget: Left(monitor),
center_widget: Center(),
end_widget: Right(),
}),
})
}
Not sure if it is the most ideal code but it does give me the result I was expecting, if anyone has a better solution just comment it as well I think it could be improved like instead of 2 monitors only can do any amount of monitors more easily |
Beta Was this translation helpful? Give feedback.
Underestimated the power of just asking ChatGPT tbh