summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--widgets/classiclayouts.lua35
1 files changed, 20 insertions, 15 deletions
diff --git a/widgets/classiclayouts.lua b/widgets/classiclayouts.lua
index 1f71698..994f520 100644
--- a/widgets/classiclayouts.lua
+++ b/widgets/classiclayouts.lua
@@ -1,3 +1,4 @@
+local awful = require("awful")
local wibox = require("wibox")
local layout = require("awful.layout")
local beautiful = require("beautiful")
@@ -33,22 +34,22 @@ 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
+ screen_widgets[s] = {
+ widget = wibox.widget {
+ font = beautiful.layoutbox_font or beautiful.font_mono or "monospace 10",
+ widget = wibox.widget.textbox,
+ },
+ layout = l,
+ tooltip = awful.tooltip { delay_show = 1 },
+ }
w = screen_widgets[s]
- --w._layoutbox_tooltip = tooltip {objects = {w}, delay_show = 1}
-
- -- skip if no change
- elseif w.layout == l then
- return
+ w.tooltip:add_to_object(w.widget)
end
w.layout = l
-- set widget
local name = layout.getname(l)
- --w._layoutbox_tooltip:set_text(name)
+ w.tooltip:set_text(name)
local wtxt = layout_icons[name]
if type(wtxt) == 'function' then
wtxt = wtxt(s)
@@ -67,14 +68,18 @@ function update_screens()
end
end
-function update_current_tag(t)
+function update_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("tagged", update_current_tag) -- max
-tag.connect_signal("untagged", update_current_tag) -- max
+function update_client(c)
+ update(c.screen)
+end
+
+tag.connect_signal("property::selected", update_tag)
+tag.connect_signal("property::layout", update_tag)
+tag.connect_signal("tagged", update_client) -- max
+tag.connect_signal("untagged", update_client) -- max
tag.connect_signal("property::screen", update_screens)
return update