diff options
| author | Freya Murphy <freya@freyacat.org> | 2025-06-17 15:14:45 -0400 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2025-06-17 15:14:45 -0400 |
| commit | 1173df26fd78fdd59679645004847237ed7a0a54 (patch) | |
| tree | b75e6bd3ee1a878b1a3e74d94fb9ea0bb94c14a7 /pkgs/astal/src/widget/bar/workspaces.lua | |
| parent | add upowerd (diff) | |
| download | dotfiles-nix-1173df26fd78fdd59679645004847237ed7a0a54.tar.gz dotfiles-nix-1173df26fd78fdd59679645004847237ed7a0a54.tar.bz2 dotfiles-nix-1173df26fd78fdd59679645004847237ed7a0a54.zip | |
add astal package, update flake to support packages
Diffstat (limited to '')
| -rw-r--r-- | pkgs/astal/src/widget/bar/workspaces.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pkgs/astal/src/widget/bar/workspaces.lua b/pkgs/astal/src/widget/bar/workspaces.lua new file mode 100644 index 0000000..8bc1785 --- /dev/null +++ b/pkgs/astal/src/widget/bar/workspaces.lua @@ -0,0 +1,28 @@ +local astal = require("astal") +local Widget = require("astal.gtk3.widget") +local Hyprland = astal.require("AstalHyprland") +local lib = require('lib') +local bind = astal.bind + +local hypr = Hyprland.get_default() + +function Workspace(ws) + return Widget.Button({ + class_name = bind(hypr, "focused-workspace"):as(function(fw) + return "workspace " .. (fw == ws and "primary" or "") + end), + on_clicked = function() ws:focus() end, + label = ws.id, + }) +end + +function Workspaces(wss) + return lib.map(lib.sort(wss, 'id'), Workspace) +end + +return function() + return Widget.Box({ + class_name = "workspaces", + bind(hypr, "workspaces"):as(Workspaces) + }) +end |