Files
crylia-theme/awesome/crylia_bar/center_bar.lua
2022-03-06 20:56:06 +01:00

83 lines
2.2 KiB
Lua

--------------------------------------------------------------------------------------------------------------
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
--------------------------------------------------------------------------------------------------------------
-- Awesome Libs
local awful = require("awful")
local colors = require ("theme.crylia.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
return function (s, widget)
local top_center = awful.popup{
screen = s,
widget = wibox.container.background,
ontop = false,
bg = colors.color["Grey900"],
visible = true,
maximum_width = dpi(500),
placement = function (c) awful.placement.top(c, {margins = dpi(10)}) end,
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end
}
local naught = require("naughty")
top_center:setup{
nil,
{
widget,
margins = dpi(6),
widget = wibox.container.margin
},
nil,
forced_height = 45,
layout = wibox.layout.align.horizontal
}
client.connect_signal(
"manage",
function (c)
if #s:get_clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end
)
client.connect_signal(
"unmanage",
function (c)
if #s:get_clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end
)
client.connect_signal(
"tag::switched",
function (c)
if #s:get_clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end
)
awesome.connect_signal(
"refresh",
function (c)
if #s:get_clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end
)
end