diff options
author | Tim Keller <tjk@tjkeller.xyz> | 2024-10-18 21:49:17 -0500 |
---|---|---|
committer | Tim Keller <tjk@tjkeller.xyz> | 2024-10-18 21:49:17 -0500 |
commit | 923eb46350b1102749eb05cd2120c96cc6a715d0 (patch) | |
tree | 811da20b4195d4b5c65c8ac0090982a4a23f6a7d /widgets/classiclayouts.lua | |
download | awesome-923eb46350b1102749eb05cd2120c96cc6a715d0.tar.xz awesome-923eb46350b1102749eb05cd2120c96cc6a715d0.zip |
initial commit
Diffstat (limited to 'widgets/classiclayouts.lua')
-rw-r--r-- | widgets/classiclayouts.lua | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/widgets/classiclayouts.lua b/widgets/classiclayouts.lua new file mode 100644 index 0000000..3b4fd64 --- /dev/null +++ b/widgets/classiclayouts.lua @@ -0,0 +1,64 @@ +local wibox = require("wibox") +local layout = require("awful.layout") + +local screen_widgets = {} -- need one widget per screen + +local layout_icons = { + cornernw = "TT=", + cornerne = "=TT", + cornersw = "LL=", + cornerse = "=LL", + fairh = "#_#", + fairv = "##H", + max = "[M]", + floating = "><>", + magnifier = "=O=", + fullscreen = "[*]", + spiral = "[]@", + dwindle = "[]\\", + tile = "[]=", + tiletop = "LLL", + tilebottom = "TTT", + tileleft = "=[]", +} + +function update(screen_index) + local s = screen[screen_index or 1] + local w = screen_widgets[s] + local l = layout.get(s) + + -- create widget if not existing + if w == nil then + screen_widgets[s] = { widget = wibox.widget.textbox(), layout = l } + w = screen_widgets[s] + --w._layoutbox_tooltip = tooltip {objects = {w}, delay_show = 1} + + -- skip if no change + elseif w.layout == l then + return + end + + -- set widget + local name = layout.getname(l) + --w._layoutbox_tooltip:set_text(name) + w.widget:set_text(layout_icons[name]) -- TODO handle nil + return w.widget +end + +function update_screens() + for s, w in pairs(boxes) do + if s.valid then + update(s) + end + end +end + +function update_current_tag(t) + update(t.screen) +end + +tag.connect_signal("property::selected", update_current_tag) +tag.connect_signal("property::layout", update_current_tag) +tag.connect_signal("property::screen", update_screens) + +return update |