diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-06-04 11:04:56 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2021-06-04 11:04:56 +0200 |
commit | b9c7fb023b9a5810bc9788966fc664458057e9f2 (patch) | |
tree | 523a89973b0914fa2fb15928ed25293abf3d6993 | |
parent | 517ce5da24783a837f8796579baddaf3e1421820 (diff) |
pager: add indicators for window status (maximized, floating)
-rw-r--r-- | pager.lua | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -2,6 +2,7 @@ local M = {} local awful = require("awful") local beautiful = require("beautiful") +local gstring = require("gears.string") local wibox = require("wibox") local Page = {} @@ -39,16 +40,32 @@ function Page:client_add(c) local bg_urgent = beautiful.bg_urgent or "#ffffff" local fg_urgent = beautiful.fg_urgent or "#d00000" - local tb = wibox.widget.textbox("", true) + local tb = wibox.widget.textbox("", false) local bg = wibox.container.background(tb, bg) tb:set_font(font) local function update_text(c) - tb:set_text(c.name or "") + local text = gstring.xml_escape(c.name) or "" + + -- add markers for window state (maximized, floating) + if c.maximized then + text = '<b>+</b>' .. text + else + if c.maximized_horizontal then text = '⬌' .. text end + if c.maximized_vertical then text = '⬍' .. text end + if c.floating then text = '✈' .. text end + end + + tb:set_markup(text) end - c:connect_signal("property::name", update_text) + c:connect_signal("property::name", update_text) + c:connect_signal("property::floating", update_text) + c:connect_signal("property::maximized", update_text) + c:connect_signal("property::maximized_horizontal", update_text) + c:connect_signal("property::maximized_vertical", update_text) + c:connect_signal("focus", function(c) if c.screen == self.screen then |