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

@@ -7,7 +7,8 @@
-- ╚═╝ ╚═╝ ╚══╝╚══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ --
-----------------------------------------------------------------------------------------
-- Initialising, order is important!
require("src.theme.user_variables")
require("src.theme.user_config")
require("src.theme.theme_config")
require("src.theme.init")
require("src.core.error_handling")
require("src.core.signals")
@@ -16,5 +17,5 @@ require("src.core.rules")
require("src.bindings.global_buttons")
require("src.bindings.bind_to_tags")
require("src.modules.init")
require("src.tools.auto_starter")(user_vars.autostart)
require("src.tools.auto_starter")(User_config.autostart)
require("src.dbus.bluetooth_dbus")()

Binary file not shown.

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z" /></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1 +1 @@
Lutris;Steam;Io.elementary.appcenter;Repoman;Com.github.donadigo.eddy;Sysmontask;join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=Gnome-calculator;Virt-manager;Gwe;whatsdesk;Totem;steam_app_431960;
Lutris;Steam;Io.elementary.appcenter;Repoman;Com.github.donadigo.eddy;Sysmontask;join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=Gnome-calculator;Virt-manager;Gwe;whatsdesk;Totem;steam_app_431960;Viewer,;Viewer,;Nvidia-settings;openrgb;

View File

@@ -2,7 +2,7 @@
local awful = require("awful")
local gears = require("gears")
local globalkeys = require("src.bindings.global_keys")
local modkey = user_vars.modkey
local modkey = User_config.modkey
for i = 1, 9 do
globalkeys = gears.table.join(globalkeys,

View File

@@ -2,7 +2,7 @@
local awful = require("awful")
local gears = require("gears")
local modkey = user_vars.modkey
local modkey = User_config.modkey
return gears.table.join(
awful.button({}, 1, function(c)

View File

@@ -2,7 +2,7 @@
local awful = require("awful")
local gears = require("gears")
local modkey = user_vars.modkey
local modkey = User_config.modkey
return gears.table.join(
awful.key(

View File

@@ -4,7 +4,7 @@ local awful = require("awful")
local hotkeys_popup = require("awful.hotkeys_popup")
local ruled = require("ruled")
local modkey = user_vars.modkey
local modkey = User_config.modkey
return gears.table.join(
awful.key(
@@ -90,7 +90,7 @@ return gears.table.join(
{ modkey },
"#36",
function()
awful.spawn(user_vars.terminal)
awful.spawn(User_config.terminal)
end,
{ description = "Open terminal", group = "Applications" }
),
@@ -160,7 +160,7 @@ return gears.table.join(
{ modkey },
"#23",
function()
awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi")
awful.spawn("rofi -kb-accept-entry '!Alt-Tab' -kb-row-down Alt-Tab -show window -theme ~/.config/rofi/window.rasi")
end,
{ descripton = "Client switcher (alt+tab)", group = "Application" }
),
@@ -168,7 +168,7 @@ return gears.table.join(
{ "Mod1" },
"#23",
function()
awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi")
awful.spawn("rofi -kb-accept-entry '!Alt-Tab' -kb-row-down Alt-Tab -show window -theme ~/.config/rofi/window.rasi")
end,
{ descripton = "Client switcher (alt+tab)", group = "Application" }
),
@@ -176,7 +176,7 @@ return gears.table.join(
{ modkey },
"#26",
function()
awful.spawn(user_vars.file_manager)
awful.spawn(User_config.file_manager)
end,
{ descripton = "Open file manager", group = "System" }
),
@@ -192,7 +192,7 @@ return gears.table.join(
{},
"#107",
function()
awful.spawn(user_vars.screenshot_program)
awful.spawn(User_config.screenshot_program)
end,
{ description = "Screenshot", group = "Applications" }
),
@@ -239,7 +239,8 @@ return gears.table.join(
awful.spawn.easy_async_with_shell(
"pkexec xfpm-power-backlight-helper --get-brightness",
function(stdout)
awful.spawn.easy_async_with_shell("pkexec xfpm-power-backlight-helper --set-brightness " .. tostring(tonumber(stdout) + BACKLIGHT_SEPS), function(stdou2)
awful.spawn.easy_async_with_shell("pkexec xfpm-power-backlight-helper --set-brightness " ..
tostring(tonumber(stdout) + BACKLIGHT_SEPS), function(stdou2)
end)
awesome.emit_signal("module::brightness_osd:show", true)
@@ -257,7 +258,8 @@ return gears.table.join(
awful.spawn.easy_async_with_shell(
"pkexec xfpm-power-backlight-helper --get-brightness",
function(stdout)
awful.spawn.easy_async_with_shell("pkexec xfpm-power-backlight-helper --set-brightness " .. tostring(tonumber(stdout) - BACKLIGHT_SEPS), function(stdout2)
awful.spawn.easy_async_with_shell("pkexec xfpm-power-backlight-helper --set-brightness " ..
tostring(tonumber(stdout) - BACKLIGHT_SEPS), function(stdout2)
end)
awesome.emit_signal("module::brightness_osd:show", true)
@@ -322,7 +324,8 @@ return gears.table.join(
return
end
end
awful.spawn.with_shell("echo -n '" .. stdout:gsub("\n", "") .. ";' >> ~/.config/awesome/src/assets/rules.txt")
awful.spawn.with_shell("echo -n '" ..
stdout:gsub("\n", "") .. ";' >> ~/.config/awesome/src/assets/rules.txt")
local c = mouse.screen.selected_tag:clients()
for j, client in ipairs(c) do
if client.class:match(stdout:gsub("\n", "")) then

View File

@@ -28,6 +28,8 @@ naughty.config.defaults.border_width = dpi(4)
naughty.config.defaults.border_color = color["Grey800"]
naughty.config.defaults.spacing = dpi(10)
Theme.notification_spacing = dpi(20)
naughty.connect_signal(
'request::icon',
function(n, context, hints)
@@ -44,7 +46,7 @@ naughty.connect_signal(
naughty.connect_signal(
"request::display",
function(n)
if user_vars.dnd then
if User_config.dnd then
n:destroy()
else
if n.urgency == "critical" then
@@ -89,6 +91,8 @@ naughty.connect_signal(
{
{
id = "icon_role",
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
id = "centered",
@@ -179,6 +183,8 @@ naughty.connect_signal(
{
image = gears.color.recolor_image(icondir .. "notification-outline.svg", color["Teal200"]),
resize = false,
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
right = dpi(5),
@@ -214,7 +220,7 @@ naughty.connect_signal(
{
{
{
font = user_vars.font.specify .. ", 10",
font = User_config.font.specify .. ", 10",
text = "",
align = "center",
valign = "center",
@@ -262,6 +268,8 @@ naughty.connect_signal(
image = n.icon,
resize = true,
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
clip_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end
@@ -328,7 +336,8 @@ naughty.connect_signal(
widget = wibox.container.background
}
local close = w_template.max_size.min_size.widget_layout.arc_app_bg.arc_app_layout.arc_app_layout_2.arc_margin.const.background
local close = w_template.max_size.min_size.widget_layout.arc_app_bg.arc_app_layout.arc_app_layout_2.arc_margin.
const.background
local arc = close.arc_chart
local timeout = n.timeout

View File

@@ -39,14 +39,37 @@ awful.rules.rules = {
"pop-up"
}
},
properties = { floating = true, titlebars_enabled = true }
properties = {
floating = true,
titlebars_enabled = true
}
},
{
id = "titlebar",
rule_any = {
type = { "normal", "dialog", "modal", "utility" }
type = {
"normal",
"dialog",
"modal",
"utility"
}
},
properties = { titlebars_enabled = true }
properties = {
titlebars_enabled = true
}
},
rule_any = {
class = {
'Wine',
'dolphin-emu',
'Steam',
'Citra',
},
name = { 'Steam' }
},
properties = {
skip_decoration = true,
placement = awful.placement.centered
}
}

View File

@@ -1,9 +1,7 @@
---@diagnostic disable: undefined-field
-- Awesome Libs
local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
local wibox = require("wibox")
screen.connect_signal(
"added",
@@ -50,8 +48,8 @@ client.connect_signal(
end
)
client.connect_signal(
'tag::switched',
tag.connect_signal(
'property::selected',
function(c)
if #awful.screen.focused().clients > 0 then
awful.screen.focused().clients[1]:emit_signal(
@@ -79,22 +77,6 @@ client.connect_signal(
end
)
-- Workaround for focused border color, why in the love of god doesnt it work with
-- beautiful.border_focus
client.connect_signal(
"focus",
function(c)
c.border_color = "#616161"
end
)
client.connect_signal(
"unfocus",
function(c)
c.border_color = beautiful.border_normal
end
)
--- Takes a wibox.container.background and connects four signals to it
---@param widget widget.container.background
---@param bg string

View File

@@ -28,12 +28,16 @@ return function()
interface = "org.freedesktop.DBus.Properties",
path = object_path
}
awesome.emit_signal("bluetooth::scan")
if device.Name ~= nil or device.Alias ~= nil then
if device.Name ~= "" and device.Name ~= nil then
device_properties:connect_signal(function()
awesome.emit_signal("bluetooth::device_changed", device, battery)
naughty.notification {
title = "Bluetooth Device Connected",
message = device.Name,
icon = require("awful").util.getdir("config") .. "src/assets/icons/bluetooth/bluetooth.svg"
}
awesome.emit_signal("device_added", object_path, device, battery)
end, "PropertiesChanged")
awesome.emit_signal("bluetooth::device_changed", device, battery)
end
end
end
@@ -87,16 +91,10 @@ return function()
"PropertiesChanged"
)
awesome.connect_signal(
"bluetooth::scan",
function()
Adapter:StartDiscovery()
end
)
AdapterProperties:connect_signal(
function(data)
if data.Powered ~= nil then
awesome.emit_signal("state", data.Powered)
if data.Powered then
Adapter:StartDiscovery()
end

View File

@@ -0,0 +1,25 @@
--------------------------------------
-- This is the application launcher --
--------------------------------------
-- 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")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/application_launcher/"
return function(s)
local applicaton_launcher = wibox.widget {
}
local application_container = awful.popup {
}
end

View File

@@ -4,10 +4,8 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local naughty = require("naughty")
local wibox = require("wibox")
local rubato = require("src.lib.rubato")
@@ -24,7 +22,8 @@ return function(s)
{
{
{
image = gears.color.recolor_image(icondir .. icon .. ".svg", color["Purple200"]),
image = gears.color.recolor_image(
icondir .. icon .. ".svg", Theme_config.bluetooth_controller.icon_color),
id = "icon",
resize = false,
valign = "center",
@@ -50,7 +49,7 @@ return function(s)
text = "Connecting...",
id = "connecting",
visible = false,
font = user_vars.font.specify .. ", regular 10",
font = User_config.font.specify .. ", regular 10",
widget = wibox.widget.textbox
},
id = "alias_container",
@@ -95,7 +94,7 @@ return function(s)
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
bg = color["Blue200"],
bg = Theme_config.bluetooth_controller.con_button_color,
widget = wibox.container.background
},
id = "margin0",
@@ -109,23 +108,24 @@ return function(s)
margins = dpi(5),
widget = wibox.container.margin
},
bg = color["Grey900"],
fg = color["LightBlue200"],
border_color = color["Grey800"],
border_width = dpi(2),
bg = Theme_config.bluetooth_controller.device_bg,
fg = Theme_config.bluetooth_controller.device_fg,
border_color = Theme_config.bluetooth_controller.device_border_color,
border_width = Theme_config.bluetooth_controller.device_border_width,
id = "background",
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
}
--! using :Connect freezes awesome, either find a solution or switch to console commands
if device.Connected then
device_widget:get_children_by_id("con")[1].image = gears.color.recolor_image(icondir .. "link-off.svg", color["Grey900"])
device_widget:get_children_by_id("con")[1].image = gears.color.recolor_image(icondir .. "link-off.svg",
Theme_config.bluetooth_controller.icon_color_dark)
device_widget:connect_signal(
"button::press",
function(c, d, e, key)
function(_, _, _, key)
if key == 1 then
device:Disconnect()
awesome.emit_signal("bluetooth::connect", device)
@@ -133,10 +133,11 @@ return function(s)
end
)
else
device_widget:get_children_by_id("con")[1].image = gears.color.recolor_image(icondir .. "link.svg", color["Grey900"])
device_widget:get_children_by_id("con")[1].image = gears.color.recolor_image(icondir .. "link.svg",
Theme_config.bluetooth_controller.icon_color_dark)
device_widget:connect_signal(
"button::press",
function(c, d, e, key)
function(_, _, _, key)
if key == 1 then
device:Connect()
awesome.emit_signal("bluetooth::disconnect", device)
@@ -144,7 +145,8 @@ return function(s)
end
)
end
Hover_signal(device_widget, '#313131', color["LightBlue100"])
Hover_signal(device_widget, Theme_config.bluetooth_controller.device_bg_hover,
Theme_config.bluetooth_controller.device_fg_hover)
return device_widget
end
@@ -168,10 +170,10 @@ return function(s)
widget = wibox.container.constraint
},
id = "connected_device_background",
border_color = color["Grey800"],
border_width = dpi(2),
border_color = Theme_config.bluetooth_controller.con_device_border_color,
border_width = Theme_config.bluetooth_controller.con_device_border_width,
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background
}
@@ -196,10 +198,10 @@ return function(s)
widget = wibox.container.constraint
},
id = "discovered_device_background",
border_color = color["Grey800"],
border_width = dpi(2),
border_color = Theme_config.bluetooth_controller.con_device_border_color,
border_width = Theme_config.bluetooth_controller.con_device_border_width,
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background
}
@@ -214,8 +216,11 @@ return function(s)
{
{
resize = false,
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]),
image = gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.bluetooth_controller.connected_icon_color),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
id = "icon"
},
id = "center",
@@ -225,7 +230,7 @@ return function(s)
},
{
{
text = "Coupled Devices",
text = "Paired Devices",
widget = wibox.widget.textbox,
id = "device_name"
},
@@ -236,10 +241,10 @@ return function(s)
layout = wibox.layout.fixed.horizontal
},
id = "connected_bg",
bg = color["Grey800"],
fg = color["Purple200"],
bg = Theme_config.bluetooth_controller.connected_bg,
fg = Theme_config.bluetooth_controller.connected_fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
},
@@ -257,8 +262,11 @@ return function(s)
{
{
resize = false,
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["LightBlueA200"]),
image = gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.bluetooth_controller.discovered_icon_color),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
id = "icon",
},
id = "center",
@@ -279,10 +287,10 @@ return function(s)
layout = wibox.layout.fixed.horizontal
},
id = "discovered_bg",
bg = color["Grey800"],
fg = color["Blue200"],
bg = Theme_config.bluetooth_controller.discovered_bg,
fg = Theme_config.bluetooth_controller.discovered_fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
},
@@ -305,9 +313,9 @@ return function(s)
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(8))
end,
border_color = color["Grey800"],
border_width = dpi(4),
bg = color["Grey900"],
border_color = Theme_config.bluetooth_controller.container_border_color,
border_width = Theme_config.bluetooth_controller.container_border_width,
bg = Theme_config.bluetooth_controller.container_bg,
id = "background",
widget = wibox.container.background
},
@@ -320,13 +328,15 @@ return function(s)
local bluetooth_controller_container = awful.popup {
widget = wibox.container.background,
ontop = true,
bg = color["Grey900"],
bg = Theme_config.bluetooth_controller.container_bg,
stretch = false,
visible = false,
screen = s,
placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(380), top = dpi(60) } }) end,
placement = function(c) awful.placement.align(c,
{ position = "top_right", margins = { right = dpi(380), top = dpi(60) } })
end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end
}
@@ -404,15 +414,17 @@ return function(s)
rubato_timer.target = dpi(210)
end
connected_margin.connected_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
connected.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Purple200"]))
connected.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg",
Theme_config.bluetooth_controller.connected_icon_color))
else
rubato_timer.target = 0
connected_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
end
connected.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]))
connected.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.bluetooth_controller.connected_icon_color))
end
end
)
@@ -446,15 +458,17 @@ return function(s)
rubato_timer.target = dpi(20)
end
discovered_margin.discovered_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
discovered.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["LightBlue200"]))
discovered.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg",
Theme_config.bluetooth_controller.discovered_icon_color))
else
rubato_timer.target = dpi(0)
rubato_timer.target = 0
discovered_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
end
discovered.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["LightBlue200"]))
discovered.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.bluetooth_controller.discovered_icon_color))
end
end
)

View File

