yes, I'm very commit lazy
This commit is contained in:
@@ -3,47 +3,48 @@
|
||||
--------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local wibox = require('wibox')
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
}
|
||||
local capi = { awesome = awesome }
|
||||
|
||||
-- Systray theme variables
|
||||
Theme.bg_systray = Theme_config.systray.bg
|
||||
Theme.systray_icon_spacing = dpi(10)
|
||||
|
||||
return function(s)
|
||||
return function()
|
||||
local systray = wibox.widget {
|
||||
{
|
||||
{
|
||||
wibox.widget.systray(),
|
||||
id = 'systray_margin',
|
||||
widget = wibox.container.margin,
|
||||
id = 'st'
|
||||
},
|
||||
strategy = "exact",
|
||||
strategy = 'exact',
|
||||
widget = wibox.container.constraint,
|
||||
id = "container"
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
shape = Theme_config.systray.shape,
|
||||
bg = Theme_config.systray.bg
|
||||
}
|
||||
|
||||
capi.awesome.connect_signal("systray::update", function()
|
||||
local systray_margin = systray:get_children_by_id('systray_margin')[1]
|
||||
|
||||
-- Wait for an systray update
|
||||
capi.awesome.connect_signal('systray::update', function()
|
||||
-- Get the number of entries in the systray
|
||||
local num_entries = capi.awesome.systray()
|
||||
|
||||
-- If its 0 remove the margins to hide the widget
|
||||
if num_entries == 0 then
|
||||
systray.container.st:set_margins(0)
|
||||
systray_margin:set_margins(0)
|
||||
else
|
||||
systray.container.st:set_margins(dpi(6))
|
||||
systray_margin:set_margins(dpi(6))
|
||||
end
|
||||
end)
|
||||
|
||||
systray.container.st.widget:set_base_size(dpi(24))
|
||||
-- Set the icon size
|
||||
systray_margin.widget:set_base_size(dpi(24))
|
||||
|
||||
return systray
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user