2024-01-03 17:08:17 -05:00
|
|
|
import { Hyprland, Widget } from "../../import.js";
|
|
|
|
|
2024-02-01 15:48:47 -05:00
|
|
|
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}`),
|
|
|
|
class_name: Hyprland.active.workspace.bind("id")
|
|
|
|
.transform((i) => `${i === id ? "focused" : ""}`),
|
|
|
|
})
|
|
|
|
);
|
2024-01-03 17:08:17 -05:00
|
|
|
}),
|
2024-02-01 15:48:47 -05:00
|
|
|
});
|
2024-01-03 17:08:17 -05:00
|
|
|
|
2024-02-01 15:48:47 -05:00
|
|
|
export { Workspaces };
|