@@ -28,107 +28,65 @@ return function(s)
local brightness_osd_widget = wibox.widget {
{
{
{
{
nil,
{
nil,
{
{ -- Brightness Icon
image = gears.color.recolor_image(icondir .. "brightness-high.svg", Theme_config.brightness_osd.icon_color),
valign = "center",
halign = "center",
resize = false,
id = "icon",
forced_height = dpi(220),
image = icondir .. "brightness-high.svg",
widget = wibox.widget.imagebox
},
nil,
expand = "none",
id = "icon_margin2",
layout = wibox.layout.align.vertical
},
nil,
id = "icon_margin1",
expand = "none",
layout = wibox.layout.align.horizontal
},
{ -- Brightness Bar
{
{
id = "label",
text = "Brightness",
align = "left",
id = "progressbar1",
color = Theme_config.brightness_osd.bar_bg_active,
background_color = Theme_config.brightness_osd.bar_bg,
max_value = 100,
value = 50,
forced_height = dpi(6),
shape = function(cr, width, height)
gears.shape.rounded_bar(cr, width, height, dpi(6))
end,
widget = wibox.widget.progressbar
},
id = "progressbar_container2",
halign = "center",
valign = "center",
widget = wibox.widget.textbox
},
nil,
{
id = "value",
text = "0%",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "label_value_layout",
forced_height = dpi(48),
layout = wibox.layout.align.horizontal,
},
{
{
id = "brightness_slider",
bar_shape = gears.shape.rounded_rect,
bar_height = dpi(10),
bar_color = color["Grey800"] .. "88",
bar_active_color = "#ffffff",
handle_color = "#ffffff",
handle_shape = gears.shape.circle,
handle_width = dpi(10),
handle_border_color = color["White"],
maximum = 100,
widget = wibox.widget.slider
},
id = "slider_layout",
forced_height = dpi(24),
widget = wibox.container.place
},
id = "icon_slider_layout",
spacing = dpi(0),
layout = wibox.layout.align.vertical
id = "progressbar_container",
width = dpi(240),
heigth = dpi(20),
stragety = "max",
widget = wibox.container.constraint
},
id = "osd_layout",
layout = wibox.layout.align.vertical
id = "layout1",
spacing = dpi(10),
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(24),
right = dpi(24),
id = "margin",
margins = dpi(10),
widget = wibox.container.margin
},
bg = color["Grey900"] .. "88",
widget = wibox.container.background,
ontop = true,
visible = true,
type = "notification",
forced_height = dpi(300),
forced_width = dpi(300),
offset = dpi(5),
forced_height = dpi(80),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
border_color = Theme_config.brightness_osd.border_color,
border_width = Theme_config.brightness_osd.border_width,
fg = Theme_config.brightness_osd.fg,
bg = Theme_config.brightness_osd.bg,
widget = wibox.container.background
}
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:connect_signal(
"property::value",
function()
local update_slider = function()
awful.spawn.easy_async_with_shell(
"pkexec xfpm-power-backlight-helper --get-brightness",
[[ pkexec xfpm-power-backlight-helper --get-brightness ]],
function(stdout)
local brightness_value = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
brightness_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text(tostring(brightness_value) .. "%")
awesome.emit_signal(
"widget::brightness:update",
brightness_value
)
if awful.screen.focused().show_brightness_osd then
awesome.emit_signal(
"module::brightness_osd:show",
true
)
end
brightness_osd_widget:get_children_by_id("progressbar")[1].value = stdout
local icon = icondir .. "brightness"
if brightness_value >= 0 and brightness_value < 34 then
@@ -138,49 +96,23 @@ return function(s)
elseif brightness_value >= 67 then
icon = icon .. "-high"
end
brightness_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icon .. ".svg")
awesome.emit_signal("update::backlight_widget", brightness_value, icon .. ".svg")
brightness_osd_widget:get_children_by_id("icon"):set_image(gears.color.recolor_image(icon .. ".svg",
Theme_config.brightness_osd.icon_color))
end
)
end
)
local update_slider = function()
awful.spawn.easy_async_with_shell(
[[ pkexec xfpm-power-backlight-helper --get-brightness ]],
function(stdout)
stdout = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(stdout)
end
)
end
awesome.connect_signal(
"module::brightness_slider:update",
function()
update_slider()
end
)
awesome.connect_signal(
"widget::brightness:update",
function(value)
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(tonumber(value))
end
)
update_slider()
local brightness_container = awful.popup {
widget = wibox.container.background,
widget = {},
ontop = true,
bg = color["Grey900"] .. "00",
stretch = false,
visible = false,
screen = s,
placement = function(c) awful.placement.centered(c, { margins = { top = dpi(200) } }) end,
placement = function(c) awful.placement.bottom_left(c, { margins = dpi(20) }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 15)
gears.shape.rounded_rect(cr, width, height, dpi(14))
end
}
@@ -200,36 +132,14 @@ return function(s)
awesome.connect_signal(
"widget::brightness_osd:rerun",
function()
brightness_container.visible = true
if hide_brightness_osd.started then
hide_brightness_osd:again()
update_slider()
else
hide_brightness_osd:start()
update_slider()
end
end
)
awesome.connect_signal(
"module::brightness_osd:show",
function()
if s == mouse.screen then
brightness_container.visible = true
end
end
)
brightness_container:connect_signal(
"mouse::enter",
function()
brightness_container.visible = true
hide_brightness_osd:stop()
end
)
brightness_container:connect_signal(
"mouse::leave",
function()
brightness_container.visible = true
hide_brightness_osd:again()
end
)
end

View File

@@ -19,7 +19,7 @@ return function(s, widgets)
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, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end
}
@@ -27,12 +27,12 @@ return function(s, widgets)
top = 55
}
local function prepare_widgets(widgets)
local function prepare_widgets(w)
local layout = {
forced_height = 45,
forced_height = dpi(50),
layout = wibox.layout.fixed.horizontal
}
for i, widget in pairs(widgets) do
for i, widget in pairs(w) do
if i == 1 then
table.insert(layout,
{
@@ -43,7 +43,7 @@ return function(s, widgets)
bottom = dpi(6),
widget = wibox.container.margin
})
elseif i == #widgets then
elseif i == #w then
table.insert(layout,
{
widget,
@@ -98,7 +98,7 @@ return function(s, widgets)
)
client.connect_signal(
"tag::switched",
"property::selected",
function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false

View File

@@ -8,31 +8,38 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local desktop_parser = require("src.tools.desktop_parser")
return function(screen, programs)
local function create_dock_element(class, program, name, user_icon, is_steam, size)
if program == nil or class == nil then
local function create_dock_element(program, size)
if not program then
return
end
is_steam = is_steam or false
user_icon = user_icon or nil
local dock_element = wibox.widget {
{
{
{
{
resize = true,
forced_width = size,
forced_height = size,
image = user_icon or Get_icon(user_vars.icon_theme, nil, program, class, is_steam),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
id = "icon",
},
id = "icon_container",
strategy = "exact",
width = size,
height = size,
widget = wibox.container.constraint
},
margins = dpi(5),
widget = wibox.container.margin,
id = "margin"
},
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
gears.shape.rounded_rect(cr, width, height, dpi(10))
end,
bg = color["Grey900"],
widget = wibox.container.background,
@@ -44,8 +51,10 @@ return function(screen, programs)
widget = wibox.container.margin
}
dock_element.background.margin.icon_container.icon.image = xdg_icon_lookup:find_icon(program["Icon"], 64)
for _, c in ipairs(client.get()) do
if string.lower(c.class):match(program) and c == client.focus then
if string.lower(c.class):match(program["Icon"]) and c == client.focus then
dock_element.background.bg = color["Grey800"]
end
end
@@ -54,18 +63,16 @@ return function(screen, programs)
dock_element:connect_signal(
"button::press",
function()
if is_steam then
awful.spawn("steam steam://rungameid/" .. program)
else
awful.spawn(program)
function(_, _, _, button)
if button == 1 then
awful.spawn(program["Exec"])
end
end
)
awful.tooltip {
objects = { dock_element },
text = name,
text = program["Name"],
mode = "outside",
preferred_alignments = "middle",
margins = dpi(10)
@@ -81,10 +88,10 @@ return function(screen, programs)
visible = true,
screen = screen,
type = "dock",
height = user_vars.dock_icon_size + 10,
height = User_config.dock_icon_size + 10,
placement = function(c) awful.placement.bottom(c, { margins = dpi(10) }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 15)
gears.shape.rounded_rect(cr, width, height, dpi(16))
end
}
@@ -97,14 +104,14 @@ return function(screen, programs)
type = "dock",
id = "fakedock",
height = dpi(10),
placement = function(c) awful.placement.bottom(c, { margins = dpi(0) }) end,
placement = function(c) awful.placement.bottom(c) end,
}
local function get_dock_elements(pr)
local dock_elements = { layout = wibox.layout.fixed.horizontal }
for i, p in ipairs(pr) do
dock_elements[i] = create_dock_element(p[1], p[2], p[3], p[4], p[5], user_vars.dock_icon_size)
dock_elements[i] = create_dock_element(desktop_parser(p), User_config.dock_icon_size)
end
return dock_elements
@@ -118,7 +125,7 @@ return function(screen, programs)
for i = 0, amount, 1 do
fake_elements[i] = wibox.widget {
bg = '00000000',
forced_width = user_vars.dock_icon_size + dpi(20),
forced_width = User_config.dock_icon_size + dpi(20),
forced_height = dpi(10),
id = "fake",
widget = wibox.container.background
@@ -134,7 +141,10 @@ return function(screen, programs)
local indicators = { layout = wibox.layout.flex.horizontal, spacing = dpi(5) }
local col = color["Grey600"]
for i, c in ipairs(clients) do
if string.lower(c.class or c.name):match(string.lower(pr[1]) or string.lower(pr[2])) then
local icon = desktop_parser(pr)
if icon then
local icon_name = icon["Icon"] or ""
if icon_name:match(string.lower(c.class or c.name or nil)) then
if c == client.focus then
col = color["YellowA200"]
elseif c.urgent then
@@ -157,6 +167,7 @@ return function(screen, programs)
}
end
end
end
container[index] = wibox.widget {
indicators,
forced_height = dpi(5),
@@ -206,7 +217,7 @@ return function(screen, programs)
if not c.minimized then
local y = c:geometry().y
local h = c.height
if (y + h) >= s.geometry.height - user_vars.dock_icon_size - 35 then
if (y + h) >= s.geometry.height - User_config.dock_icon_size - 35 then
dock.visible = false
return
else
@@ -304,10 +315,4 @@ return function(screen, programs)
dock_intelligent_hide:again()
end
)
dock:setup {
get_dock_elements(programs),
create_incicator_widget(programs),
layout = wibox.layout.fixed.vertical
}
end

View File

@@ -3,50 +3,71 @@
--------------------------------------------------------------------------------------------------------------
return function(s)
xdg_icon_lookup = require("src.tools.xdg_icon_lookup")()
-- Every Widget
--[[
If you are going to use a widget on a single screen only, put it inside the s.index == X where X is the screen number.
This will lead to better performance and prevent widgets to be loaded but not used
--]]
s.audio = require("src.widgets.audio")(s)
s.date = require("src.widgets.date")()
s.clock = require("src.widgets.clock")()
s.layoutlist = require("src.widgets.layout_list")()
s.powerbutton = require("src.widgets.power")()
s.kblayout = require("src.widgets.kblayout")(s)
s.taglist = require("src.widgets.taglist")(s)
s.tasklist = require("src.widgets.tasklist")(s)
-- s.battery = require("src.widgets.battery")()
-- s.bluetooth = require("src.widgets.bluetooth")()
-- s.cpu_freq = require("src.widgets.cpu_info")("freq", "average")
-- s.systray = require("src.widgets.systray")(s)
-- s.cpu_usage = require("src.widgets.cpu_info")("usage")
-- s.cpu_temp = require("src.widgets.cpu_info")("temp")
-- s.gpu_usage = require("src.widgets.gpu_info")("usage")
-- s.gpu_temp = require("src.widgets.gpu_info")("temp")
-- s.network = require("src.widgets.network")()
-- s.ram_info = require("src.widgets.ram_info")()
if s.index == 1 then
s.systray = require("src.widgets.systray")(s)
s.cpu_usage = require("src.widgets.cpu_info")("usage")
s.cpu_temp = require("src.widgets.cpu_info")("temp")
s.gpu_usage = require("src.widgets.gpu_info")("usage")
s.gpu_temp = require("src.widgets.gpu_info")("temp")
require("src.modules.crylia_bar.left_bar")(s, { s.layoutlist, s.systray, s.taglist })
require("src.modules.crylia_bar.center_bar")(s, { s.tasklist })
require("src.modules.crylia_bar.right_bar")(s, { s.gpu_usage, s.gpu_temp, s.cpu_usage, s.cpu_temp, s.audio, s.kblayout, s.date, s.clock, s.powerbutton })
require("src.modules.crylia_bar.dock")(s, user_vars.dock_programs)
end
if s.index == 2 then
s.network = require("src.widgets.network")()
s.ram_info = require("src.widgets.ram_info")()
require("src.modules.crylia_bar.left_bar")(s, { s.layoutlist, s.taglist })
require("src.modules.crylia_bar.center_bar")(s, { s.tasklist })
require("src.modules.crylia_bar.right_bar")(s, { s.ram_info, s.audio, s.kblayout, s.network, s.date, s.clock, s.powerbutton })
---Lookup function to return the widget from its easy name string
---@param widgets table
---@return widget
local function get_widgets(widgets)
local widget_table = {}
if widgets then
for _, widget in ipairs(widgets) do
if widget == "Audio" then
table.insert(widget_table, require("src.widgets.audio")(s))
elseif widget == "Battery" then
table.insert(widget_table, require("src.widgets.battery")(User_config.battery_path))
elseif widget == "Bluetooth" then
table.insert(widget_table, require("src.widgets.bluetooth")())
elseif widget == "Clock" then
table.insert(widget_table, require("src.widgets.clock")())
elseif widget == "Cpu Frequency" then
table.insert(widget_table, require("src.widgets.cpu_info")("freq", User_config.cpu_frequency))
elseif widget == "Cpu Temperature" then
table.insert(widget_table, require("src.widgets.cpu_info")("temp"))
elseif widget == "Cpu Usage" then
table.insert(widget_table, require("src.widgets.cpu_info")("usage"))
elseif widget == "Date" then
table.insert(widget_table, require("src.widgets.date")())
elseif widget == "Gpu Temperature" then
table.insert(widget_table, require("src.widgets.gpu_info")("temp"))
elseif widget == "Gpu Usage" then
table.insert(widget_table, require("src.widgets.gpu_info")("usage"))
elseif widget == "Keyboard Layout" then
table.insert(widget_table, require("src.widgets.kblayout")(s))
elseif widget == "Tiling Layout" then
table.insert(widget_table, require("src.widgets.layout_list")())
elseif widget == "Network" then
table.insert(widget_table, require("src.widgets.network")())
elseif widget == "Power Button" then
table.insert(widget_table, require("src.widgets.power")())
elseif widget == "Ram Usage" then
table.insert(widget_table, require("src.widgets.ram_info")())
elseif widget == "Systray" then
table.insert(widget_table, require("src.widgets.systray")(s))
elseif widget == "Taglist" then
table.insert(widget_table, require("src.widgets.taglist")(s))
elseif widget == "Tasklist" then
table.insert(widget_table, require("src.widgets.tasklist")(s))
end
end
end
return widget_table
end
if User_config.widgets then
for index, screen in ipairs(User_config.widgets) do
if index == s.index then
if screen.left_bar then
require("src.modules.crylia_bar.left_bar")(s, get_widgets(screen.left_bar))
end
if screen.center_bar then
require("src.modules.crylia_bar.center_bar")(s, get_widgets(screen.center_bar))
end
if screen.right_bar then
require("src.modules.crylia_bar.right_bar")(s, get_widgets(screen.right_bar))
end
end
end
end
require("src.modules.crylia_bar.dock")(s, User_config.dock_programs)
end

View File

@@ -8,18 +8,20 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
return function(s, widgets)
return function(s, w)
local top_left = awful.popup {
screen = s,
widget = wibox.container.background,
widget = {
},
ontop = false,
bg = color["Grey900"],
visible = true,
maximum_width = dpi(650),
placement = function(c) awful.placement.top_left(c, { margins = dpi(10) }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end
}
@@ -29,7 +31,7 @@ return function(s, widgets)
local function prepare_widgets(widgets)
local layout = {
forced_height = 45,
forced_height = dpi(50),
layout = wibox.layout.fixed.horizontal
}
for i, widget in pairs(widgets) do
@@ -69,7 +71,7 @@ return function(s, widgets)
end
top_left:setup {
prepare_widgets(widgets),
prepare_widgets(w),
nil,
nil,
layout = wibox.layout.fixed.horizontal

View File

@@ -8,7 +8,7 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
return function(s, widgets)
return function(s, w)
local top_right = awful.popup {
widget = wibox.container.background,
@@ -18,7 +18,7 @@ return function(s, widgets)
screen = s,
placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end
}
@@ -28,7 +28,7 @@ return function(s, widgets)
local function prepare_widgets(widgets)
local layout = {
forced_height = 45,
forced_height = dpi(50),
layout = wibox.layout.fixed.horizontal
}
for i, widget in pairs(widgets) do
@@ -70,7 +70,7 @@ return function(s, widgets)
top_right:setup {
nil,
nil,
prepare_widgets(widgets),
prepare_widgets(w),
layout = wibox.layout.align.horizontal
}
end

View File

@@ -10,11 +10,11 @@ awful.screen.connect_for_each_screen(
-- e.g. 1 would be the primary screen and 2 the secondary screen.
function(s)
-- Create 9 tags
awful.layout.layouts = user_vars.layouts
awful.layout.layouts = User_config.layouts
awful.tag(
{ "1", "2", "3", "4", "5", "6", "7", "8", "9" },
s,
user_vars.layouts[1]
User_config.layouts[1]
)
require("src.modules.powermenu")(s)
@@ -24,5 +24,6 @@ awful.screen.connect_for_each_screen(
require("src.modules.volume_controller")(s)
require("src.modules.crylia_bar.init")(s)
require("src.modules.notification-center.init")(s)
require("src.modules.window_switcher.init")(s)
end
)

View File

@@ -149,13 +149,13 @@ return function(s)
right_button.visible = false
toggle_button.active = not toggle_button.active
toggle_button.border_color = color["Grey800"]
user_vars.dnd = false
User_config.dnd = false
else
left_button.visible = false
right_button.visible = true
toggle_button.active = not toggle_button.active
toggle_button.border_color = color["Purple200"]
user_vars.dnd = true
User_config.dnd = true
end
end
)

View File

@@ -15,7 +15,7 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
local nl = {}
nl.notification_list = { layout = require("src.lib.overflow_widget.overflow").vertical, scrollbar_width = 0, scroll_speed = 10, spacing = dpi(20) }
nl.notification_list = { layout = wibox.layout.overflow.vertical, scrollbar_width = 0, step = dpi(10), spacing = dpi(20) }
-- @param {table} notification
-- @return {widget} notifications_list
@@ -66,7 +66,7 @@ function nl.create_notification(n)
{
{
{
font = user_vars.font.specify .. ", 10",
font = User_config.font.specify .. ", 10",
text = "",
align = "center",
valign = "center",
@@ -110,6 +110,8 @@ function nl.create_notification(n)
{
image = gears.color.recolor_image(icondir .. "notification-outline.svg", color["Teal200"]),
resize = false,
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
right = dpi(5),
@@ -151,6 +153,8 @@ function nl.create_notification(n)
image = n.icon,
resize = true,
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
clip_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end

View File

@@ -44,6 +44,8 @@ return function(s)
local shuffle_button = wibox.widget {
resize = false,
image = gears.color.recolor_image(icondir .. "shuffle.svg", color["Grey800"]),
valign = "center",
halign = "center",
widget = wibox.widget.imagebox,
}
@@ -81,6 +83,8 @@ return function(s)
resize = false,
image = gears.color.recolor_image(icondir .. "repeat.svg", color["Grey800"]),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
id = "imagebox"
}
@@ -108,6 +112,8 @@ return function(s)
local prev_button = wibox.widget {
resize = false,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Teal200"]),
widget = wibox.widget.imagebox
}
@@ -126,6 +132,8 @@ return function(s)
local pause_play_button = wibox.widget {
resize = false,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "play-pause.svg", color["Teal200"]),
widget = wibox.widget.imagebox
}
@@ -139,6 +147,8 @@ return function(s)
local next_button = wibox.widget {
resize = false,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "skip-next.svg", color["Teal200"]),
widget = wibox.widget.imagebox
}
@@ -192,11 +202,13 @@ return function(s)
{
{ -- Album art
{
image = icondir .. "spotify.svg",
image = "default image",
resize = true,
clip_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(8))
end,
valign = "center",
halign = "center",
widget = wibox.widget.imagebox,
id = "imagebox"
},
@@ -211,7 +223,6 @@ return function(s)
{
{
{ --Title
markup = "Title",
halign = "center",
align = "center",
widget = wibox.widget.textbox,
@@ -234,7 +245,6 @@ return function(s)
{
{
{ --Artist
markup = "Artist",
halign = "center",
align = "center",
widget = wibox.widget.textbox,
@@ -304,7 +314,7 @@ return function(s)
color = color["Purple200"],
background_color = color["Grey800"],
max_value = 100,
value = 0,
value = 50,
forced_height = dpi(5),
shape = function(cr, width)
gears.shape.rounded_bar(cr, width, dpi(5))
@@ -380,7 +390,7 @@ return function(s)
function(stdout2)
local tit = stdout2:gsub("\n", "")
title = tit
music_widget:get_children_by_id("textbox4")[1].text = tit or "Title"
music_widget:get_children_by_id("textbox4")[1].text = tit
end
)
@@ -390,7 +400,7 @@ return function(s)
function(stdout2)
local art = stdout2:gsub("\n", "")
artist = art
music_widget:get_children_by_id("textbox3")[1].text = art or "Artist"
music_widget:get_children_by_id("textbox3")[1].text = art
end
)

View File

@@ -20,7 +20,7 @@ return function()
---Creates a layout with bar widgets based on the given table
---@param widget_table string{}
---@return table @{layout}
---@return table
local function create_bar_layout(widget_table)
local bar_layout = { layout = wibox.layout.flex.horizontal, spacing = dpi(10) }
@@ -105,7 +105,7 @@ return function()
color = color["Blue200"],
background_color = color["Grey800"],
max_value = 100,
value = 50,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
@@ -177,7 +177,7 @@ return function()
color = color["Red200"],
background_color = color["Grey800"],
max_value = 100,
value = 50,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
@@ -246,7 +246,7 @@ return function()
color = color["Green200"],
background_color = color["Grey800"],
max_value = 100,
value = 50,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
@@ -315,7 +315,7 @@ return function()
color = color["Green200"],
background_color = color["Grey800"],
max_value = 100,
value = 50,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
@@ -387,7 +387,7 @@ return function()
color = color["Yellow200"],
background_color = color["Grey800"],
max_value = 100,
value = 50,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
@@ -459,7 +459,7 @@ return function()
color = color["Purple200"],
background_color = color["Grey800"],
max_value = 100,
value = 50,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
@@ -531,7 +531,7 @@ return function()
color = color["Pink200"],
background_color = color["Grey800"],
max_value = 100,
value = 50,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
@@ -603,7 +603,7 @@ return function()
color = color["Purple200"],
background_color = color["Grey800"],
max_value = 100,
value = 50,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
@@ -679,7 +679,7 @@ return function()
{
{
{
create_bar_layout({ "cpu_usage", "cpu_temp", "ram_usage", "battery", "microphone", "backlight", "volume", "gpu_temp", "gpu_usage" }),
create_bar_layout(User_config.status_bar_widgets),
width = dpi(480),
strategy = "exact",
widget = wibox.container.constraint

View File

@@ -28,7 +28,7 @@ return function()
id = "label",
align = "left",
valign = "bottom",
format = "<span foreground='#69F0AE' font='JetBrainsMono Nerd Font, Regular 18'><b>%e</b></span><span foreground='#18FFFF' font='JetBrainsMono Nerd Font, Regular 18'><b> %b %Y</b></span>",
format = "<span foreground='#69F0AE' font='JetBrainsMono Nerd Font, Regular 18'><b>%d</b></span><span foreground='#18FFFF' font='JetBrainsMono Nerd Font, Regular 18'><b> %b %Y</b></span>",
widget = wibox.widget.textclock
},
widget = wibox.container.margin

View File

@@ -18,9 +18,9 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/weather/"
return function()
local api_secrets = {
key = user_vars.weather_secrets.key,
city_id = user_vars.weather_secrets.city_id,
unit = user_vars.weather_secrets.unit
key = User_config.weather_secrets.key,
city_id = User_config.weather_secrets.city_id,
unit = User_config.weather_secrets.unit
}
local weather_widget = wibox.widget {
@@ -83,6 +83,8 @@ return function()
resize = true,
forced_width = dpi(24),
forced_height = dpi(24),
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
{
@@ -107,6 +109,8 @@ return function()
forced_width = dpi(24),
forced_height = dpi(24),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "humidity.svg", color["OrangeA200"]),
id = "humidity_icon"
},
@@ -156,7 +160,8 @@ return function()
local function fetch_weather_data()
awful.spawn.easy_async_with_shell(
"curl -sf 'http://api.openweathermap.org/data/2.5/weather?id=" .. api_secrets.city_id .. "&units=" .. api_secrets.unit .. "&appid=" .. api_secrets.key .. "'",
"curl -sf 'http://api.openweathermap.org/data/2.5/weather?id=" ..
api_secrets.city_id .. "&units=" .. api_secrets.unit .. "&appid=" .. api_secrets.key .. "'",
function(stdout)
if not stdout:match('error') then
local weather_metadata = json_lua:decode(stdout)
@@ -193,7 +198,8 @@ return function()
weather_widget:get_children_by_id("icon")[1].image = icondir .. icon_table[weather_icon] .. ".svg"
weather_widget:get_children_by_id("temp")[1].text = math.floor(temp + 0.5) .. "°C"
weather_widget:get_children_by_id("city_country")[1].text = city .. ", " .. country
weather_widget:get_children_by_id("description")[1].text = description:sub(1, 1):upper() .. description:sub(2)
weather_widget:get_children_by_id("description")[1].text = description:sub(1, 1):upper() ..
description:sub(2)
weather_widget:get_children_by_id("line")[1].bg = color["Grey800"]
weather_widget:get_children_by_id("speed")[1].text = speed .. " m/s"
weather_widget:get_children_by_id("humidity")[1].text = humidity .. "%"

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")
@@ -71,7 +71,6 @@ return function(s)
local item = wibox.widget {
{
{
{
{
{
-- TODO: using gears.color to recolor a SVG will make it look super low res
@@ -81,34 +80,28 @@ return function(s)
image = icon,
resize = true,
forced_height = dpi(30),
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
margins = dpi(0),
widget = wibox.container.margin
},
{
{
text = name,
font = "JetBrains Mono Bold 30",
widget = wibox.widget.textbox
},
margins = dpi(0),
widget = wibox.container.margin
},
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,59 +141,30 @@ 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
},
spacing = dpi(50),
layout = wibox.layout.fixed.vertical
},
nil,
expand = "none",
layout = wibox.layout.align.horizontal
},
{
nil,
{
{
shutdown_button,
@@ -211,16 +175,15 @@ return function(s)
spacing = dpi(30),
layout = wibox.layout.fixed.horizontal
},
margins = dpi(0),
widget = wibox.container.margin
halign = "center",
valign = "center",
widget = wibox.container.place
},
nil,
expand = "none",
layout = wibox.layout.align.horizontal
layout = wibox.layout.fixed.vertical
},
layout = wibox.layout.align.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,

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/titlebar/"
@@ -16,6 +14,12 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/titlebar/"
awful.titlebar.enable_tooltip = true
awful.titlebar.fallback_name = 'Client'
Theme.titlebar_close_button_normal = icondir .. "close.svg"
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
Theme.titlebar_minimize_button_normal = icondir .. "minimize.svg"
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
local double_click_event_handler = function(double_click_event)
if double_click_timer then
double_click_timer:stop()
@@ -60,10 +64,10 @@ local create_click_events = function(c)
return buttons
end
local create_titlebar = function(c, bg, size)
local create_titlebar = function(c, size)
local titlebar = awful.titlebar(c, {
position = "left",
bg = bg,
bg = Theme_config.titlebar.bg,
size = size
})
@@ -73,27 +77,27 @@ local create_titlebar = function(c, bg, size)
{
awful.titlebar.widget.closebutton(c),
widget = wibox.container.background,
bg = color["Red200"],
bg = Theme_config.titlebar.close_button_bg,
shape = function(cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
id = "closebutton"
},
{
awful.titlebar.widget.maximizedbutton(c),
widget = wibox.container.background,
bg = color["Yellow200"],
bg = Theme_config.titlebar.minimize_button_bg,
shape = function(cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
id = "maximizebutton"
},
{
awful.titlebar.widget.minimizebutton(c),
widget = wibox.container.background,
bg = color["Green200"],
bg = Theme_config.titlebar.maximize_button_bg,
shape = function(cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
id = "minimizebutton"
},
@@ -119,15 +123,18 @@ local create_titlebar = function(c, bg, size)
layout = wibox.layout.align.vertical,
id = "main"
}
Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"], color["Grey900"])
Hover_signal(titlebar.main.margin.spacing.maximizebutton, color["Yellow200"], color["Grey900"])
Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"], color["Grey900"])
Hover_signal(titlebar.main.margin.spacing.closebutton, Theme_config.titlebar.close_button_bg,
Theme_config.titlebar.close_button_fg)
Hover_signal(titlebar.main.margin.spacing.maximizebutton, Theme_config.titlebar.minimize_button_bg,
Theme_config.titlebar.minimize_button_fg)
Hover_signal(titlebar.main.margin.spacing.minimizebutton, Theme_config.titlebar.maximize_button_bg,
Theme_config.titlebar.maximize_button_fg)
end
local create_titlebar_dialog = function(c, bg, size)
local create_titlebar_dialog_modal = function(c, size)
local titlebar = awful.titlebar(c, {
position = "left",
bg = bg,
bg = Theme_config.titlebar.bg,
size = size
})
@@ -137,18 +144,18 @@ local create_titlebar_dialog = function(c, bg, size)
{
awful.titlebar.widget.closebutton(c),
widget = wibox.container.background,
bg = color["Red200"],
bg = Theme_config.titlebar.close_button_bg,
shape = function(cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
id = "closebutton"
},
{
awful.titlebar.widget.minimizebutton(c),
widget = wibox.container.background,
bg = color["Green200"],
bg = Theme_config.titlebar.minimize_button_bg,
shape = function(cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
id = "minimizebutton"
},
@@ -174,79 +181,38 @@ local create_titlebar_dialog = function(c, bg, size)
layout = wibox.layout.align.vertical,
id = "main"
}
Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"], color["Grey900"])
Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"], color["Grey900"])
Hover_signal(titlebar.main.margin.spacing.closebutton, Theme_config.titlebar.close_button_bg,
Theme_config.titlebar.close_button_fg)
Hover_signal(titlebar.main.margin.spacing.minimizebutton, Theme_config.titlebar.minimize_button_bg,
Theme_config.titlebar.minimize_button_fg)
end
local draw_titlebar = function(c)
if c.type == 'normal' and not c.requests_no_titlebar then
if c.class == 'Firefox' then
create_titlebar(c, '#121212AA', 35)
elseif c.name == "Steam" then
create_titlebar(c, '#121212AA', 0)
elseif c.name == "Settings" then
create_titlebar(c, '#121212AA', 0)
elseif c.class == "gcr-prompter" or c.class == "Gcr-prompter" then
create_titlebar(c, '#121212AA', 0)
else
create_titlebar(c, '#121212AA', 35)
end
elseif c.type == 'dialog' then
create_titlebar_dialog(c, '#121212AA', 35)
end
end
client.connect_signal(
"property::maximized",
function(c)
if c.maximized then
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg"
elseif not c.minimized then
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
end
end
)
client.connect_signal(
"request::titlebars",
function(c)
if c.maximized then
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg"
draw_titlebar(c)
elseif not c.minimized then
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
draw_titlebar(c)
if c.type == "normal" then
create_titlebar(c, dpi(35))
elseif c.type == "dialog" then
create_titlebar_dialog_modal(c, dpi(35))
elseif c.type == "modal" then
create_titlebar_dialog_modal(c, dpi(35))
else
create_titlebar(c, dpi(35))
end
if not c.floating or c.maximized then
awful.titlebar.hide(c, 'left')
awful.titlebar.hide(c, 'right')
awful.titlebar.hide(c, 'top')
awful.titlebar.hide(c, 'bottom')
if not c.floating then
awful.titlebar.hide(c, "left")
end
end
)
client.connect_signal(
'property::floating',
"property::floating",
function(c)
if c.floating or (c.floating and c.maximized) then
awful.titlebar.show(c, 'left')
awful.titlebar.hide(c, 'right')
awful.titlebar.hide(c, 'top')
awful.titlebar.hide(c, 'bottom')
if c.floating and not (c.maximized or c.fullscreen) then
awful.titlebar.show(c, "left")
else
awful.titlebar.hide(c, 'left')
awful.titlebar.hide(c, 'right')
awful.titlebar.hide(c, 'top')
awful.titlebar.hide(c, 'bottom')
awful.titlebar.hide(c, "left")
end
end
)

View File

@@ -7,7 +7,6 @@ local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local naughty = require("naughty")
local wibox = require("wibox")
local rubato = require("src.lib.rubato")
@@ -26,6 +25,8 @@ return function(s)
{
id = "icon",
resize = false,
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
spacing = dpi(10),
@@ -46,7 +47,7 @@ return function(s)
border_color = color["Grey800"],
border_width = dpi(2),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
}
@@ -64,11 +65,13 @@ return function(s)
"update::bg_sink",
function(new_node)
if node == new_node then
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg", color["Grey900"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
color["Grey900"])
device.bg = color["Purple200"]
device.fg = color["Grey900"]
else
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg", color["Purple200"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
color["Purple200"])
device.bg = color["Grey900"]
device.fg = color["Purple200"]
end
@@ -79,18 +82,19 @@ return function(s)
function(stdout)
local node_active = stdout:gsub("\n", "")
if node == node_active then
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg", color["Grey900"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
color["Grey900"])
device.bg = color["Purple200"]
device.fg = color["Grey900"]
else
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg", color["Purple200"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
color["Purple200"])
device.bg = color["Grey900"]
device.fg = color["Purple200"]
end
end
)
awesome.emit_signal("update::bg_sink", node)
--Hover_signal(device, "#313131", color["Purple200"])
else
device:connect_signal(
@@ -106,11 +110,13 @@ return function(s)
"update::bg_source",
function(new_node)
if node == new_node then
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg", color["Grey900"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
color["Grey900"])
device.bg = color["Blue200"]
device.fg = color["Grey900"]
else
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg", color["Blue200"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
color["Blue200"])
device.bg = color["Grey900"]
device.fg = color["Blue200"]
end
@@ -121,11 +127,13 @@ return function(s)
function(stdout)
local node_active = stdout:gsub("\n", "")
if node == node_active then
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg", color["Grey900"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
color["Grey900"])
device.bg = color["Blue200"]
device.fg = color["Grey900"]
else
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg", color["Blue200"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
color["Blue200"])
device.bg = color["Grey900"]
device.fg = color["Blue200"]
end
@@ -161,7 +169,7 @@ return function(s)
border_width = dpi(2),
id = "volume_device_background",
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background
},
@@ -195,7 +203,7 @@ return function(s)
border_color = color["Grey800"],
border_width = dpi(2),
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background
},
@@ -216,6 +224,8 @@ return function(s)
resize = false,
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
id = "icon"
},
id = "center",
@@ -239,7 +249,7 @@ return function(s)
bg = color["Grey800"],
fg = color["Purple200"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
},
@@ -263,6 +273,8 @@ return function(s)
resize = false,
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["LightBlueA200"]),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
id = "icon",
},
id = "center",
@@ -286,7 +298,7 @@ return function(s)
bg = color["Grey800"],
fg = color["LightBlueA200"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
},
@@ -307,13 +319,15 @@ return function(s)
{
resize = false,
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "volume-high.svg", color["Purple200"]),
id = "icon",
},
{
{
bar_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(5))
end,
bar_height = dpi(5),
bar_color = color["Grey800"],
@@ -321,13 +335,12 @@ return function(s)
handle_color = color["Purple200"],
handle_shape = gears.shape.circle,
handle_border_color = color["Purple200"],
handle_width = dpi(15),
handle_width = dpi(12),
maximum = 100,
forced_height = dpi(26),
widget = wibox.widget.slider,
id = "slider"
},
bottom = dpi(12),
left = dpi(5),
id = "slider_margin",
widget = wibox.container.margin
@@ -347,13 +360,15 @@ return function(s)
{
resize = false,
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "microphone.svg", color["Blue200"]),
id = "icon"
},
{
{
bar_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(5))
end,
bar_height = dpi(5),
bar_color = color["Grey800"],
@@ -361,7 +376,7 @@ return function(s)
handle_color = color["Blue200"],
handle_shape = gears.shape.circle,
handle_border_color = color["Blue200"],
handle_width = dpi(15),
handle_width = dpi(12),
maximum = 100,
forced_height = dpi(26),
widget = wibox.widget.slider,
@@ -377,6 +392,7 @@ return function(s)
id = "mic_volume_margin",
left = dpi(10),
right = dpi(10),
top = dpi(10),
widget = wibox.container.margin
},
id = "controller_layout",
@@ -390,7 +406,7 @@ return function(s)
border_color = color["Grey800"],
border_width = dpi(4),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
forced_width = dpi(400),
widget = wibox.container.background
@@ -419,13 +435,13 @@ return function(s)
if volume_list.forced_height == 0 then
rubato_timer.target = dpi(200)
audio_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Purple200"]))
else
rubato_timer.target = 0
audio_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]))
end
@@ -455,20 +471,21 @@ return function(s)
if mic_list.forced_height == 0 then
rubato_timer.target = dpi(200)
mic_selector_margin.mic_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Blue200"]))
else
rubato_timer.target = 0
mic_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Blue200"]))
end
end
)
local audio_slider_margin = volume_controller:get_children_by_id("audio_volume_margin")[1].audio_volume.slider_margin.slider
local audio_slider_margin = volume_controller:get_children_by_id("audio_volume_margin")[1].audio_volume.slider_margin.
slider
-- Volume slider change event
audio_slider_margin:connect_signal(
@@ -499,17 +516,20 @@ return function(s)
stretch = false,
visible = false,
screen = s,
placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(305), top = dpi(60) } }) end,
placement = function(c) awful.placement.align(c,
{ position = "top_right", margins = { right = dpi(305), top = dpi(60) } })
end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end
}
-- Get all source devices
local function get_source_devices()
awful.spawn.easy_async_with_shell(
[[ pactl list sinks | grep -E 'node.name|device.description|alsa.card_name' | awk '{gsub(/"/, ""); for(i = 1;i < NF;i++) printf $i " "; print $NF}' ]],
[[
pactl list sinks | grep -E 'node.name|device.description|alsa.card_name' | awk '{gsub(/"/, ""); for(i = 1;i < NF;i++) printf $i " "; print $NF}'
]],
function(stdout)
local device_list = {}
local was_alsa = false
@@ -543,8 +563,9 @@ return function(s)
-- Get all input devices
local function get_input_devices()
awful.spawn.easy_async_with_shell(
[[ pactl list sources | grep -E "node.name|device.description|alsa.card_name" | awk '{gsub(/"/, ""); for(i = 1;i < NF;i++) printf $i " "; print $NF}' ]],
[[
pactl list sources | grep -E "node.name|device.description|alsa.card_name" | awk '{gsub(/"/, ""); for(i = 1;i < NF;i++) printf $i " "; print $NF}'
]],
function(stdout)
local device_list = {}
local was_alsa = false
@@ -603,9 +624,11 @@ return function(s)
local volume = stdout:gsub("%%", ""):gsub("\n", "")
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(volume))
if volume > 0 then
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone.svg", color["LightBlue200"]))
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir
.. "microphone.svg", color["LightBlue200"]))
else
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir
.. "microphone-off.svg", color["LightBlue200"]))
end
end
)
@@ -620,7 +643,8 @@ return function(s)
function(stdout)
if stdout:match("yes") then
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(0))
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir
.. "microphone-off.svg", color["LightBlue200"]))
else
get_mic_volume()
end
@@ -654,10 +678,10 @@ return function(s)
-- Grabs all keys and hides popup when anything is pressed
-- TODO: Make it possible to navigate and select using the kb
local volume_controller_keygrabber = awful.keygrabber {
awful.keygrabber {
autostart = false,
stop_event = 'release',
keypressed_callback = function(self, mod, key, command)
keypressed_callback = function()
awesome.emit_signal("volume_controller::toggle", s)
mousegrabber.stop()
end
@@ -669,18 +693,6 @@ return function(s)
layout = wibox.layout.fixed.horizontal
}
--[[ awesome.connect_signal(
"volume_controller::toggle:keygrabber",
function()
if awful.keygrabber.is_running then
volume_controller_keygrabber:stop()
else
volume_controller_keygrabber:start()
end
end
) ]]
-- Set the volume and icon
awesome.connect_signal(
"get::volume",
@@ -698,8 +710,10 @@ return function(s)
icon = icon .. "-high"
end
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.slider_margin.slider:set_value(volume)
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Purple200"]))
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.slider_margin.slider:
set_value(volume)
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color.
recolor_image(icon .. ".svg", color["Purple200"]))
end
)
@@ -708,7 +722,8 @@ return function(s)
"get::volume_mute",
function(mute)
if mute then
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "volume-mute.svg", color["Purple200"]))
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.
color.recolor_image(icondir .. "volume-mute.svg", color["Purple200"]))
end
end
)
@@ -718,10 +733,12 @@ return function(s)
"get::mic_volume",
function(volume)
if volume > 0 then
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "microphone.svg", color["LightBlue200"]))
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir
.. "microphone.svg", color["LightBlue200"]))
awesome.emit_signal("update::microphone_widget", tonumber(volume), icondir .. "microphone.svg")
else
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir
.. "microphone-off.svg", color["LightBlue200"]))
awesome.emit_signal("update::microphone_widget", tonumber(volume), icondir .. "microphone-off.svg")
end
end

