Reworked a whole lot. New config file and theme config file for easier changes. Did #19. And much more

This commit is contained in:
Kievits Rene
2022-06-14 06:33:33 +02:00
parent fd74ab9fb4
commit 521d392769
60 changed files with 2216 additions and 1450 deletions

View File

@@ -4,11 +4,9 @@
-- 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")
require("src.core.signals")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/powermenu/"
@@ -21,8 +19,10 @@ return function(s)
resize = true,
forced_height = dpi(200),
clip_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 30)
gears.shape.rounded_rect(cr, width, height, dpi(30))
end,
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
}
@@ -55,7 +55,7 @@ return function(s)
-- Get the full username(if set) and the username + hostname
local update_user_name = function()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/pfp.sh 'userName' '" .. user_vars.namestyle .. "'",
"./.config/awesome/src/scripts/pfp.sh 'userName' '" .. User_config.namestyle .. "'",
function(stdout)
if stdout:gsub("\n", "") == "Rick Astley" then
profile_picture:set_image(awful.util.getdir("config") .. "src/assets/userpfp/" .. "rickastley.jpg")
@@ -73,42 +73,35 @@ return function(s)
{
{
{
{
-- TODO: using gears.color to recolor a SVG will make it look super low res
-- currently I recolor it in the .svg file directly, but later implement
-- a better way to recolor a SVG
-- image = gears.color.recolor_image(icon, color["Grey900"]),
image = icon,
resize = true,
forced_height = dpi(30),
widget = wibox.widget.imagebox
},
margins = dpi(0),
widget = wibox.container.margin
-- TODO: using gears.color to recolor a SVG will make it look super low res
-- currently I recolor it in the .svg file directly, but later implement
-- a better way to recolor a SVG
-- image = gears.color.recolor_image(icon, color["Grey900"]),
image = icon,
resize = true,
forced_height = dpi(30),
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
{
{
text = name,
font = "JetBrains Mono Bold 30",
widget = wibox.widget.textbox
},
margins = dpi(0),
widget = wibox.container.margin
text = name,
font = "JetBrains Mono Bold 30",
widget = wibox.widget.textbox
},
widget = wibox.layout.fixed.horizontal
},
margins = dpi(10),
widget = wibox.container.margin
},
fg = color["Grey900"],
fg = Theme_config.powermenu.button_fg,
bg = bg_color,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
gears.shape.rounded_rect(cr, width, height, dpi(10))
end,
widget = wibox.container.background,
id = 'background'
},
spacing = dpi(0),
layout = wibox.layout.align.vertical
}
@@ -148,79 +141,49 @@ return function(s)
end
-- Create the buttons with their command and name etc
local shutdown_button = button("Shutdown", icondir .. "shutdown.svg", color["Blue200"], shutdown_command)
local reboot_button = button("Reboot", icondir .. "reboot.svg", color["Red200"], reboot_command)
local suspend_button = button("Suspend", icondir .. "suspend.svg", color["Yellow200"], suspend_command)
local logout_button = button("Logout", icondir .. "logout.svg", color["Green200"], logout_command)
local lock_button = button("Lock", icondir .. "lock.svg", color["Orange200"], lock_command)
local shutdown_button = button("Shutdown", icondir .. "shutdown.svg", Theme_config.powermenu.shutdown_button_bg,
shutdown_command)
local reboot_button = button("Reboot", icondir .. "reboot.svg", Theme_config.powermenu.reboot_button_bg, reboot_command)
local suspend_button = button("Suspend", icondir .. "suspend.svg", Theme_config.powermenu.suspend_button_bg,
suspend_command)
local logout_button = button("Logout", icondir .. "logout.svg", Theme_config.powermenu.logout_button_bg, logout_command)
local lock_button = button("Lock", icondir .. "lock.svg", Theme_config.powermenu.lock_button_bg, lock_command)
-- Signals to change color on hover
Hover_signal(shutdown_button.background, color["Blue200"], color["Grey900"])
Hover_signal(reboot_button.background, color["Red200"], color["Grey900"])
Hover_signal(suspend_button.background, color["Yellow200"], color["Grey900"])
Hover_signal(logout_button.background, color["Green200"], color["Grey900"])
Hover_signal(lock_button.background, color["Orange200"], color["Grey900"])
Hover_signal(shutdown_button.background, Theme_config.powermenu.shutdown_button_bg, Theme_config.powermenu.button_fg)
Hover_signal(reboot_button.background, Theme_config.powermenu.reboot_button_bg, Theme_config.powermenu.button_fg)
Hover_signal(suspend_button.background, Theme_config.powermenu.suspend_button_bg, Theme_config.powermenu.button_fg)
Hover_signal(logout_button.background, Theme_config.powermenu.logout_button_bg, Theme_config.powermenu.button_fg)
Hover_signal(lock_button.background, Theme_config.powermenu.lock_button_bg, Theme_config.powermenu.button_fg)
-- The powermenu widget
local powermenu = wibox.widget {
layout = wibox.layout.align.vertical,
expand = "none",
nil,
{
{
nil,
{
{
nil,
{
nil,
{
profile_picture,
margins = dpi(0),
widget = wibox.container.margin
},
nil,
expand = "none",
layout = wibox.layout.align.horizontal
},
nil,
layout = wibox.layout.align.vertical,
expand = "none"
},
spacing = dpi(50),
{
profile_name,
margins = dpi(0),
widget = wibox.container.margin
},
layout = wibox.layout.fixed.vertical
},
nil,
expand = "none",
layout = wibox.layout.align.horizontal
profile_picture,
profile_name,
spacing = dpi(50),
layout = wibox.layout.fixed.vertical
},
{
nil,
{
{
shutdown_button,
reboot_button,
logout_button,
lock_button,
suspend_button,
spacing = dpi(30),
layout = wibox.layout.fixed.horizontal
},
margins = dpi(0),
widget = wibox.container.margin
shutdown_button,
reboot_button,
logout_button,
lock_button,
suspend_button,
spacing = dpi(30),
layout = wibox.layout.fixed.horizontal
},
nil,
expand = "none",
layout = wibox.layout.align.horizontal
halign = "center",
valign = "center",
widget = wibox.container.place
},
layout = wibox.layout.align.vertical
layout = wibox.layout.fixed.vertical
},
nil
halign = "center",
valign = "center",
widget = wibox.container.place
}
-- Container for the widget, covers the entire screen
@@ -230,7 +193,7 @@ return function(s)
type = "splash",
visible = false,
ontop = true,
bg = "#21212188",
bg = Theme_config.powermenu.container_bg,
height = s.geometry.height,
width = s.geometry.width,
x = s.geometry.x,