21 lines
626 B
TypeScript
21 lines
626 B
TypeScript
import Hyprland from "gi://AstalHyprland"
|
|
import { bind } from "astal"
|
|
|
|
const hypr = Hyprland.get_default()
|
|
const focused = bind(hypr, "focused-workspace").as((ws) => ws?.id ?? -1)
|
|
|
|
export default function Workspaces() {
|
|
return (
|
|
<box className="workspaces">
|
|
{[1, 2, 3, 4, 5].map((i) => (
|
|
<button
|
|
className={focused.as((f) => (f === i ? "ws active" : "ws"))}
|
|
onClicked={() => hypr.dispatch("workspace", String(i))}
|
|
>
|
|
<label label={String(i)} />
|
|
</button>
|
|
))}
|
|
</box>
|
|
)
|
|
}
|