0

I have my systray setup and works well. However, when it is empty it's keeping a big blank space and i'd like to get rid of that by hiding the tray with something like visibility = false. Is there a way to count the number of icons and hide it when it is 0?

I was expecting it to shrink when it is empty but doesn't enter image description here

1 Answers1

0

I think the Answer (to the number of elements in systray) can be found in Awesome WM's Github Repo at awesome/lib/wibox/widget/systray.lua:

num_entries is the number of elements in your systray.

local capi = {
    awesome = awesome,
    screen = screen
}

local num_entries = capi.awesome.systray()

(I am not sure though, what happens if you have more than 1 systray)

I couldn't think of a nice way to hide your systray with this, but you could do it with gears.timer:

gears.timer {
    timeout   = 10, -- Time between checks
    call_now  = true,
    autostart = true,
    callback  = function()
        if capi.awesome.systray() == 0 then -- if systray has no elements
        your_systray_name.forced_height = 0 -- force heigt
        your_systray_name.forced_width = 0 -- and width to be zero
    end
    end
}

Did that help/resolve your question?

awvle
  • 1
  • 1