54 lines
1.3 KiB
Lua
54 lines
1.3 KiB
Lua
--------------------------------
|
|
-- This is the power widget --
|
|
--------------------------------
|
|
|
|
-- Awesome Libs
|
|
local awful = require("awful")
|
|
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(0),
|
|
widget = wibox.container.margin,
|
|
id = 'st'
|
|
},
|
|
strategy = "exact",
|
|
layout = wibox.container.constraint,
|
|
id = "container"
|
|
},
|
|
widget = wibox.container.background,
|
|
shape = function(cr, width, height)
|
|
gears.shape.rounded_rect(cr, width, height, 5)
|
|
end,
|
|
bg = color["BlueGrey800"]
|
|
}
|
|
-- 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
|
|
end
|