diff options
author | Tim Keller <tjkeller.xyz> | 2024-11-09 17:19:36 -0600 |
---|---|---|
committer | Tim Keller <tjkeller.xyz> | 2024-11-09 17:19:36 -0600 |
commit | 53e0dc39b185f81b8e4920f201931e268fb75872 (patch) | |
tree | 52129cb2db9d18705254f194e5c5d242ce3d682d /widgets/classiclayouts.lua | |
parent | 1d048c3caf026ef7d8f1c35d55c59d42cdf5173e (diff) | |
download | awesome-53e0dc39b185f81b8e4920f201931e268fb75872.tar.xz awesome-53e0dc39b185f81b8e4920f201931e268fb75872.zip |
max layout function implement
Diffstat (limited to 'widgets/classiclayouts.lua')
-rw-r--r-- | widgets/classiclayouts.lua | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/widgets/classiclayouts.lua b/widgets/classiclayouts.lua index 3b4fd64..515e66c 100644 --- a/widgets/classiclayouts.lua +++ b/widgets/classiclayouts.lua @@ -1,5 +1,6 @@ local wibox = require("wibox") local layout = require("awful.layout") +local beautiful = require("beautiful") local screen_widgets = {} -- need one widget per screen @@ -10,7 +11,6 @@ local layout_icons = { cornerse = "=LL", fairh = "#_#", fairv = "##H", - max = "[M]", floating = "><>", magnifier = "=O=", fullscreen = "[*]", @@ -20,6 +20,9 @@ local layout_icons = { tiletop = "LLL", tilebottom = "TTT", tileleft = "=[]", + max = function(s) + return string.format("[%s]", #s.clients > 0 and #s.clients or 'M') + end, } function update(screen_index) @@ -30,6 +33,9 @@ function update(screen_index) -- create widget if not existing if w == nil then screen_widgets[s] = { widget = wibox.widget.textbox(), layout = l } + if beautiful.font_mono then + screen_widgets[s].widget.font = beautiful.font_mono + end w = screen_widgets[s] --w._layoutbox_tooltip = tooltip {objects = {w}, delay_show = 1} @@ -41,7 +47,13 @@ function update(screen_index) -- set widget local name = layout.getname(l) --w._layoutbox_tooltip:set_text(name) - w.widget:set_text(layout_icons[name]) -- TODO handle nil + local wtxt = layout_icons[name] + if type(wtxt) == 'function' then + wtxt = wtxt(s) + elseif wtxt == nil then + wtxt = "???" + end + w.widget:set_text(wtxt) return w.widget end @@ -59,6 +71,8 @@ end tag.connect_signal("property::selected", update_current_tag) tag.connect_signal("property::layout", update_current_tag) +tag.connect_signal("tagged", update_current_tag) -- max +tag.connect_signal("untagged", update_current_tag) -- max tag.connect_signal("property::screen", update_screens) return update |