View File

@@ -18,107 +18,74 @@ return function(s)
local volume_osd_widget = wibox.widget {
{
{
{
{
nil,
{
nil,
{
{ -- Volume Icon
image = gears.color.recolor_image(icondir .. "volume-high.svg", Theme_config.volume_osd.icon_color),
valign = "center",
halign = "center",
resize = false,
id = "icon",
forced_height = dpi(220),
image = icondir .. "volume-high.svg",
widget = wibox.widget.imagebox
},
nil,
expand = "none",
id = "icon_margin2",
layout = wibox.layout.align.vertical
},
nil,
id = "icon_margin1",
expand = "none",
layout = wibox.layout.align.horizontal
},
{ -- Volume Bar
{
{
id = "label",
text = "Volume",
align = "left",
id = "progressbar1",
color = Theme_config.volume_osd.bar_bg_active,
background_color = Theme_config.volume_osd.bar_bg,
max_value = 100,
value = 50,
forced_height = dpi(6),
shape = function(cr, width, heigth)
gears.shape.rounded_bar(cr, width, heigth, dpi(6))
end,
widget = wibox.widget.progressbar
},
id = "progressbar_container2",
halign = "center",
valign = "center",
widget = wibox.widget.textbox
},
nil,
{
id = "value",
text = "0%",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "label_value_layout",
forced_height = dpi(48),
layout = wibox.layout.align.horizontal,
},
{
{
id = "volume_slider",
bar_shape = gears.shape.rounded_rect,
bar_height = dpi(10),
bar_color = color["Grey800"] .. "88",
bar_active_color = "#ffffff",
handle_color = "#ffffff",
handle_shape = gears.shape.circle,
handle_width = dpi(10),
handle_border_color = color["White"],
maximum = 100,
widget = wibox.widget.slider
},
id = "slider_layout",
forced_height = dpi(24),
widget = wibox.container.place
},
id = "icon_slider_layout",
spacing = dpi(0),
layout = wibox.layout.align.vertical
id = "progressbar_container",
width = dpi(240),
heigth = dpi(20),
stragety = "max",
widget = wibox.container.constraint
},
id = "osd_layout",
layout = wibox.layout.align.vertical
id = "layout1",
spacing = dpi(10),
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(24),
right = dpi(24),
id = "margin",
margins = dpi(10),
widget = wibox.container.margin
},
bg = color["Grey900"] .. '88',
widget = wibox.container.background,
ontop = true,
visible = true,
type = "notification",
forced_height = dpi(300),
forced_width = dpi(300),
offset = dpi(5),
forced_height = dpi(80),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
border_color = Theme_config.volume_osd.border_color,
border_width = Theme_config.volume_osd.border_width,
fg = Theme_config.volume_osd.fg,
bg = Theme_config.volume_osd.bg,
widget = wibox.container.background
}
local function update_osd()
local update_slider = function()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh mute",
function(stdout)
if stdout:match("yes") then
volume_osd_widget:get_children_by_id("icon")[1]
:set_image(gears.color.recolor_image(
icondir .. "volume-mute" .. ".svg", Theme_config.volume_osd.icon_color))
volume_osd_widget:get_children_by_id("progressbar1")[1].value = tonumber(0)
else
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh volume",
function(stdout)
local volume_level = stdout:gsub("\n", ""):gsub("%%", "")
awesome.emit_signal("widget::volume")
volume_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text(volume_level .. "%")
awesome.emit_signal(
"widget::volume:update",
volume_level
)
if awful.screen.focused().show_volume_osd then
awesome.emit_signal(
"module::volume_osd:show",
true
)
end
volume_level = tonumber(volume_level)
function(stdout2)
local volume_level = stdout2:gsub("%%", ""):gsub("\n", "")
volume_osd_widget:get_children_by_id("progressbar1")[1].value = tonumber(volume_level)
local icon = icondir .. "volume"
if volume_level < 1 then
icon = icon .. "-mute"
@@ -129,32 +96,8 @@ return function(s)
elseif volume_level >= 67 then
icon = icon .. "-high"
end
volume_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icon .. ".svg")
end
)
end
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:connect_signal(
"property::value",
function()
update_osd()
end
)
local update_slider = function()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh mute",
function(stdout)
if stdout:match("yes") then
volume_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text("0%")
volume_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icondir .. "volume-mute" .. ".svg")
else
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh volume",
function(stdout2)
stdout2 = stdout2:gsub("%%", ""):gsub("\n", "")
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(stdout2))
update_osd()
volume_osd_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icon .. ".svg",
Theme_config.volume_osd.icon_color))
end
)
end
@@ -162,33 +105,17 @@ return function(s)
)
end
-- Signals
awesome.connect_signal(
"module::slider:update",
function()
update_slider()
end
)
awesome.connect_signal(
"widget::volume:update",
function(value)
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(value))
end
)
update_slider()
local volume_container = awful.popup {
widget = wibox.container.background,
widget = {},
ontop = true,
bg = color["Grey900"] .. "00",
stretch = false,
visible = false,
screen = s,
placement = function(c) awful.placement.centered(c, { margins = { top = dpi(200) } }) end,
placement = function(c) awful.placement.bottom_left(c, { margins = dpi(20) }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 15)
gears.shape.rounded_rect(cr, width, height, dpi(14))
end
}
@@ -205,38 +132,16 @@ return function(s)
layout = wibox.layout.fixed.horizontal
}
awesome.connect_signal(
"module::volume_osd:show",
function()
if s == mouse.screen then
volume_container.visible = true
end
end
)
volume_container:connect_signal(
"mouse::enter",
function()
volume_container.visible = true
hide_volume_osd:stop()
end
)
volume_container:connect_signal(
"mouse::leave",
function()
volume_container.visible = true
hide_volume_osd:again()
end
)
awesome.connect_signal(
"widget::volume_osd:rerun",
function()
volume_container.visible = true
if hide_volume_osd.started then
hide_volume_osd:again()
update_slider()
else
hide_volume_osd:start()
update_slider()
end
end
)

