diff --git a/style.scss b/style.scss index 3d962e0..9276290 100644 --- a/style.scss +++ b/style.scss @@ -24,4 +24,19 @@ window.Bar { border-radius: 8px; margin: 2px; } + + .workspaces { + .workspace-btn { + min-width: 24px; + min-height: 24px; + padding: 0 4px; + border-radius: 6px; + background: transparent; + + &.active { + background: #{"@theme_selected_bg_color"}; + color: #{"@theme_selected_fg_color"}; + } + } + } } diff --git a/widget/Bar.tsx b/widget/Bar.tsx index d887d8b..4a73534 100644 --- a/widget/Bar.tsx +++ b/widget/Bar.tsx @@ -1,10 +1,11 @@ import app from "ags/gtk4/app" import { Astal, Gtk, Gdk } from "ags/gtk4" +import Workspaces from "./Workspaces" function Left() { return ( - ) } diff --git a/widget/Workspaces.tsx b/widget/Workspaces.tsx new file mode 100644 index 0000000..c345610 --- /dev/null +++ b/widget/Workspaces.tsx @@ -0,0 +1,27 @@ +import { Gtk } from "ags/gtk4" +import { execAsync } from "ags/process" +import { createPoll } from "ags/time" + +export default function Workspaces() { + // Poll the active workspace ID from Hyprland + const activeWs = createPoll(1, 250, (prev) => + execAsync("hyprctl activeworkspace -j") + .then((out) => JSON.parse(out).id as number) + .catch(() => prev), + ) + + return ( + + {Array.from({ length: 9 }, (_, i) => i + 1).map((i) => ( + + ))} + + ) +}