snowflake/home/ags/config/js/widgets/hyprland.js

20 lines
550 B
JavaScript
Raw Normal View History

2024-01-03 17:08:17 -05:00
import { Hyprland, Widget } from "../../import.js";
const Workspaces = () =>
Widget.Box({
class_name: "workspaces",
children: Hyprland.bind("workspaces").transform((ws) => {
return ws.map(({ id }) =>
Widget.Button({
on_clicked: () => Hyprland.sendMessage(`dispatch workspace ${id}`),
child: Widget.Label(`${id}`),
2024-02-01 17:48:30 -05:00
class_name: Hyprland.active.workspace
.bind("id")
.transform((i) => `${i === id ? "focused" : ""}`)
})
);
2024-02-01 17:48:30 -05:00
})
});
2024-01-03 17:08:17 -05:00
export { Workspaces };