View File

@@ -0,0 +1,153 @@
---------------------------------
-- This is the window_switcher --
---------------------------------
-- 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")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/window_switcher/"
return function(s)
local list_update = function(widget, buttons, label, _, objects)
widget:reset()
for _, object in ipairs(objects) do
local window_element = wibox.widget {
{
{
{ -- Icon
{
id = "icon",
image = object.icon,
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
width = dpi(100),
height = dpi(100),
id = "icon_const",
strategy = "exact",
widget = wibox.container.constraint
},
{
text = "Application",
id = "label",
valign = "center",
align = "center",
widget = wibox.widget.textbox
},
id = "layout1",
spacing = dpi(10),
layout = wibox.layout.fixed.vertical
},
id = "margin",
margins = dpi(20),
widget = wibox.container.margin
},
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
bg = Theme_config.window_switcher.element_bg,
fg = Theme_config.window_switcher.element_fg,
widget = wibox.container.background
}
local function create_buttons(buttons_t, object_t)
if buttons_t then
local btns = {}
for _, b in ipairs(buttons_t) do
local btn = awful.button {
modifiers = b.modifiers,
button = b.button,
on_press = function()
b:emit_signal('press', object_t)
end,
on_release = function()
b:emit_signal('release', object_t)
end
}
btns[#btns + 1] = btn
end
return btns
end
end
window_element:buttons(create_buttons(buttons, object))
local text, _ = label(object, window_element.margin.layout1.label)
if object == client.focus then
if text == nil or text == "" then
window_element:get_children_by_id("label")[1].text = "Application"
else
local text_full = text:match(">(.-)<")
if text_full then
if object.class == nil then
text = object.name
else
text = object.class:sub(1, 20)
end
end
window_element:get_children_by_id("label")[1].text = text
end
else
end
window_element:get_children_by_id("icon")[1]:set_image(xdg_icon_lookup:find_icon(object.class, 64))
widget:add(window_element)
widget:set_spacing(dpi(6))
end
return widget
end
local window_switcher = awful.widget.tasklist(
s,
awful.widget.tasklist.filter.allscreen,
awful.util.table.join(
awful.button(
{},
1,
function(c)
if c == client.focus then
c.minimized = true
else
c.minimized = false
if not c:isvisible() and c.first_tag then
c.first_tag:view_only()
end
c:emit_signal('request::activate')
c:raise()
end
end
)
),
{},
list_update,
wibox.layout.fixed.horizontal()
)
local window_switcher_container = awful.popup {
ontop = true,
visible = false,
screen = s,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
widget = { window_switcher },
placement = awful.placement.centered,
bg = Theme_config.window_switcher.bg,
border_color = Theme_config.window_switcher.border_color,
border_width = Theme_config.window_switcher.border_width
}
window_switcher_container:setup {
layout = wibox.layout.fixed.vertical
}
end

View File

@@ -1,23 +0,0 @@
#!/bin/bash
DEVICES=$(bluetoothctl paired-devices | cut -f2 -d' '|
while read -r uuid
do
info=`bluetoothctl info $uuid`
if echo "$info" | grep -q "Connected: yes"; then
echo "$info" | head -n 1 | grep "Device" | awk '{print $2}'
fi
done)
NAMES=$(bluetoothctl paired-devices | cut -f2 -d' '|
while read -r uuid
do
info=`bluetoothctl info $uuid`
if echo "$info" | grep -q "Connected: yes"; then
echo "$info" | grep "Name" | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}'
fi
done)
for device in $DEVICES; do
STRING=$(bluetoothctl info $device | grep 'Battery Percentage:' | awk '{print "\n Battery: " $4 "%"}')
echo " $(bluetoothctl info ${device} | grep Name: | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}') ${STRING}"
done

View File

@@ -3,7 +3,7 @@
-----------------------------------------------------
return {
['White'] = '#ffffffdd',
['White'] = '#ffffff',
['Black'] = '#000000',
['Grey50'] = '#fafafa',

View File

@@ -9,17 +9,56 @@
local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
local color = require("src.theme.colors")
local dpi = require("beautiful.xresources").apply_dpi
Theme_path = awful.util.getdir("config") .. "/src/theme/"
Theme = {}
dofile(Theme_path .. "theme_variables.lua")
--dofile(Theme_path .. "theme_config.lua")
-- Default font, change it in user_config, not here.
Theme.font = User_config.font.bold
--#region Client variables
Theme.useless_gap = dpi(5)
Theme.border_width = dpi(0)
Theme.border_normal = color["Grey800"]
Theme.border_marked = color["Red200"]
--#endregion
--#region Tooltip variables
Theme.tooltip_border_color = color["Grey800"]
Theme.tooltip_bg = color["Grey900"]
Theme.tooltip_fg = color["CyanA200"]
Theme.tooltip_border_width = dpi(4)
Theme.tooltip_gaps = dpi(15)
Theme.tooltip_shape = function(cr, width, heigth)
gears.shape.rounded_rect(cr, width, heigth, dpi(4))
end
--#endregion
--#region Hotkeys variables
Theme.hotkeys_bg = color["Grey900"]
Theme.hotkeys_fg = color["White"]
Theme.hotkeys_border_width = dpi(4)
Theme.hotkeys_border_color = color["Grey800"]
Theme.hotkeys_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end
Theme.hotkeys_modifiers_fg = color["Cyan200"]
Theme.hotkeys_description_font = User_config.font.bold
Theme.hotkeys_font = User_config.font.bold
Theme.hotkeys_group_margin = dpi(20)
Theme.hotkeys_label_bg = color["Cyan200"]
Theme.hotkeys_label_fg = color["Grey900"]
--#endregion
Theme.awesome_icon = Theme_path .. "../assets/icons/ArchLogo.png"
Theme.awesome_subicon = Theme_path .. "../assets/icons/ArchLogo.png"
-- Wallpaper
beautiful.wallpaper = user_vars.wallpaper
beautiful.wallpaper = User_config.wallpaper
screen.connect_signal(
'request::wallpaper',
function(s)

View File

@@ -0,0 +1,263 @@
-- Awesome Libs
local color = require("src.theme.colors")
local dpi = require("beautiful.xresources").apply_dpi
local gears = require("gears")
Theme_config = {}
--[[
=======================
=== Widget Settings ===
=======================
Every widget can be customized with a custom color.
You can change the color and other theme related settings here.
For functional changes visit the user_config.lua
]] --
--#region Widget Settings
Theme_config.audio = {
bg = color["Yellow200"],
fg = color["Grey900"],
}
Theme_config.battery = {
bg = color["Purple200"],
fg = color["Grey900"],
}
Theme_config.bluetooth = {
bg = color["Blue200"],
fg = color["Grey900"],
}
Theme_config.clock = {
bg = color["Orange200"],
fg = color["Grey900"],
}
Theme_config.cpu_freq = {
bg = color["Blue200"],
fg = color["Grey900"],
}
Theme_config.cpu_temp = {
fg = color["Grey900"],
}
Theme_config.cpu_usage = {
bg = color["Blue200"],
fg = color["Grey900"],
}
Theme_config.date = {
bg = color["Teal200"],
fg = color["Grey900"],
}
Theme_config.gpu_usage = {
bg = color["Green200"],
fg = color["Grey900"],
}
Theme_config.gpu_temp = {
fg = color["Grey900"],
}
Theme_config.kblayout = {
bg = color["Green200"],
fg = color["Grey900"],
bg_container = color["Grey900"],
border_color_container = color["Grey800"],
item = {
bg = color["Grey800"],
fg_long = color["Red200"],
fg_short = color["Purple200"],
bg_selected = color["DeepPurple200"],
fg_selected = color["Grey900"],
}
}
Theme_config.layout_list = {
bg = color["LightBlue200"],
fg = color["Grey900"],
}
Theme_config.network = {
bg = color["Red200"],
fg = color["Grey900"],
notify_icon_color = color["White"]
}
Theme_config.power_button = {
bg = color["Red200"],
fg = color["Grey900"],
}
Theme_config.ram_info = {
bg = color["Red200"],
fg = color["Grey900"],
}
Theme_config.systray = {
bg = "#3A475C",
}
Theme_config.taglist = {
bg = "#3A475C",
fg = color["White"],
bg_urgent = color["RedA200"],
fg_urgent = color["Grey900"],
bg_focus = color["White"],
bg_focus_pressed = "#dddddd",
bg_focus_hover = color["White"],
fg_focus = color["Grey900"],
}
Theme_config.tasklist = {
bg = "#3A475C",
fg = color["White"],
bg_urgent = color["RedA200"],
fg_urgent = color["Grey900"],
bg_focus = color["White"],
bg_focus_pressed = "#dddddd",
bg_focus_hover = color["White"],
fg_focus = color["Grey900"],
}
--#endregion
--[[
=======================
=== Module Settings ===
=======================
Here you can customize the modules.
For functional changes visit the user_config.lua
]] --
Theme_config.notification_center = {
bg = color["Grey900"],
-- Clear all button
clear_all_button = {
bg = color["Blue200"],
fg = color["Grey900"],
},
-- DnD button
dnd = {
},
-- Notification_list
notification_list = {
},
-- Profile widget
profile = {
},
-- Song info widget
song_info = {
},
-- Spacing line widget
spacing_line = {
},
-- Status bar widgets
status_bar = {
},
-- Time Date widget
time_date = {
},
-- Weather widget
weather = {
},
}
Theme_config.bluetooth_controller = {
icon_color = color["Purple200"],
icon_color_dark = color["Grey900"],
con_button_color = color["Blue200"],
device_bg = color["Grey900"],
device_bg_hover = "#313131",
device_fg_hover = color["LightBlue100"],
device_fg = color["LightBlue200"],
device_border_color = color["Grey800"],
device_border_width = dpi(2),
con_device_border_color = color["Grey800"],
con_device_border_width = dpi(2),
connected_bg = color["Grey800"],
connected_fg = color["Purple200"],
connected_icon_color = color["Purple200"],
discovered_icon_color = color["LightBlue200"],
discovered_bg = color["Grey800"],
discovered_fg = color["LightBlue200"],
container_border_color = color["Grey800"],
container_border_width = dpi(4),
container_bg = color["Grey900"],
}
Theme_config.brightness_osd = {
bg = color["Grey900"],
fg = color["Blue200"],
border_color = color["Grey800"],
border_width = dpi(4),
bar_bg_active = color["Blue200"],
bar_bg = color["Grey800"],
icon_color = color["Blue200"],
}
Theme_config.powermenu = {
container_bg = "#21212188",
button_fg = color["Grey900"],
shutdown_button_bg = color["Blue200"],
reboot_button_bg = color["Red200"],
suspend_button_bg = color["Yellow200"],
lock_button_bg = color["Green200"],
logout_button_bg = color["Orange200"],
}
Theme_config.titlebar = {
bg = "#121212AA",
close_button_bg = color["Red200"],
close_button_fg = color["Grey900"],
minimize_button_bg = color["Yellow200"],
minimize_button_fg = color["Grey900"],
maximize_button_bg = color["Green200"],
maximize_button_fg = color["Grey900"],
}
Theme_config.volume_controller = {
}
Theme_config.volume_osd = {
bg = color["Grey900"],
fg = color["Purple200"],
border_color = color["Grey800"],
border_width = dpi(4),
bar_bg_active = color["Purple200"],
bar_bg = color["Grey800"],
icon_color = color["Purple200"],
}
Theme_config.window_switcher = {
element_bg = color["Grey800"],
element_fg = color["CyanA200"],
border_color = color["Grey800"],
border_width = dpi(4),
bg = color["Grey900"],
}

View File

@@ -1,91 +0,0 @@
------------------------------------------------------------------------------------------
-- This is the main themeing file, here are most colors changed --
-- If you want to change individual widget colors you will need to edit them seperately --
------------------------------------------------------------------------------------------
-- Awesome Libs
local color = require("src.theme.colors")
local dpi = require("beautiful.xresources").apply_dpi
local gears = require("gears")
local awful = require("awful")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/titlebar/"
Theme.font = user_vars.font.bold
Theme.bg_normal = color["Grey900"]
Theme.bg_focus = color["Grey900"]
Theme.bg_urgent = color["RedA200"]
Theme.bg_minimize = color["White"]
Theme.bg_systray = color["White"]
Theme.fg_normal = color["White"]
Theme.fg_focus = color["White"]
Theme.fg_urgent = color["White"]
Theme.fg_minimize = color["White"]
Theme.useless_gap = dpi(5) -- Change this to 0 if you dont like window gaps
Theme.border_width = dpi(0) -- Change this to 0 if you dont like borders
Theme.border_normal = color["Grey800"]
--Theme.border_focus = color["Red"] -- Doesnt work, no idea why; workaround is in signals.lua
Theme.border_marked = color["Red400"]
--Theme.menu_submenu_icon = Theme_path .. "assets.ArchLogo.png"
Theme.menu_height = dpi(40)
Theme.menu_width = dpi(200)
Theme.menu_bg_normal = color["Grey900"]
Theme.menu_bg_focus = color["Grey800"]
Theme.menu_fg_focus = color["White"]
Theme.menu_border_color = color["Grey800"]
Theme.menu_border_width = dpi(0)
Theme.menu_shape = function(cr, width, heigth)
gears.shape.rounded_rect(cr, width, heigth, 5)
end
Theme.taglist_fg_focus = color["Grey900"]
Theme.taglist_bg_focus = color["White"]
Theme.tooltip_border_color = color["Grey800"]
Theme.tooltip_bg = color["Grey900"]
Theme.tooltip_fg = color["YellowA200"]
Theme.tooltip_border_width = dpi(4)
Theme.tooltip_gaps = dpi(15)
Theme.tooltip_shape = function(cr, width, heigth)
gears.shape.rounded_rect(cr, width, heigth, 5)
end
Theme.notification_spacing = dpi(20)
Theme.titlebar_close_button_normal = icondir .. "close.svg"
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
Theme.titlebar_minimize_button_normal = icondir .. "minimize.svg"
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
Theme.bg_systray = color["BlueGrey800"]
Theme.systray_icon_spacing = dpi(10)
Theme.hotkeys_bg = color["Grey900"]
Theme.hotkeys_fg = color["White"]
Theme.hotkeys_border_width = 0
Theme.hotkeys_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end
Theme.hotkeys_description_font = user_vars.font.bold
-- Icon directory path
local layout_path = Theme_path .. "../assets/layout/"
-- Here are the icons for the layouts defined, if you want to add more layouts go to main/layouts.lua
Theme.layout_floating = layout_path .. "floating.svg"
Theme.layout_tile = layout_path .. "tile.svg"
Theme.layout_dwindle = layout_path .. "dwindle.svg"
Theme.layout_fairh = layout_path .. "fairh.svg"
Theme.layout_fairv = layout_path .. "fairv.svg"
Theme.layout_fullscreen = layout_path .. "fullscreen.svg"
Theme.layout_max = layout_path .. "max.svg"
Theme.layout_cornerne = layout_path .. "cornerne.svg"
Theme.layout_cornernw = layout_path .. "cornernw.svg"
Theme.layout_cornerse = layout_path .. "cornerse.svg"
Theme.layout_cornersw = layout_path .. "cornersw.svg"

View File

@@ -0,0 +1,329 @@
-------------------------------------------
-- Uservariables are stored in this file --
-------------------------------------------
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local home = os.getenv("HOME")
-- If you want different default programs, wallpaper path or modkey; edit this file.
User_config = {
--[[
Autostart programms, shell commands etc.
Wrap shell commands into `bash -c ''`
Example:
Firefox: "firefox"
Custom Script: "bash -c 'myscript'"
Flatpak application: flatpak run com.example.App
]] --
autostart = {
"picom --experimental-backends",
"xfce4-power-manager",
"light-locker --lock-on-suspend --lock-on-lid &",
"flatpak run com.spotify.Client",
"discord",
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1",
"setxkbmap -option caps:swapescape",
"whatsdesk"
},
--[[
The battery that should be displayed in the battery widget.
This can allow you to for example display your phone's battery
You can choose from one of these values (default is internal battery):
"UNKNOWN"
"LINE_POWER"
"TABLET"
"COMPUTER"
"GAMING_INPUT"
"LAST"
"BATTERY"
"UPS"
"MONITOR"
"MOUSE"
"KEYBOARD"
"PDA"
"PHONE"
"MEDIA_PLAYER"
More information at: https://lazka.github.io/pgi-docs/UPowerGlib-1.0/enums.html#UPowerGlib.DeviceKind.KEYBOARD
]] --
battery_kind = "LINE_POWER",
--[[
If your battery is not found you can specify its path here.
If you don't specify a path, then UPower will use the first it can find.
Example:
battery_path = "/org/freedesktop/UPower/devices/battery_BAT0"
]] --
battery_path = nil,
--[[
DnD or 'Do not Disturb' will prevent notifications from poping up.
This is just a default value, you can toggle it in the notification-center, but it won't be saved.
]] --
dnd = false,
--[[
Dock program size in dpi.
Example:
dock_size = dpi(50)
]] --
dock_icon_size = dpi(50),
--[[
Add your programs to the dock. You need to provide the name of the .desktop file
You can find those in the /usr/share/applications or $HOME/.local/share/applications directory.
Some .desktop files are more hidden, for more information look at: $XDG_DATA_DIRS/applications
Example:
"com.alacritty.Alacritty.desktop",
"com.spotify.Client.desktop",
"firefox.desktop",
]] --
dock_programs = {
"com.alacritty.Alacritty.desktop",
"firefox.desktop",
"steam.desktop",
"discord.desktop",
"com.spotify.Client.desktop",
"code.desktop",
"arduino-arduinoide.desktop",
"us.zoom.Zoom.desktop",
"thunderbird.desktop",
"com.mattermost.Desktop.desktop",
"blender.desktop",
"freecad.desktop",
"The Witcher 3 Wild Hunt.desktop",
"windows_11.desktop"
},
--[[
This is the program that will be started when clicking on the battery widget
If you don't want any just leave it as nil
]] --
energy_manager = "xfce4-power-manager-settings",
--[[
Your filemanager. Will be opened with <super> + <e>
]] --
file_manager = "thunar",
--[[
The font that will be used on all widgets/modules etc.
First is the regular font, second is the bold font and third the extra bold font.
Specify is used when I needed a custom font size/weight.
Example:
font = {
regular = "JetBrainsMono Nerd Font, 14",
bold = "JetBrainsMono Nerd Font, bold 14",
extrabold = "JetBrainsMono Nerd Font, ExtraBold 14",
specify = "JetBrainsMono Nerd Font"
}
]] font = {
regular = "JetBrainsMono Nerd Font, 14",
bold = "JetBrainsMono Nerd Font, bold 14",
extrabold = "JetBrainsMono Nerd Font, ExtraBold 14",
specify = "JetBrainsMono Nerd Font"
},
--[[
The icon theme name must be exactly as the folder is called
The folder can be in any $XDG_DATA_DIRS/icons/[icon_theme_name]
]] --
icon_theme = "Papirus-Dark",
-- List every Keyboard layout you use here comma seperated. (run localectl list-keymaps to list all averiable keymaps)
--[[
Keyboard layouts for the keyboard widget.
Specify every layout you want to use or leave it as is.
Example:
kblayout = { "de", "ru", "us" }
]] --
kblayout = { "de", "ru" },
--[[
This is a list of every layout you can use.
Remove every that you don't want to use.
]] --
layouts = {
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.floating,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.corner.nw,
awful.layout.suit.corner.ne,
awful.layout.suit.corner.sw,
awful.layout.suit.corner.se,
awful.layout.suit.magnifier,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.spiral.dwindle,
},
--[[
The modkey is <Super>(<Meta> or <Windows Key>) default
Run xmodmap -pm to see a list of all possible keys.
Example:
"mod1" <-- Is Alt_L
"mod2" <-- is Numlock
"mod3" <-- Nothing on my system
"mod4" <-- for the super/windows key
"mod5" <-- for the shift key
]] --
modkey = "Mod4",
--[[
This is the naming sheme used for the powermenu and maybe some other places in the future.
Example:
"userhost" <-- Will display "username@hostname"
"fullname" <-- Will display "Firstname Surname"
"?" <-- Will display "?"
]] --
namestyle = "userhost",
--[[
This is used to identify your network adapters.
Use this command `ip a` to get your lan or wlan name.
Example:
wlan = "wlo1",
ethernet = "eno1"
]] --
network = {
wlan = "wlo1",
ethernet = "eno1"
},
--[[
This is the program that will be executed when hitting the print key.
]] --
screenshot_program = "flameshot gui",
--[[
These are the status bar widgets which are to be found in the notification-center.
You can add or remove them to your linking, here is a full list:
"cpu_usage"
"cpu_temp"
"ram_usage"
"microphone"
"volume"
"gpu_temp"
"gpu_usage"
"battery"
"backlight"
]] --
status_bar_widgets = {
"cpu_usage",
"cpu_temp",
"ram_usage",
"microphone",
"volume",
"gpu_temp",
"gpu_usage"
},
--[[
This is the default terminal, Alacritty is the default.
]] --
terminal = "alacritty",
--[[
Add every client that should get no titlebar.
Use xprop WM_ClASS to get the class of the window.
!Always use the right(second) string!
Example:
titlebar_exception = {
"firefox",
"discord",
"Spotify"
}
]] --
titlebar_exception = {},
--[[
This is the path to your wallpaper.
home is $HOME, you can also use an absolute path.
]] --
wallpaper = home .. "/.config/awesome/src/assets/fuji.jpg",
--[[
This is the weather widget.
You can use the openweather api to get your city ID. https://home.openweathermap.org/api_keys
Example:
weather_api_key = "your_api_key",
weather_city_id = "your_city_id",
unit = "metric" or "imperial"
]] weather_secrets = {
key = "e71b00168ca7219563dde4514a425b14",
city_id = "2864118",
unit = "metric"
},
--[[
You can configure your bar's here, if you leave it empty the bar will not be shown.
If you have multiple monitors you can add [N] where N is to the table below to get a per screen configuration.
Here is a full list of every widget you can use:
Widgets:
"Audio" <-- Displays the volume and can show the Audio Menu
"Battery" <-- Displays the battery percentage
"Bluetooth" <-- Displays the bluetooth status and can open the Bluetooth Menu
"Clock" <-- Displays a clock
"Cpu Frequency" <-- Shows the CPU Frequency in MHz
"Cpu Temperature" <-- Shows the CPU Temperature in Celsius
"Cpu Usage" <-- Shows the CPU Usage in %
"Date" <-- Displays the current date
"Gpu Temperature" <-- Shows the GPU Temperature in Celsius
"Gpu Usage" <-- Shows the GPU Usage in %
"Keyboard Layout" <-- Shows the current keyboard layout and can open the Keyboard Menu
"Tiling Layout" <-- Shows the current tiling layout
"Network" <-- Shows the current network connection and strength and can open the Network Menu
"Power Button" <-- Opens the Session menu
"Ram Usage" <-- Shows the RAM Usage in x/y GB
"Systray" <-- Shows the systray
"Taglist" <-- Shows all tags per screen and their open programs
"Tasklist" <-- Shows all programs per tag
!The order goes from left to right!
]]
widgets = {
[1] = {
left_bar = {
"Tiling Layout",
"Systray",
"Taglist"
},
center_bar = {
"Tasklist"
},
right_bar = {
"Gpu Usage",
"Gpu Temperature",
"Cpu Usage",
"Cpu Temperature",
"Audio",
"Keyboard Layout",
"Date",
"Clock",
"Power Button"
}
},
[2] = {
left_bar = {
"Tiling Layout",
"Taglist"
},
center_bar = {
"Tasklist"
},
right_bar = {
"Ram Usage",
"Audio",
"Keyboard Layout",
"Network",
"Date",
"Clock",
"Power Button"
}
}
}
}

View File

@@ -1,138 +0,0 @@
-------------------------------------------
-- Uservariables are stored in this file --
-------------------------------------------
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local home = os.getenv("HOME")
-- If you want different default programs, wallpaper path or modkey; edit this file.
user_vars = {
-- The battery that should be displayed in the battery widget.
--[[
You can choose from one of these values (default is internal battery):
"UNKNOWN"
"LINE_POWER"
"TABLET"
"COMPUTER"
"GAMING_INPUT"
"LAST"
"BATTERY"
"UPS"
"MONITOR"
"MOUSE"
"KEYBOARD"
"PDA"
"PHONE"
"MEDIA_PLAYER"
More information at: https://lazka.github.io/pgi-docs/UPowerGlib-1.0/enums.html#UPowerGlib.DeviceKind.KEYBOARD
]]
battery_kind = "BATTERY",
-- Here you can specify a battery to use. e.g. "/org/freedesktop/UPower/devices/battery_BAT0"
-- Default is nil (use the internal battery)
battery_path = nil,
-- This is opened when clicked on the battery icon, set it to whatever you like
energy_manager = "xfce4-power-manager-settings",
-- Uses the openweather api https://home.openweathermap.org/api_keys
-- City ID is also from there
weather_secrets = {
key = "",
city_id = "",
unit = "metric" -- "metric" or "imperial"
},
-- Do not Disturb will turn off all notifications but keep the notification-list in the notification-center
dnd = false,
-- Autotiling layouts
layouts = {
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.floating,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.corner.nw,
awful.layout.suit.corner.ne,
awful.layout.suit.corner.sw,
awful.layout.suit.corner.se,
awful.layout.suit.magnifier,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.spiral.dwindle,
},
-- Icon theme from /usr/share/icons
icon_theme = "Papirus-Dark",
-- Write the terminal command to start anything here
autostart = {
"",
},
-- Type 'ip a' and check your wlan and ethernet name
network = {
wlan = "wlo1",
ethernet = "eno1"
},
-- Set your font with this format:
font = {
regular = "JetBrainsMono Nerd Font, 14",
bold = "JetBrainsMono Nerd Font, bold 14",
extrabold = "JetBrainsMono Nerd Font, ExtraBold 14",
specify = "JetBrainsMono Nerd Font"
},
-- This is your default Terminal
terminal = "alacritty",
-- This is the modkey 'mod4' = Super/Mod/WindowsKey, 'mod3' = alt...
modkey = "Mod4",
-- place your wallpaper at this path with this name, you could also try to change the path
wallpaper = home .. "/.config/awesome/src/assets/fuji.jpg",
-- Naming scheme for the powermenu, userhost = "user@hostname", fullname = "Firstname Surname", something else ...
namestyle = "userhost",
-- List every Keyboard layout you use here comma seperated. (run localectl list-keymaps to list all averiable keymaps)
kblayout = { "de", "ru" },
-- Your filemanager that opens with super+e
file_manager = "thunar",
-- Screenshot program to make a screenshot when print is hit
screenshot_program = "flameshot gui",
-- If you use the dock here is how you control its size
dock_icon_size = dpi(50),
-- Add your programs exactly like in this example.
-- First entry has to be how you would start the program in the terminal (just try it if you dont know yahoo it)
-- Second can be what ever the fuck you want it to be (will be the displayed name if you hover over it)
-- For steam games please use this format (look in .local/share/applications for the .desktop file, that will contain the number you need)
-- {"394360", "Name", true} true will tell the func that it's a steam game
-- Use xprop | grep WM_CLASS and use the *SECOND* string
-- { WM_CLASS, program, name, user_icon, isSteam }
dock_programs = {
{ "Alacritty", "alacritty", "Alacritty" },
{ "firefox", "firefox", "Firefox" },
{ "discord", "discord", "Discord" },
{ "Spotify", "flatpak run com.spotify.Client", "Spotify" },
{ "Code", "code", "Visual Studio Code" },
{ "processing-app-Base", "arduino", "Arduino IDE" },
{ "Zoom", "flatpak run us.zoom.Zoom", "Zoom" },
{ "Thunderbird", "thunderbird", "Thunderbird" },
{ "Mattermost", "mattermost-desktop", "Mattermost" },
{ "Blender", "blender", "Blender" },
{ "Steam", "steam", "Steam" },
{ "FreeCAD", "freecad", "FreeCAD" },
{ "Thunar", "thunar", "Dateien" },
{ "Windows", "virsh start Windows_11", "Windows 11", "/home/crylia/Bilder/windows.png", false, 50 }
}
}

View File

@@ -0,0 +1,74 @@
local gears = require("gears")
local GLib = require("lgi").GLib
---Will return every $XDG_DATA_DIRS
---@return table
local function get_paths()
local dirs = {}
local dir
for _, value in ipairs(GLib.get_system_data_dirs()) do
dir = GLib.build_filenamev({ value, "applications" })
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
end
dir = GLib.build_filenamev({ GLib.get_user_data_dir(), "applications" })
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
return dirs
end
---Returns every .desktop file into a table
---@param file table .desktop files
---@return table
return function(file)
if not file or file == "" then
return
end
local handler = nil
for _, dir in ipairs(get_paths()) do
handler = io.open(dir .. "/" .. file, "r")
if handler then
break
end
end
if not handler then
return
end
local desktop_table = {}
while true do
local line = handler:read()
if not line then
break
end
if line:match("[Desktop Entry]") then
while true do
local property = handler:read()
if not property then
break
end
if property:match("^%[(.+)%]") then
return desktop_table
end
if property:match("^Name=") then
desktop_table["Name"] = property:match("Name=(.+)")
elseif property:match("^Exec") then
-- Second match is to remove the %u and %F some applications use to open a URI. It's not needed here
desktop_table["Exec"] = property:match("Exec=(.+)"):gsub("%%u", ""):gsub("%%F", "")
elseif property:match("^Icon=") then
desktop_table["Icon"] = property:match("Icon=(.+)")
end
end
end
end
return desktop_table
end

View File

@@ -1,95 +0,0 @@
-----------------------------------------------------
-- Helper to get icons from a program/program name --
-----------------------------------------------------
local icon_cache = {}
-- tries to find a matching file name in /usr/share/icons/THEME/RESOLUTION/apps/ and if not found tried with first letter
-- as uppercase, this should get almost all icons to work with the papirus theme atleast
-- TODO: try with more icon themes
function Get_icon(theme, client, program_string, class_string, is_steam)
client = client or nil
program_string = program_string or nil
class_string = class_string or nil
is_steam = is_steam or nil
if theme and (client or program_string or class_string) then
local clientName
if is_steam then
clientName = "steam_icon_" .. tostring(client) .. ".svg"
elseif client then
if client.class then
clientName = string.lower(client.class:gsub(" ", "")) .. ".svg"
elseif client.name then
clientName = string.lower(client.name:gsub(" ", "")) .. ".svg"
else
if client.icon then
return client.icon
else
return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
end
end
else
if program_string then
clientName = program_string .. ".svg"
else
clientName = class_string .. ".svg"
end
end
for _, icon in ipairs(icon_cache) do
if icon:match(clientName) then
return icon
end
end
local resolutions = { "128x128", "96x96", "64x64", "48x48", "42x42", "32x32", "24x24", "16x16" }
for _, res in ipairs(resolutions) do
local iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
local ioStream = io.open(iconDir .. clientName, "r")
if ioStream ~= nil then
icon_cache[#icon_cache + 1] = iconDir .. clientName
return iconDir .. clientName
else
clientName = clientName:gsub("^%l", string.upper)
iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
ioStream = io.open(iconDir .. clientName, "r")
if ioStream ~= nil then
icon_cache[#icon_cache + 1] = iconDir .. clientName
return iconDir .. clientName
elseif not class_string then
return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
else
clientName = class_string .. ".svg"
iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
ioStream = io.open(iconDir .. clientName, "r")
if ioStream ~= nil then
icon_cache[#icon_cache + 1] = iconDir .. clientName
return iconDir .. clientName
else
return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
end
end
end
end
if client then
return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
end
end
end
--———————————No swiches?———————————
--⠀⣞⢽⢪⢣⢣⢣⢫⡺⡵⣝⡮⣗⢷⢽⢽⢽⣮⡷⡽⣜⣜⢮⢺⣜⢷⢽⢝⡽⣝
--⠸⡸⠜⠕⠕⠁⢁⢇⢏⢽⢺⣪⡳⡝⣎⣏⢯⢞⡿⣟⣷⣳⢯⡷⣽⢽⢯⣳⣫⠇
--⠀⠀⢀⢀⢄⢬⢪⡪⡎⣆⡈⠚⠜⠕⠇⠗⠝⢕⢯⢫⣞⣯⣿⣻⡽⣏⢗⣗⠏⠀
--⠀⠪⡪⡪⣪⢪⢺⢸⢢⢓⢆⢤⢀⠀⠀⠀⠀⠈⢊⢞⡾⣿⡯⣏⢮⠷⠁⠀⠀
--⠀⠀⠀⠈⠊⠆⡃⠕⢕⢇⢇⢇⢇⢇⢏⢎⢎⢆⢄⠀⢑⣽⣿⢝⠲⠉⠀⠀⠀⠀
--⠀⠀⠀⠀⠀⡿⠂⠠⠀⡇⢇⠕⢈⣀⠀⠁⠡⠣⡣⡫⣂⣿⠯⢪⠰⠂⠀⠀⠀⠀
--⠀⠀⠀⠀⡦⡙⡂⢀⢤⢣⠣⡈⣾⡃⠠⠄⠀⡄⢱⣌⣶⢏⢊⠂⠀⠀⠀⠀⠀⠀
--⠀⠀⠀⠀⢝⡲⣜⡮⡏⢎⢌⢂⠙⠢⠐⢀⢘⢵⣽⣿⡿⠁⠁⠀⠀⠀⠀⠀⠀⠀
--⠀⠀⠀⠀⠨⣺⡺⡕⡕⡱⡑⡆⡕⡅⡕⡜⡼⢽⡻⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
--⠀⠀⠀⠀⣼⣳⣫⣾⣵⣗⡵⡱⡡⢣⢑⢕⢜⢕⡝⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
--⠀⠀⠀⣴⣿⣾⣿⣿⣿⡿⡽⡑⢌⠪⡢⡣⣣⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
--⠀⠀⠀⡟⡾⣿⢿⢿⢵⣽⣾⣼⣘⢸⢸⣞⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
--⠀⠀⠀⠀⠁⠇⠡⠩⡫⢿⣝⡻⡮⣒⢽⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
--—————————————————————————————

View File

@@ -0,0 +1,106 @@
local theme_index = { mt = {} }
theme_index.new = function(cls, theme, basedirs)
local self = {}
setmetatable(self, { __index = cls })
self.icon_theme_name = theme or User_config.icon_theme
self.base_dir = nil
self["Directories"] = {}
self["Inherits"] = {}
self.per_directory_keys = {}
local basedir, handler = nil, nil
for _, dir in ipairs(basedirs) do
basedir = dir .. "/" .. self.icon_theme_name
handler = io.open(basedir .. "/index.theme", "r")
if handler then
break
end
end
if not handler then
return self
end
self.base_dir = basedir
while true do
local line = handler:read()
if not line then
break
end
local header = line:match("^%[(.+)%]$")
if header then
if header == "Icon Theme" then
while true do
local property = handler:read()
if not property then
break
end
if property:match("^%[(.+)%]$") then
handler:seek("cur", -string.len(property) - 1)
break
end
local key, value = property:match("^(%w+)=(.*)$")
if key == "Directories" or key == "Inherits" then
string.gsub(value, "([^,]+),?", function(match)
table.insert(self[key], match)
end)
end
end
else
local keys = {}
while true do
local property = handler:read()
if not property then
break
end
if property:match("^%[(.+)%]$") then
handler:seek("cur", -string.len(property) - 1)
break
end
local key, value = property:match("^(%w+)=(%w+)$")
if key == "Size" or key == "MinSize" or key == "MaxSize" or key == "Threshold" then
keys[key] = tonumber(value)
elseif key == "Type" then
keys[key] = value
end
end
if keys["Size"] then
if not keys["Type"] then keys["Type"] = "Threshold" end
if not keys["MinSize"] then keys["MinSize"] = keys["Size"] end
if not keys["MaxSize"] then keys["MaxSize"] = keys["Size"] end
if not keys["Threshold"] then keys["Threshold"] = 2 end
self.per_directory_keys[header] = keys
end
end
end
end
handler:close()
return self
end
theme_index.get_subdirectories = function(self)
return self["Directories"]
end
theme_index.get_inherits = function(self)
return self["Inherits"]
end
theme_index.mt.__call = function(cls, theme, basedirs)
return theme_index.new(cls, theme, basedirs)
end
return setmetatable(theme_index, theme_index.mt)

View File

@@ -0,0 +1,236 @@
-----------------------------------------------------
-- Helper to get icons from a program/program name --
-----------------------------------------------------
local gears = require("gears")
local GLib = require("lgi").GLib
local theme_index = require("src.tools.theme_index")
local function get_basedir()
local dirs = {}
local dir = GLib.build_filenamev({ GLib.get_home_dir(), ".icons" })
if gears.filesystem.dir_readable(dir) then
table.insert(dirs, dir)
end
dir = GLib.build_filenamev({ GLib.get_user_data_dir(), "icons" })
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
for _, value in ipairs(GLib.get_system_data_dirs()) do
dir = GLib.build_filenamev({ value, ".icons" })
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
end
local need_usr_share_pixmaps = true
for _, value in ipairs(GLib.get_system_data_dirs()) do
dir = GLib.build_filenamev({ value, ".icons" })
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
if dir == "/usr/share/pixmaps" then
need_usr_share_pixmaps = false
end
end
dir = "/usr/share/pixmaps"
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
if need_usr_share_pixmaps and gears.filesystem.dir_readable(dir) then
table.insert(dirs, dir)
end
table.insert(dirs, "/usr/share/icons")
return dirs
end
local xdg_icon_lookup = { mt = {} }
local icon_cache = {}
xdg_icon_lookup.new = function(theme, base_dirs)
local self = {}
self.icon_theme = theme or User_config.icon_theme
self.base_directories = base_dirs or get_basedir()
self.file_extension = { "svg", "png", "xpm" }
if not icon_cache[self.icon_theme] then
icon_cache[self.icon_theme] = {}
end
local cache_key = table.concat(self.base_directories, ":")
if not icon_cache[self.icon_theme][cache_key] then
icon_cache[self.icon_theme][cache_key] = theme_index(self.icon_theme, self.base_directories)
end
self.theme_index = icon_cache[self.icon_theme][cache_key]
return setmetatable(self, { __index = xdg_icon_lookup })
end
---Look for an fallback icon
---@param iconname any
---@return string
local function lookup_fallback_icon(self, iconname)
for _, dir in ipairs(self.base_directories) do
for _, ext in ipairs(self.file_extension) do
local filename = string.format("%s/%s.%s", dir, iconname, ext)
if gears.filesystem.file_readable(filename) then
return filename
end
end
end
end
---Checkes if the size equals the actual icon size
---@param subdir any
---@param iconsize any
---@return boolean
local function directory_matches_size(self, subdir, iconsize)
local type, size, min_size, max_size, threshold = self.theme_index.per_directory_keys[subdir]["Type"],
self.theme_index.per_directory_keys[subdir]["Size"], self.theme_index.per_directory_keys[subdir]["MinSize"],
self.theme_index.per_directory_keys[subdir]["MaxSize"], self.theme_index.per_directory_keys[subdir]["Threshold"]
if type == "Fixed" then
return iconsize == size
elseif type == "Scalable" then
return iconsize >= min_size and iconsize <= max_size
elseif type == "Threshold" then
return iconsize >= size - threshold and iconsize <= size + threshold
end
return false
end
---Returns how far off the size is from the actual icon size
---@param subdir table
---@param iconsize number
---@return number
local function directory_size_distance(self, subdir, iconsize)
local type, size, min_size, max_size, threshold = self.theme_index.per_directory_keys[subdir]["Type"],
self.theme_index.per_directory_keys[subdir]["Size"], self.theme_index.per_directory_keys[subdir]["MinSize"],
self.theme_index.per_directory_keys[subdir]["MaxSize"], self.theme_index.per_directory_keys[subdir]["Threshold"]
if type and min_size and max_size and threshold then
if type == "Fixed" then
return math.abs(size - iconsize)
elseif type == "Scalable" then
if iconsize < min_size then
return min_size - iconsize
elseif iconsize > max_size then
return iconsize - max_size
end
return 0
elseif type == "Threshold" then
if iconsize < size - threshold then
return min_size - iconsize
elseif iconsize > size + threshold then
return iconsize - max_size
end
return 0
end
end
return 0xffffffff
end
---Checks each and every sub directory for an icon
---@param iconname any
---@param size any
---@return string path_to_icon
local function lookup_icon(self, iconname, size)
local already_checked = {}
for _, subdir in ipairs(self.theme_index:get_subdirectories()) do
for _, dir in ipairs(self.base_directories) do
for _, ext in ipairs(self.file_extension) do
if directory_matches_size(self, subdir, size) then
local filename = string.format("%s/%s/%s/%s.%s", dir, self.icon_theme, subdir, iconname, ext)
if gears.filesystem.file_readable(filename) then
return filename
else
already_checked[filename] = true
end
end
end
end
end
local min_size = 0xffffffff
local closest_filename = nil
for _, subdir in ipairs(self.theme_index:get_subdirectories()) do
local dist = directory_size_distance(self, subdir, size)
if dist < min_size then
for _, dir in ipairs(self.base_directories) do
for _, ext in ipairs(self.file_extension) do
local filename = string.format("%s/%s/%s/%s.%s", dir, self.icon_theme, subdir, iconname, ext)
if not already_checked[filename] then
if gears.filesystem.file_readable(filename) then
closest_filename = filename
min_size = dist
end
end
end
end
end
end
return closest_filename or nil
end
---Check if the icon inherits from another icon theme and search that for an icon
---@param icon any
---@param size any
---@param self any
---@return string path_to_icon
local function find_icon_helper(self, icon, size)
local filename = lookup_icon(self, icon, size)
if filename then return filename end
filename = lookup_icon(self, icon:lower(), size)
if filename then return filename end
for _, parent in ipairs(self.theme_index:get_inherits()) do
filename = find_icon_helper(xdg_icon_lookup(parent, self.base_directories), icon, size)
if filename then return filename end
end
return nil
end
local iconcache = {}
---Takes an icon and its props and theme to search for it inside the theme
---@param icon any
---@param size any
---@return string path_to_icon
function xdg_icon_lookup:find_icon(icon, size)
if iconcache[icon] then
return iconcache[icon]
end
size = size or 64
if not icon or icon == "" then return nil end
local filename = find_icon_helper(self, icon, size)
if filename then
iconcache[icon] = filename
return filename
end
filename = find_icon_helper(xdg_icon_lookup("hicolor", self.base_directories), icon, size)
if filename then
iconcache[icon] = filename
return filename
end
filename = lookup_fallback_icon(self, icon)
if filename then
iconcache[icon] = filename
return filename
end
local fallback = gears.color.recolor_image(require("awful").util.getdir("config") .. "src/assets/icons/fallback.svg",
"#ffffff")
iconcache[icon] = fallback
return fallback
end
xdg_icon_lookup.mt.__call = function(_, ...)
return xdg_icon_lookup.new(...)
end
return setmetatable(xdg_icon_lookup, xdg_icon_lookup.mt)

View File

@@ -3,11 +3,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/audio/"
@@ -23,6 +21,8 @@ return function(s)
{
id = "icon",
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -47,10 +47,10 @@ return function(s)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Yellow200"],
fg = color["Grey900"],
bg = Theme_config.audio.bg,
fg = Theme_config.audio.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -77,7 +77,7 @@ return function(s)
end
audio_widget.container.audio_layout.label:set_text(volume .. "%")
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
gears.color.recolor_image(icon .. ".svg", color["Grey900"]))
gears.color.recolor_image(icon .. ".svg", Theme_config.audio.fg))
awesome.emit_signal("get::volume", volume)
awesome.emit_signal("update::volume_widget", volume, icon .. ".svg")
end
@@ -90,9 +90,8 @@ return function(s)
function(stdout)
if stdout:match("yes") then
audio_widget.container.audio_layout.label.visible = false
audio_widget.container:set_right(0)
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", color["Grey900"]))
gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", Theme_config.audio.fg))
awesome.emit_signal("get::volume_mute", true)
else
audio_widget.container:set_right(10)
@@ -104,13 +103,12 @@ return function(s)
end
-- Signals
Hover_signal(audio_widget, color["Yellow200"], color["Grey900"])
Hover_signal(audio_widget, Theme_config.audio.bg, Theme_config.audio.fg)
audio_widget:connect_signal(
"button::press",
function()
awesome.emit_signal("module::slider:update")
awesome.emit_signal("widget::volume_osd:rerun")
awesome.emit_signal("volume_controller::toggle", s)
awesome.emit_signal("volume_controller::toggle:keygrabber")
end

View File

@@ -5,7 +5,6 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local lgi = require("lgi")
@@ -30,8 +29,10 @@ return function(battery_kind)
{
{
id = "icon",
image = gears.color.recolor_image(icondir .. "battery-unknown.svg", "#212121"),
image = gears.color.recolor_image(icondir .. "battery-unknown.svg", Theme_config.battery.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -57,22 +58,22 @@ return function(battery_kind)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Purple200"],
fg = color["Grey900"],
bg = Theme_config.battery.bg,
fg = Theme_config.battery.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
-- Color change on mouse over
Hover_signal(battery_widget, color["Purple200"], color["Grey900"])
Hover_signal(battery_widget, Theme_config.battery.bg, Theme_config.battery.fg)
-- Open an energy manager on click
battery_widget:connect_signal(
'button::press',
function()
awful.spawn(user_vars.energy_manager)
awful.spawn(User_config.energy_manager)
end
)
@@ -153,7 +154,8 @@ return function(battery_kind)
icon = icondir .. icon,
timeout = 5
}
battery_widget:get_children_by_id("icon")[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon, "#212121"))
battery_widget:get_children_by_id("icon")[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir
.. icon, Theme_config.battery.fg))
return
elseif battery_percentage > 0 and battery_percentage < 10 and battery_status == 'discharging' then
icon = icon .. '-' .. 'alert.svg'
@@ -164,7 +166,8 @@ return function(battery_kind)
icon = icondir .. icon,
timeout = 60
}
battery_widget:get_children_by_id("icon")[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon, "#212121"))
battery_widget:get_children_by_id("icon")[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir
.. icon, Theme_config.battery.fg))
return
end
@@ -190,7 +193,8 @@ return function(battery_kind)
icon = icon .. '-' .. battery_status .. '-' .. '90'
end
battery_widget:get_children_by_id("icon")[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121"))
battery_widget:get_children_by_id("icon")[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir ..
icon .. '.svg', Theme_config.battery.fg))
awesome.emit_signal("update::battery_widget", battery_percentage, icondir .. icon .. ".svg")
end
@@ -202,7 +206,7 @@ return function(battery_kind)
---Will report to the bluetooth widget.
---@param path string device path /org/freedesktop/...
local function attach_to_device(path)
local device_path = user_vars.battery_path or path or ""
local device_path = User_config.battery_path or path or ""
battery_widget.device = get_device_from_path(device_path) or upower_glib.Client():get_display_device()
@@ -226,7 +230,7 @@ return function(battery_kind)
battery_widget:connect_signal(
"upower::update",
function(widget, device)
function(_, device)
if upower_glib.DeviceKind[battery_widget.device.kind] == battery_kind then
set_battery(device)
end

View File

@@ -4,10 +4,8 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local naughty = require("naughty")
local wibox = require("wibox")
-- Icon directory path
@@ -20,8 +18,10 @@ return function(s)
{
{
id = "icon",
image = gears.color.recolor_image(icondir .. "bluetooth-off.svg"),
image = gears.color.recolor_image(icondir .. "bluetooth-off.svg", Theme_config.bluetooth.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -32,27 +32,29 @@ return function(s)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Blue200"],
fg = color["Grey900"],
bg = Theme_config.bluetooth.bg,
fg = Theme_config.bluetooth.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
-- Hover signal to change color when mouse is over
Hover_signal(bluetooth_widget, color["Blue200"], color["Grey900"])
Hover_signal(bluetooth_widget, Theme_config.bluetooth.bg, Theme_config.bluetooth.fg)
awesome.connect_signal("state", function(state)
if state then
bluetooth_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icondir .. "bluetooth-on.svg", color["Grey900"]))
bluetooth_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icondir .. "bluetooth-on.svg",
Theme_config.bluetooth.fg))
else
bluetooth_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icondir .. "bluetooth-off.svg", color["Grey900"]))
bluetooth_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icondir .. "bluetooth-off.svg",
Theme_config.bluetooth.fg))
end
end)
bluetooth_widget:connect_signal(
"button::press",
function(c, d, e, key)
function(_, _, _, key)
if key == 1 then
awesome.emit_signal("bluetooth_controller::toggle", s)
else

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/clock/"
@@ -23,8 +21,10 @@ return function()
{
{
id = "icon",
image = gears.color.recolor_image(icondir .. "clock.svg", color["Grey900"]),
image = gears.color.recolor_image(icondir .. "clock.svg", Theme_config.clock.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -50,15 +50,15 @@ return function()
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Orange200"],
fg = color["Grey900"],
bg = Theme_config.clock.bg,
fg = Theme_config.clock.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
Hover_signal(clock_widget, color["Orange200"], color["Grey900"])
Hover_signal(clock_widget, Theme_config.clock.bg, Theme_config.clock.fg)
return clock_widget
end

View File

@@ -9,7 +9,6 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local watch = awful.widget.watch
local wibox = require("wibox")
require("src.core.signals")
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
@@ -24,7 +23,9 @@ return function(widget, clock_mode)
{
id = "icon",
widget = wibox.widget.imagebox,
image = gears.color.recolor_image(icon_dir .. "cpu.svg", color["Grey900"]),
valign = "center",
halign = "center",
image = gears.color.recolor_image(icon_dir .. "cpu.svg", Theme_config.cpu_usage.fg),
resize = false
},
id = "icon_layout",
@@ -49,10 +50,10 @@ return function(widget, clock_mode)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Blue200"],
fg = color["Grey900"],
bg = Theme_config.cpu_usage.bg,
fg = Theme_config.cpu_usage.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -64,7 +65,10 @@ return function(widget, clock_mode)
{
{
id = "icon",
image = gears.color.recolor_image(icon_dir .. "thermometer.svg", Theme_config.cpu_temp.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -90,9 +94,9 @@ return function(widget, clock_mode)
widget = wibox.container.margin
},
bg = color["Green200"],
fg = color["Grey900"],
fg = Theme_config.cpu_temp.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -105,7 +109,9 @@ return function(widget, clock_mode)
{
id = "icon",
widget = wibox.widget.imagebox,
image = icon_dir .. "cpu.svg",
valign = "center",
halign = "center",
image = gears.color.recolor_image(icon_dir .. "cpu.svg", Theme_config.cpu_freq.fg),
resize = false
},
id = "icon_layout",
@@ -130,10 +136,10 @@ return function(widget, clock_mode)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Purple200"],
fg = color["Grey900"],
bg = Theme_config.cpu_freq.bg,
fg = Theme_config.cpu_freq.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -182,7 +188,7 @@ return function(widget, clock_mode)
temp_color = color["Red200"]
temp_icon = icon_dir .. "thermometer-high.svg"
end
Hover_signal(cpu_temp, temp_color, color["Grey900"])
Hover_signal(cpu_temp, temp_color, Theme_config.cpu_temp.fg)
cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
cpu_temp:set_bg(temp_color)
cpu_temp.container.cpu_layout.label.text = math.floor(temp_num) .. "°C"
@@ -214,8 +220,8 @@ return function(widget, clock_mode)
end
)
Hover_signal(cpu_usage_widget, color["Blue200"], color["Grey900"])
Hover_signal(cpu_clock, color["Purple200"], color["Grey900"])
Hover_signal(cpu_usage_widget, Theme_config.cpu_usage.bg, Theme_config.cpu_usage.fg)
Hover_signal(cpu_clock, Theme_config.cpu_freq.bg, Theme_config.cpu_freq.bg)
if widget == "usage" then
return cpu_usage_widget

View File

@@ -4,7 +4,6 @@
-- 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")
@@ -23,8 +22,10 @@ return function()
{
{
id = "icon",
image = gears.color.recolor_image(icondir .. "calendar.svg", color["Grey900"]),
image = gears.color.recolor_image(icondir .. "calendar.svg", Theme_config.date.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -49,10 +50,10 @@ return function()
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Teal200"],
fg = color["Grey900"],
bg = Theme_config.date.bg,
fg = Theme_config.date.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -72,7 +73,7 @@ return function()
}
-- Signals
Hover_signal(date_widget, color["Teal200"], color["Grey900"])
Hover_signal(date_widget, Theme_config.date.bg, Theme_config.date.fg)
date_widget:connect_signal(
"mouse::enter",

View File

@@ -9,7 +9,6 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local watch = awful.widget.watch
local wibox = require("wibox")
require("src.core.signals")
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
@@ -22,7 +21,53 @@ return function(widget)
{
id = "icon",
widget = wibox.widget.imagebox,
image = gears.color.recolor_image(icon_dir .. "gpu.svg", color["Grey900"]),
valign = "center",
halign = "center",
image = gears.color.recolor_image(icon_dir .. "gpu.svg", Theme_config.gpu_usage.fg),
resize = false
},
id = "icon_layout",
widget = wibox.container.place
},
top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
},
spacing = dpi(10),
{
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "gpu_layout",
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(8),
right = dpi(8),
widget = wibox.container.margin
},
bg = Theme_config.gpu_usage.bg,
fg = Theme_config.gpu_usage.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
Hover_signal(gpu_usage_widget, Theme_config.gpu_usage.bg, Theme_config.gpu_usage.fg)
local gpu_temp_widget = wibox.widget {
{
{
{
{
{
id = "icon",
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icon_dir .. "cpu.svg", Theme_config.gpu_temp.fg),
resize = false
},
id = "icon_layout",
@@ -48,51 +93,9 @@ return function(widget)
widget = wibox.container.margin
},
bg = color["Green200"],
fg = color["Grey900"],
fg = Theme_config.gpu_temp.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.container.background
}
Hover_signal(gpu_usage_widget, color["Green200"], color["Grey900"])
local gpu_temp_widget = wibox.widget {
{
{
{
{
{
id = "icon",
widget = wibox.widget.imagebox,
image = gears.color.recolor_image(icon_dir .. "cpu.svg", color["Grey900"]),
resize = false
},
id = "icon_layout",
widget = wibox.container.place
},
top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
},
spacing = dpi(10),
{
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "gpu_layout",
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(8),
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Blue200"],
fg = color["Grey900"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -117,6 +120,8 @@ return function(widget)
local temp_color
local temp_num = tonumber(stdout)
if temp_num then
if temp_num < 50 then
temp_color = color["Green200"]
temp_icon = icon_dir .. "thermometer-low.svg"
@@ -127,12 +132,17 @@ return function(widget)
temp_color = color["Red200"]
temp_icon = icon_dir .. "thermometer-high.svg"
end
Hover_signal(gpu_temp_widget, temp_color, color["Grey900"])
else
temp_num = "NaN"
temp_color = color["Green200"]
temp_icon = icon_dir .. "thermometer-low.svg"
end
Hover_signal(gpu_temp_widget, temp_color, Theme_config.gpu_temp.fg)
gpu_temp_widget.container.gpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
gpu_temp_widget:set_bg(temp_color)
gpu_temp_widget.container.gpu_layout.label.text = tostring(temp_num) .. "°C"
awesome.emit_signal("update::gpu_temp_widget", temp_num, temp_icon)
end
)

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/kblayout/"
@@ -23,7 +21,9 @@ return function(s)
id = "icon",
widget = wibox.widget.imagebox,
resize = false,
image = gears.color.recolor_image(icondir .. "keyboard.svg", color["Grey900"])
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "keyboard.svg", Theme_config.kblayout.fg)
},
id = "icon_layout",
widget = wibox.container.place
@@ -47,10 +47,10 @@ return function(s)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Green200"],
fg = color["Grey900"],
bg = Theme_config.kblayout.bg,
fg = Theme_config.kblayout.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -179,10 +179,10 @@ return function(s)
{
text = shortname,
widget = wibox.widget.textbox,
font = user_vars.font.extrabold,
font = User_config.font.extrabold,
id = "shortname"
},
fg = color["Red200"],
fg = Theme_config.kblayout.item.fg_short,
widget = wibox.container.background,
id = "background2"
},
@@ -190,10 +190,10 @@ return function(s)
{
text = longname,
widget = wibox.widget.textbox,
font = user_vars.font.bold,
font = User_config.font.bold,
id = "longname",
},
fg = color["Purple200"],
fg = Theme_config.kblayout.item.fg_long,
widget = wibox.container.background,
id = "background1"
},
@@ -206,10 +206,9 @@ return function(s)
id = "margin"
},
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 8)
gears.shape.rounded_rect(cr, width, height, dpi(8))
end,
bg = color["Grey800"],
fg = color["White"],
bg = Theme_config.kblayout.item.bg,
widget = wibox.container.background,
id = "background",
keymap = keymap
@@ -224,13 +223,13 @@ return function(s)
function(stdout)
local layout = stdout:gsub("\n", "")
if kb_layout_item.keymap == layout then
kb_layout_item.bg = color["DeepPurple200"]
kb_layout_item:get_children_by_id("background2")[1].fg = color["Grey900"]
kb_layout_item:get_children_by_id("background1")[1].fg = color["Grey900"]
kb_layout_item.bg = Theme_config.kblayout.item.bg_selected
kb_layout_item:get_children_by_id("background2")[1].fg = Theme_config.kblayout.item.fg_selected
kb_layout_item:get_children_by_id("background1")[1].fg = Theme_config.kblayout.item.fg_selected
else
kb_layout_item.bg = color["Grey800"]
kb_layout_item:get_children_by_id("background2")[1].fg = color["Red200"]
kb_layout_item:get_children_by_id("background1")[1].fg = color["Purple200"]
kb_layout_item.bg = Theme_config.kblayout.item.bg
kb_layout_item:get_children_by_id("background2")[1].fg = Theme_config.kblayout.item.fg_short
kb_layout_item:get_children_by_id("background1")[1].fg = Theme_config.kblayout.item.fg_long
end
end
)
@@ -260,7 +259,7 @@ return function(s)
layout = wibox.layout.fixed.vertical,
spacing = dpi(10)
}
for i, keymap in pairs(user_vars.kblayout) do
for i, keymap in pairs(User_config.kblayout) do
kb_layout_items[i] = create_kb_layout_item(keymap)
end
local cont = {
@@ -277,18 +276,19 @@ return function(s)
local kb_menu_widget = awful.popup {
screen = s,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
widget = wibox.container.background,
bg = color["Grey900"],
fg = color["White"],
bg = Theme_config.kblayout.bg_container,
border_width = dpi(4),
border_color = color["Grey800"],
border_color = Theme_config.kblayout.border_color_container,
width = dpi(100),
max_height = dpi(600),
visible = false,
ontop = true,
placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(255), top = dpi(60) } }) end
placement = function(c) awful.placement.align(c,
{ position = "top_right", margins = { right = dpi(255), top = dpi(60) } })
end
}
kb_menu_widget:connect_signal(
@@ -296,7 +296,7 @@ return function(s)
function()
mousegrabber.run(
function()
kblayout_widget.bg = color["Green200"]
kblayout_widget.bg = Theme_config.kblayout.bg
awesome.emit_signal("kblayout::hide:kbmenu")
mousegrabber.stop()
return true
@@ -321,18 +321,18 @@ return function(s)
awful.spawn.easy_async_with_shell(
"setxkbmap -query | grep layout: | awk '{print $2}'",
function(stdout)
for j, n in ipairs(user_vars.kblayout) do
for j, n in ipairs(User_config.kblayout) do
if stdout:match(n) then
if j == #user_vars.kblayout then
if j == #User_config.kblayout then
awful.spawn.easy_async_with_shell(
"setxkbmap " .. user_vars.kblayout[1],
"setxkbmap " .. User_config.kblayout[1],
function()
get_kblayout()
end
)
else
awful.spawn.easy_async_with_shell(
"setxkbmap " .. user_vars.kblayout[j + 1],
"setxkbmap " .. User_config.kblayout[j + 1],
function()
get_kblayout()
end
@@ -352,7 +352,7 @@ return function(s)
)
-- Signals
Hover_signal(kblayout_widget, color["Green200"], color["Grey900"])
Hover_signal(kblayout_widget, Theme_config.kblayout.bg, Theme_config.kblayout.fg)
local kblayout_keygrabber = awful.keygrabber {
autostart = false,

View File

@@ -4,11 +4,25 @@
-- 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")
--#region Layout icons
local layout_path = Theme_path .. "../assets/layout/"
Theme.layout_floating = layout_path .. "floating.svg"
Theme.layout_tile = layout_path .. "tile.svg"
Theme.layout_dwindle = layout_path .. "dwindle.svg"
Theme.layout_fairh = layout_path .. "fairh.svg"
Theme.layout_fairv = layout_path .. "fairv.svg"
Theme.layout_fullscreen = layout_path .. "fullscreen.svg"
Theme.layout_max = layout_path .. "max.svg"
Theme.layout_cornerne = layout_path .. "cornerne.svg"
Theme.layout_cornernw = layout_path .. "cornernw.svg"
Theme.layout_cornerse = layout_path .. "cornerse.svg"
Theme.layout_cornersw = layout_path .. "cornersw.svg"
--#endregion
-- Returns the layoutbox widget
return function()
@@ -25,15 +39,15 @@ return function()
forced_width = dpi(40),
widget = wibox.container.margin
},
bg = color["LightBlue200"],
bg = Theme_config.layout_list.bg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
-- Signals
Hover_signal(layout, color["LightBlue200"], color["Grey900"])
Hover_signal(layout, Theme_config.layout_list.bg, Theme_config.layout_list.fg)
layout:connect_signal(
"button::press",

View File

@@ -4,20 +4,18 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local naughty = require("naughty")
local wibox = require("wibox")
require("src.core.signals")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/network/"
-- Insert your interfaces here, get the from ip a
local interfaces = {
wlan_interface = user_vars.network.wlan,
lan_interface = user_vars.network.ethernet
wlan_interface = User_config.network.wlan,
lan_interface = User_config.network.ethernet
}
local network_mode = nil
@@ -34,8 +32,10 @@ return function()
{
{
id = 'icon',
image = gears.color.recolor_image(icondir .. "no-internet" .. ".svg", color["Grey900"]),
image = gears.color.recolor_image(icondir .. "no-internet" .. ".svg", Theme_config.network.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -61,10 +61,10 @@ return function()
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Red200"],
fg = color["Grey900"],
bg = Theme_config.network.bg,
fg = Theme_config.network.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -111,7 +111,7 @@ return function()
text = message,
title = title,
app_name = app_name,
icon = gears.color.recolor_image(icon, color["White"]),
icon = gears.color.recolor_image(icon, Theme_config.network.notify_icon_color),
timeout = 3
}
end
@@ -133,7 +133,10 @@ return function()
function(stdout)
local essid = stdout:match("SSID: (.-)\n") or "N/A"
local bitrate = stdout:match("tx bitrate: (.+/s)") or "N/A"
local message = "Connected to <b>" .. essid .. "</b>\nSignal strength <b>" .. tostring(wifi_strength) .. "%</b>\n" .. "Bit rate <b>" .. tostring(bitrate) .. "</b>"
local message = "Connected to <b>" ..
essid ..
"</b>\nSignal strength <b>" ..
tostring(wifi_strength) .. "%</b>\n" .. "Bit rate <b>" .. tostring(bitrate) .. "</b>"
if healthy then
update_tooltip(message)
@@ -165,7 +168,8 @@ return function()
update_wireless_data(false)
end
network_widget.container.network_layout.spacing = dpi(8)
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color["Grey900"]))
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir
.. icon .. ".svg", Theme_config.network.fg))
end
)
end
@@ -222,7 +226,7 @@ return function()
update_reconnect_startup(false)
end
network_widget.container.network_layout.label.visible = false
network_widget.container.network_layout.spacing = dpi(0)
network_widget.container.network_layout.spacing = 0
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(icondir .. icon .. ".svg")
end
)
@@ -230,14 +234,14 @@ return function()
end
local update_disconnected = function()
local notify_wireless_disconnected = function(essid)
local notify_wireless_disconnected = function()
local message = "WiFi has been disconnected"
local title = "Connection lost"
local app_name = "System Notification"
local icon = icondir .. "wifi-strength-off-outline.svg"
network_notify(message, title, app_name, icon)
end
local notify_wired_disconnected = function(essid)
local notify_wired_disconnected = function()
local message = "Ethernet has been unplugged"
local title = "Connection lost"
local app_name = "System Notification"
@@ -260,8 +264,9 @@ return function()
end
network_widget.container.network_layout.label.visible = false
update_tooltip("Network unreachable")
network_widget.container.network_layout.spacing = dpi(0)
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color["Grey900"]))
network_widget.container.network_layout.spacing = 0
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir ..
icon .. ".svg", Theme_config.network.fg))
end
local check_network_mode = function()
@@ -302,7 +307,6 @@ return function()
print_network_mode
]=],
function(stdout)
local mode = stdout:gsub("%\n", "")
if stdout:match("No internet connected") then
update_disconnected()
elseif stdout:match("wireless") then
@@ -324,7 +328,7 @@ return function()
}
-- Signals
Hover_signal(network_widget, color["Red200"], color["Grey900"])
Hover_signal(network_widget, Theme_config.network.bg, Theme_config.network.fg)
network_widget:connect_signal(
"button::press",

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/power/"
@@ -22,8 +20,10 @@ return function()
{
{
id = "icon",
image = gears.color.recolor_image(icondir .. "power.svg", color["Grey900"]),
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",
@@ -41,16 +41,16 @@ return function()
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Red200"],
fg = color["Grey800"],
bg = Theme_config.power_button.bg,
fg = Theme_config.power_button.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
-- Signals
Hover_signal(power_widget, color["Red200"], color["Grey900"])
Hover_signal(power_widget, Theme_config.power_button.bg, Theme_config.power_button.fg)
power_widget:connect_signal(
"button::release",

View File

@@ -4,12 +4,10 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local watch = awful.widget.watch
local wibox = require("wibox")
require("src.core.signals")
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
@@ -22,7 +20,9 @@ return function()
{
id = "icon",
widget = wibox.widget.imagebox,
image = gears.color.recolor_image(icon_dir .. "ram.svg", color["Grey900"]),
valign = "center",
halign = "center",
image = gears.color.recolor_image(icon_dir .. "ram.svg", Theme_config.ram_info.fg),
resize = false
},
id = "icon_layout",
@@ -47,15 +47,15 @@ return function()
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Red200"],
fg = color["Grey900"],
bg = Theme_config.ram_info.bg,
fg = Theme_config.ram_info.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
Hover_signal(ram_widget, color["Red200"], color["Grey900"])
Hover_signal(ram_widget, Theme_config.ram_info.bg, Theme_config.ram_info.fg)
watch(
[[ bash -c "cat /proc/meminfo| grep Mem | awk '{print $2}'" ]],
@@ -64,7 +64,8 @@ return function()
local MemTotal, MemFree, MemAvailable = stdout:match("(%d+)\n(%d+)\n(%d+)\n")
local ram_string = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) .. "/" .. string.format("%.1f", (MemTotal / 1024 / 1024)) .. "GB"):gsub(",", ".")
local ram_string = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) ..
"/" .. string.format("%.1f", (MemTotal / 1024 / 1024)) .. "GB"):gsub(",", ".")
ram_widget.container.ram_layout.label.text = ram_string
awesome.emit_signal("update::ram_widget", math.floor(((MemTotal - MemAvailable) / MemTotal * 100) + 0.5))

View File

@@ -3,13 +3,12 @@
--------------------------------
-- 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")
Theme.bg_systray = Theme_config.systray.bg
Theme.systray_icon_spacing = dpi(10)
return function(s)
local systray = wibox.widget {
@@ -25,12 +24,12 @@ return function(s)
},
widget = wibox.container.background,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
bg = color["BlueGrey800"]
bg = Theme_config.systray.bg
}
-- Signals
Hover_signal(systray.container, color["Red200"], color["Grey900"])
Hover_signal(systray.container, Theme_config.systray.bg, Theme_config.systray.bg)
awesome.connect_signal("systray::update", function()
local num_entries = awesome.systray()
@@ -42,7 +41,7 @@ return function(s)
end
end)
systray.container.st.widget:set_base_size(dpi(20))
systray.container.st.widget:set_base_size(dpi(24))
return systray
end

