From df2624ad1db7c2d0da4b186d7ab6f6d1e6d64b84 Mon Sep 17 00:00:00 2001 From: Denis Fomin Date: Fri, 22 Apr 2022 13:54:12 +0300 Subject: [PATCH 1/3] do not show the systray if there's no items in it --- awesome/src/widgets/systray.lua | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/awesome/src/widgets/systray.lua b/awesome/src/widgets/systray.lua index c9dfb86..2c227d6 100644 --- a/awesome/src/widgets/systray.lua +++ b/awesome/src/widgets/systray.lua @@ -8,16 +8,19 @@ local color = require("src.theme.colors") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") + +local capi = { + awesome = awesome, +} + require("src.core.signals") - return function(s) - local systray = wibox.widget { { { wibox.widget.systray(), - margins = dpi(6), + margins = dpi(0), widget = wibox.container.margin, id = 'st' }, @@ -34,6 +37,16 @@ return function(s) -- Signals Hover_signal(systray.container, color["Red200"]) + capi.awesome.connect_signal("systray::update", function() + local num_entries = capi.awesome.systray() + + if num_entries == 0 then + systray.container.st:set_margins(dpi(0)) + else + systray.container.st:set_margins(dpi(6)) + end + end) + systray.container.st.widget:set_base_size(dpi(20)) return systray From 9978e42af8c3e49375bcb327822bd3faa745111d Mon Sep 17 00:00:00 2001 From: Denis Fomin Date: Fri, 22 Apr 2022 13:58:24 +0300 Subject: [PATCH 2/3] update README --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index e660a02..588301c 100644 --- a/README.md +++ b/README.md @@ -70,4 +70,3 @@ Battery, Network (Wifi, Ethernet), Bluetooth, Volume, Keyboardlayout, Date (with - The Volume and Backlight keys will be really laggy when changed too fast - Not every program will use the Icon's pack icon in the taglist and tasklist - The Volume OSD wont go over 100% even if the volume is higher(the regular widget works) -- The systay will stay even when empty since there is no way to check how many clients are in the systray From 2c8518c77067f5f644e0062e107d66e0d6f4bb67 Mon Sep 17 00:00:00 2001 From: Denis Fomin Date: Fri, 22 Apr 2022 14:19:30 +0300 Subject: [PATCH 3/3] fixes --- awesome/src/widgets/systray.lua | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/awesome/src/widgets/systray.lua b/awesome/src/widgets/systray.lua index 2c227d6..a26953e 100644 --- a/awesome/src/widgets/systray.lua +++ b/awesome/src/widgets/systray.lua @@ -9,10 +9,6 @@ local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") -local capi = { - awesome = awesome, -} - require("src.core.signals") return function(s) @@ -20,7 +16,6 @@ return function(s) { { wibox.widget.systray(), - margins = dpi(0), widget = wibox.container.margin, id = 'st' }, @@ -37,11 +32,11 @@ return function(s) -- Signals Hover_signal(systray.container, color["Red200"]) - capi.awesome.connect_signal("systray::update", function() - local num_entries = capi.awesome.systray() + awesome.connect_signal("systray::update", function() + local num_entries = awesome.systray() if num_entries == 0 then - systray.container.st:set_margins(dpi(0)) + systray.container.st:set_margins(0) else systray.container.st:set_margins(dpi(6)) end