From b9c7fb023b9a5810bc9788966fc664458057e9f2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 4 Jun 2021 11:04:56 +0200 Subject: pager: add indicators for window status (maximized, floating) --- pager.lua | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/pager.lua b/pager.lua index 2b3b5b0..cb1eddb 100644 --- a/pager.lua +++ b/pager.lua @@ -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 = '+' .. 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 -- cgit v1.2.3