View File

@@ -7,10 +7,8 @@ local wibox = require("wibox")
local awful = require("awful")
local gears = require("gears")
local dpi = require("beautiful").xresources.apply_dpi
local color = require("src.theme.colors")
require("src.tools.icon_handler")
local list_update = function(widget, buttons, label, data, objects)
local list_update = function(widget, buttons, _, _, objects)
widget:reset()
for _, object in ipairs(objects) do
@@ -23,7 +21,7 @@ local list_update = function(widget, buttons, label, data, objects)
align = "center",
valign = "center",
visible = true,
font = user_vars.font.extrabold,
font = User_config.font.extrabold,
forced_width = dpi(25),
id = "label",
widget = wibox.widget.textbox
@@ -36,25 +34,25 @@ local list_update = function(widget, buttons, label, data, objects)
id = "container",
layout = wibox.layout.fixed.horizontal
},
fg = color["White"],
fg = Theme_config.taglist.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
local function create_buttons(buttons, object)
if buttons then
local function create_buttons(buttons_t, object_t)
if buttons_t then
local btns = {}
for _, b in ipairs(buttons) do
for _, b in ipairs(buttons_t) do
local btn = awful.button {
modifiers = b.modifiers,
button = b.button,
on_press = function()
b:emit_signal('press', object)
b:emit_signal('press', object_t)
end,
on_release = function()
b:emit_signal('release', object)
b:emit_signal('release', object_t)
end
}
btns[#btns + 1] = btn
@@ -67,13 +65,13 @@ local list_update = function(widget, buttons, label, data, objects)
tag_widget.container.margin.label:set_text(object.index)
if object.urgent == true then
tag_widget:set_bg(color["RedA200"])
tag_widget:set_fg(color["Grey900"])
tag_widget:set_bg(Theme_config.taglist.bg_urgent)
tag_widget:set_fg(Theme_config.taglist.fg_urgent)
elseif object == awful.screen.focused().selected_tag then
tag_widget:set_bg(color["White"])
tag_widget:set_fg(color["Grey900"])
tag_widget:set_bg(Theme_config.taglist.bg_focus)
tag_widget:set_fg(Theme_config.taglist.fg_focus)
else
tag_widget:set_bg("#3A475C")
tag_widget:set_bg(Theme_config.taglist.bg)
end
-- Set the icon for each client
@@ -85,6 +83,8 @@ local list_update = function(widget, buttons, label, data, objects)
{
id = "icon",
resize = true,
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
widget = wibox.container.place
@@ -93,7 +93,9 @@ local list_update = function(widget, buttons, label, data, objects)
margins = dpi(6),
widget = wibox.container.margin
}
icon.icon_container.icon:set_image(Get_icon(user_vars.icon_theme, client))
icon.icon_container.icon:set_image(xdg_icon_lookup:find_icon(client.class, 64))
tag_widget.container:setup({
icon,
strategy = "exact",
@@ -102,15 +104,14 @@ local list_update = function(widget, buttons, label, data, objects)
end
--#region Hover_signal
local old_wibox, old_cursor, old_bg
local old_wibox, old_cursor
tag_widget:connect_signal(
"mouse::enter",
function()
old_bg = tag_widget.bg
if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#dddddd' .. 'dd'
tag_widget.bg = Theme_config.taglist.bg_focus_hover .. 'dd'
else
tag_widget.bg = '#3A475C' .. 'dd'
tag_widget.bg = Theme_config.taglist.bg .. 'dd'
end
local w = mouse.current_wibox
if w then
@@ -124,9 +125,9 @@ local list_update = function(widget, buttons, label, data, objects)
"button::press",
function()
if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#bbbbbb' .. 'dd'
tag_widget.bg = Theme_config.taglist.bg_focus_pressed .. 'dd'
else
tag_widget.bg = '#3A475C' .. 'dd'
tag_widget.bg = Theme_config.taglist.bg .. 'dd'
end
end
)
@@ -135,9 +136,9 @@ local list_update = function(widget, buttons, label, data, objects)
"button::release",
function()
if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#dddddd' .. 'dd'
tag_widget.bg = Theme_config.taglist.bg_focus_hover .. 'dd'
else
tag_widget.bg = '#3A475C' .. 'dd'
tag_widget.bg = Theme_config.taglist.bg .. 'dd'
end
end
)
@@ -145,7 +146,11 @@ local list_update = function(widget, buttons, label, data, objects)
tag_widget:connect_signal(
"mouse::leave",
function()
tag_widget.bg = old_bg
if object == awful.screen.focused().selected_tag then
tag_widget.bg = Theme_config.taglist.bg_focus
else
tag_widget.bg = Theme_config.taglist.bg
end
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil

View File

@@ -7,9 +7,8 @@ local awful = require('awful')
local wibox = require('wibox')
local dpi = require('beautiful').xresources.apply_dpi
local gears = require('gears')
local color = require('src.theme.colors')
local list_update = function(widget, buttons, label, data, objects)
local list_update = function(widget, buttons, label, _, objects)
widget:reset()
for _, object in ipairs(objects) do
local task_widget = wibox.widget {
@@ -20,6 +19,8 @@ local list_update = function(widget, buttons, label, data, objects)
nil,
{
id = "icon",
valign = "center",
halign = "center",
resize = true,
widget = wibox.widget.imagebox
},
@@ -48,10 +49,9 @@ local list_update = function(widget, buttons, label, data, objects)
widget = wibox.container.margin,
id = "container"
},
bg = color["White"],
fg = color["Grey900"],
fg = Theme_config.tasklist.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -66,18 +66,18 @@ local list_update = function(widget, buttons, label, data, objects)
delay_show = 1
}
local function create_buttons(buttons, object)
if buttons then
local function create_buttons(buttons_t, object_t)
if buttons_t then
local btns = {}
for _, b in ipairs(buttons) do
for _, b in ipairs(buttons_t) do
local btn = awful.button {
modifiers = b.modifiers,
button = b.button,
on_press = function()
b:emit_signal('press', object)
b:emit_signal('press', object_t)
end,
on_release = function()
b:emit_signal('release', object)
b:emit_signal('release', object_t)
end
}
btns[#btns + 1] = btn
@@ -106,27 +106,26 @@ local list_update = function(widget, buttons, label, data, objects)
task_tool_tip:remove_from_object(task_widget)
end
end
task_widget:set_bg(color["White"])
task_widget:set_fg(color["Grey900"])
task_widget:set_bg(Theme_config.tasklist.bg_focus)
task_widget:set_fg(Theme_config.tasklist.fg_focus)
task_widget.container.layout_it.title:set_text(text)
else
task_widget:set_bg("#3A475C")
task_widget:set_bg(Theme_config.tasklist.bg)
task_widget.container.layout_it.title:set_text('')
end
task_widget.container.layout_it.margin.layout_icon.icon:set_image(Get_icon(user_vars.icon_theme, object))
task_widget.container.layout_it.margin.layout_icon.icon:set_image(xdg_icon_lookup:find_icon(object.class, 64))
widget:add(task_widget)
widget:set_spacing(dpi(6))
--#region Hover_signal
local old_wibox, old_cursor, old_bg
local old_wibox, old_cursor
task_widget:connect_signal(
"mouse::enter",
function()
old_bg = task_widget.bg
if object == client.focus then
task_widget.bg = '#dddddddd'
task_widget.bg = Theme_config.tasklist.bg_focus_hover .. "dd"
else
task_widget.bg = '#3A475Cdd'
task_widget.bg = Theme_config.tasklist.bg .. 'dd'
end
local w = mouse.current_wibox
if w then
@@ -140,9 +139,9 @@ local list_update = function(widget, buttons, label, data, objects)
"button::press",
function()
if object == client.focus then
task_widget.bg = "#ffffffaa"
task_widget.bg = Theme_config.tasklist.bg_focus_pressed .. "dd"
else
task_widget.bg = '#3A475Caa'
task_widget.bg = Theme_config.tasklist.bg .. "dd"
end
end
)
@@ -151,9 +150,9 @@ local list_update = function(widget, buttons, label, data, objects)
"button::release",
function()
if object == client.focus then
task_widget.bg = "#ffffffdd"
task_widget.bg = Theme_config.tasklist.bg_focus_hover .. "dd"
else
task_widget.bg = '#3A475Cdd'
task_widget.bg = Theme_config.tasklist.bg .. "dd"
end
end
)
@@ -161,7 +160,11 @@ local list_update = function(widget, buttons, label, data, objects)
task_widget:connect_signal(
"mouse::leave",
function()
task_widget.bg = old_bg
if object == client.focus then
task_widget.bg = Theme_config.tasklist.bg_focus
else
task_widget.bg = Theme_config.tasklist.bg
end
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil