diff options
Diffstat (limited to 'pkgs/astal/src/widget/bar/focusedClient.lua')
-rw-r--r-- | pkgs/astal/src/widget/bar/focusedClient.lua | 29 |
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 |