summaryrefslogtreecommitdiff
path: root/pkgs/astal/src/widget/bar/focusedClient.lua
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-06-17 15:14:45 -0400
committerFreya Murphy <freya@freyacat.org>2025-06-17 15:14:45 -0400
commit1173df26fd78fdd59679645004847237ed7a0a54 (patch)
treeb75e6bd3ee1a878b1a3e74d94fb9ea0bb94c14a7 /pkgs/astal/src/widget/bar/focusedClient.lua
parentadd upowerd (diff)
downloaddotfiles-nix-1173df26fd78fdd59679645004847237ed7a0a54.tar.gz
dotfiles-nix-1173df26fd78fdd59679645004847237ed7a0a54.tar.bz2
dotfiles-nix-1173df26fd78fdd59679645004847237ed7a0a54.zip
add astal package, update flake to support packages
Diffstat (limited to 'pkgs/astal/src/widget/bar/focusedClient.lua')
-rw-r--r--pkgs/astal/src/widget/bar/focusedClient.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/pkgs/astal/src/widget/bar/focusedClient.lua b/pkgs/astal/src/widget/bar/focusedClient.lua
new file mode 100644
index 0000000..329cc4e
--- /dev/null
+++ b/pkgs/astal/src/widget/bar/focusedClient.lua
@@ -0,0 +1,29 @@
+local astal = require("astal")
+local Widget = require("astal.gtk3.widget")
+local Hyprland = astal.require("AstalHyprland")
+local bind = astal.bind
+
+local hypr = Hyprland.get_default()
+
+function Client(client)
+ -- sanity check
+ if not client then
+ return nil
+ end
+
+ return Widget.Label({
+ ellipsize = "END",
+ max_width_chars = 50,
+ label = bind(client, "title"):as(tostring),
+ })
+end
+
+return function()
+ local focused = bind(hypr, "focused-client")
+
+ return Widget.Box({
+ class_name = "focusedClient",
+ visible = focused,
+ focused:as(Client)
+ })
+end