This commit is contained in:
Lilith 2024-06-12 23:12:19 +02:00
parent 7a4828af0d
commit eddf7cecb8
Signed by: lilith
GPG key ID: 8712A0F317C37175
6 changed files with 78 additions and 10 deletions

View file

@ -6,7 +6,7 @@ const battery = await Service.import("battery")
const systemtray = await Service.import("systemtray")
const date = Variable("", {
poll: [1000, 'date "+%H:%M:%S %b %e."'],
poll: [1000, 'date "+%a, %Y-%m-%d %H:%M:%S"'],
})
// widgets can be only assigned as a child in one container
@ -16,9 +16,11 @@ const date = Variable("", {
function Workspaces() {
const activeId = hyprland.active.workspace.bind("id")
const workspaces = hyprland.bind("workspaces")
.as(ws => ws.map(({ id }) => Widget.Button({
.as(ws => ws
.filter(({ id }) => id > 0)
.map(({ id, name }) => Widget.Button({
on_clicked: () => hyprland.messageAsync(`dispatch workspace ${id}`),
child: Widget.Label(`${id}`),
child: Widget.Label(`${name}`),
class_name: activeId.as(i => `${i === id ? "focused" : ""}`),
})))
@ -189,3 +191,18 @@ function Right() {
],
})
}
export 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(),
center_widget: Center(),
end_widget: Right(),
}),
})
}