yes, I'm very commit lazy
This commit is contained in:
@@ -3,65 +3,49 @@
|
||||
--------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
local awful = require("awful")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local abutton = require('awful.button')
|
||||
local gtable = require('gears.table')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local wibox = require('wibox')
|
||||
local gfilesystem = require('gears.filesystem')
|
||||
local gcolor = require('gears.color')
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
}
|
||||
-- Local libs
|
||||
local powermenu = require('src.modules.powermenu.init')
|
||||
local hover = require('src.tools.hover')
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = gears.filesystem.get_configuration_dir() .. "src/assets/icons/power/"
|
||||
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/power/'
|
||||
|
||||
return function()
|
||||
return setmetatable({}, { __call = function()
|
||||
|
||||
local power_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "icon",
|
||||
image = gears.color.recolor_image(icondir .. "power.svg", Theme_config.power_button.fg),
|
||||
widget = wibox.widget.imagebox,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
resize = false
|
||||
},
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
id = "power_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
image = gcolor.recolor_image(icondir .. 'power.svg', Theme_config.power_button.fg),
|
||||
widget = wibox.widget.imagebox,
|
||||
valign = 'center',
|
||||
halign = 'center',
|
||||
resize = false,
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
widget = wibox.container.margin,
|
||||
},
|
||||
bg = Theme_config.power_button.bg,
|
||||
fg = Theme_config.power_button.fg,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
shape = Theme_config.power_button.shape,
|
||||
widget = wibox.container.background,
|
||||
}
|
||||
|
||||
-- Signals
|
||||
Hover_signal(power_widget)
|
||||
hover.bg_hover { widget = power_widget }
|
||||
|
||||
power_widget:connect_signal(
|
||||
"button::release",
|
||||
function()
|
||||
capi.awesome.emit_signal("module::powermenu:show")
|
||||
end
|
||||
)
|
||||
power_widget:buttons { gtable.join(
|
||||
abutton({}, 1, function()
|
||||
powermenu:toggle()
|
||||
end)
|
||||
), }
|
||||
|
||||
return power_widget
|
||||
end
|
||||
end, })
|
||||
|
||||
Reference in New Issue
Block a user