diff --git a/awesome/awful/widget/toggle_widget.lua b/awesome/awful/widget/toggle_widget.lua
index 887a5fc..56526c4 100644
--- a/awesome/awful/widget/toggle_widget.lua
+++ b/awesome/awful/widget/toggle_widget.lua
@@ -1,6 +1,7 @@
local base = require('wibox.widget.base')
local gtable = require('gears.table')
local gcolor = require('gears.color')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox')
local gshape = require('gears.shape')
@@ -38,21 +39,21 @@ end
function toggle_widget:set_disabled()
self.active = not self.active
- self.toggle_button.border_color = Theme_config.dnd.border_disabled
- self.newcolor = Theme_config.dnd.disabled
+ self.toggle_button.border_color = beautiful.colorscheme.bg1
+ self.newcolor = beautiful.colorscheme.bg1
self.rubato_timed.target = 5
end
function toggle_widget:toggle_animation(pos, color)
if pos > 39 then return end
return function(_, _, cr, width, height)
- cr:set_source(gcolor(Theme_config.dnd.bg))
+ cr:set_source(gcolor(beautiful.colorscheme.bg))
cr:paint()
cr:set_source(gcolor(color))
cr:move_to(pos, 0)
local x = pos
local y = 5
- local newwidth = width / 2 - 6
+ local newwidth = dpi(width / 2 - 6)
local newheight = height - 10
local radius = height / 6.0
@@ -77,7 +78,7 @@ function toggle_widget.new(args)
gtable.crush(ret, toggle_widget, true)
- ret.newcolor = Theme_config.dnd.disabled
+ ret.newcolor = beautiful.colorscheme.bg1
ret.color = args.color
ret.toggle_button = wibox.widget {
@@ -92,14 +93,12 @@ function toggle_widget.new(args)
},
active = false,
widget = wibox.container.background,
- bg = Theme_config.dnd.bg,
- border_color = Theme_config.dnd.border_disabled,
+ bg = beautiful.colorscheme.bg,
+ border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
forced_height = args.size,
forced_width = args.size * 2,
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(10))
- end,
+ shape = beautiful.shape[10],
}
ret.rubato_timed = rubato.timed {
@@ -128,9 +127,7 @@ function toggle_widget.new(args)
},
id = 'background4',
fg = args.fg,
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(12))
- end,
+ shape = beautiful.shape[12],
widget = wibox.container.background,
},
id = 'place',
diff --git a/awesome/rc.lua b/awesome/rc.lua
index a46cfdc..6e10db9 100644
--- a/awesome/rc.lua
+++ b/awesome/rc.lua
@@ -35,32 +35,15 @@ io.stderr:write([[
]] .. '\27[0m\n')
--#endregion
--- Initialising, order is important!
-awesome = awesome
-client = client
-mouse = mouse
-mousegrabber = mousegrabber
-root = root
-screen = screen
-selection = selection
-tag = tag
-
--- Do not touch as this is used to share some variable settings files
-Global_config = {}
-
require('src.core.error_handling')
-require('src.theme.user_config')
-require('src.theme.theme_config')
-require('src.tools.gio_icon_lookup')
-require('src.theme.init')
-require('src.tools.hex_to_rgba')
+require('src.theme')
require('src.core.signals')
require('src.core.notifications')
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_config.autostart)
+require('src.modules')()
+require('src.tools.auto_starter') {}
--require('src.core.setup')()
diff --git a/awesome/schema.json b/awesome/schema.json
new file mode 100644
index 0000000..0d3ba50
--- /dev/null
+++ b/awesome/schema.json
@@ -0,0 +1,422 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://example.com/product.schema.json",
+ "title": "theme completion",
+ "description": "completion for crylia-theme config",
+ "type": "object",
+ "properties": {
+ "autostart": {
+ "description": "Commands that run on startup",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "battery_kind": {
+ "description": "Where to fetch the battery information from",
+ "type": "string",
+ "enum": [
+ "UNKNOWN",
+ "LINE_POWER",
+ "TABLET",
+ "COMPUTER",
+ "GAMING_INPUT",
+ "LAST",
+ "BATTERY",
+ "UPS",
+ "MONITOR",
+ "MOUSE",
+ "KEYBOARD",
+ "PDA",
+ "PHONE",
+ "MEDIA_PLAYER"
+ ]
+ },
+ "battery_path": {
+ "description": "Custom battery path",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "brightness_step": {
+ "description": "Brightness step in %",
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 100
+ },
+ "dock_icon_size": {
+ "description": "Dock icon size",
+ "type": "integer"
+ },
+ "energy_manager": {
+ "description": "Program started when battery widget is clicked",
+ "type": "string"
+ },
+ "file_manager": {
+ "description": "Default File manager",
+ "type": "string"
+ },
+ "font": {
+ "description": "Font used for UI elements",
+ "type": "string"
+ },
+ "font-size": {
+ "description": "Font size",
+ "type": "integer",
+ "exclusiveMinimum": 0
+ },
+ "font-weight": {
+ "description": "Font weight",
+ "type": "string"
+ },
+ "gtk_settings": {
+ "description": "Program used for GTK settings",
+ "type": "string"
+ },
+ "icon_theme": {
+ "description": "Icon theme",
+ "type": "string"
+ },
+ "kblayout": {
+ "description": "Keyboard layouts to use",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "layouts": {
+ "description": "Layouts",
+ "type": "array",
+ "items": {
+ "enum": [
+ "awful.layout.suit.fair",
+ "awful.layout.suit.floating"
+ ],
+ "type": "string"
+ }
+ },
+ "modkey": {
+ "description": "Modkey",
+ "type": "string",
+ "enum": [
+ "Mod5",
+ "Mod4",
+ "Mod3",
+ "Mod2",
+ "Mod1"
+ ]
+ },
+ "namestyle": {
+ "description": "Name formatting used for power menu",
+ "type": "string",
+ "enum": [
+ "userhost",
+ "fullname"
+ ]
+ },
+ "screen_settings": {
+ "description": "Program used for screen settings",
+ "type": "string"
+ },
+ "screenshot_program": {
+ "description": "Program used for screenshots",
+ "type": "string"
+ },
+ "status_bar_widgets": {
+ "description": "Widgets used in the notification center",
+ "type": "array",
+ "items": {
+ "type": "string",
+ "enum": [
+ "cpu_usage",
+ "cpu_temp",
+ "ram_usage",
+ "microphone",
+ "volume",
+ "gpu_temp",
+ "gpu_usage",
+ "battery",
+ "backlight"
+ ]
+ }
+ },
+ "taskbar_use_name": {
+ "description": "If the taskbar should use the name or class",
+ "type": "boolean"
+ },
+ "terminal": {
+ "description": "Default terminal",
+ "type": "string"
+ },
+ "text_editor": {
+ "description": "Default texteditor",
+ "type": "string"
+ },
+ "titlebar_exception": {
+ "description": "Exceptions for titlebars",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "titlebar_position": {
+ "description": "Position of the titlebar",
+ "type": "string",
+ "enum": [
+ "top",
+ "left"
+ ]
+ },
+ "titlebar_items": {
+ "description": "Items in the titlebar",
+ "type": "object",
+ "properties": {
+ "left_and_bottom": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "enum": [
+ "icon",
+ "close",
+ "maximize",
+ "minimize",
+ "title"
+ ]
+ }
+ },
+ "right_and_top": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "enum": [
+ "icon",
+ "close",
+ "maximize",
+ "minimize",
+ "title"
+ ]
+ }
+ }
+ }
+ },
+ "wallpaper": {
+ "description": "wallpaper",
+ "type": "string"
+ },
+ "weather_secrets": {
+ "description": "weather api secrets",
+ "type": "object",
+ "properties": {
+ "type": "string",
+ "key": {
+ "type": "string",
+ "minLength": 32,
+ "maxLength": 32
+ },
+ "city_id": {
+ "type": "string",
+ "minLength": 7,
+ "maxLength": 7
+ },
+ "unit": {
+ "type": "string",
+ "enum": [
+ "metric",
+ "imperial"
+ ]
+ }
+ }
+ },
+ "web_browser": {
+ "description": "Browser",
+ "type": "string"
+ },
+ "crylia_bar": {
+ "description": "Default bar widgets",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "left_bar": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "enum": [
+ "Tiling Layout",
+ "Systray",
+ "Taglist",
+ "Tasklist",
+ "Bluetooth",
+ "Network",
+ "Battery",
+ "Cpu Usage",
+ "Cpu Temp",
+ "Cpu Freq",
+ "Gpu Usage",
+ "Gpu Temp",
+ "Ram Usage",
+ "Audio",
+ "Keyboard Layout",
+ "Date",
+ "Clock",
+ "Power Button"
+ ]
+ }
+ },
+ "center_bar": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "enum": [
+ "Tiling Layout",
+ "Systray",
+ "Taglist",
+ "Tasklist",
+ "Bluetooth",
+ "Network",
+ "Battery",
+ "Cpu Usage",
+ "Cpu Temp",
+ "Cpu Freq",
+ "Gpu Usage",
+ "Gpu Temp",
+ "Ram Usage",
+ "Audio",
+ "Keyboard Layout",
+ "Date",
+ "Clock",
+ "Power Button"
+ ]
+ }
+ },
+ "right_bar": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "enum": [
+ "Tiling Layout",
+ "Systray",
+ "Taglist",
+ "Tasklist",
+ "Bluetooth",
+ "Network",
+ "Battery",
+ "Cpu Usage",
+ "Cpu Temp",
+ "Cpu Freq",
+ "Gpu Usage",
+ "Gpu Temp",
+ "Ram Usage",
+ "Audio",
+ "Keyboard Layout",
+ "Date",
+ "Clock",
+ "Power Button"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "crylia_wibox": {
+ "description": "Default bar widgets",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "left": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "enum": [
+ "Tiling Layout",
+ "Systray",
+ "Taglist",
+ "Tasklist",
+ "Bluetooth",
+ "Network",
+ "Battery",
+ "Cpu Usage",
+ "Cpu Temp",
+ "Cpu Freq",
+ "Gpu Usage",
+ "Gpu Temp",
+ "Ram Usage",
+ "Audio",
+ "Keyboard Layout",
+ "Date",
+ "Clock",
+ "Power Button"
+ ]
+ }
+ },
+ "center": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "enum": [
+ "Tiling Layout",
+ "Systray",
+ "Taglist",
+ "Tasklist",
+ "Bluetooth",
+ "Network",
+ "Battery",
+ "Cpu Usage",
+ "Cpu Temp",
+ "Cpu Freq",
+ "Gpu Usage",
+ "Gpu Temp",
+ "Ram Usage",
+ "Audio",
+ "Keyboard Layout",
+ "Date",
+ "Clock",
+ "Power Button"
+ ]
+ }
+ },
+ "right": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "enum": [
+ "Tiling Layout",
+ "Systray",
+ "Taglist",
+ "Tasklist",
+ "Bluetooth",
+ "Network",
+ "Battery",
+ "Cpu Usage",
+ "Cpu Temp",
+ "Cpu Freq",
+ "Gpu Usage",
+ "Gpu Temp",
+ "Ram Usage",
+ "Audio",
+ "Keyboard Layout",
+ "Date",
+ "Clock",
+ "Power Button"
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "anyOf": [
+ {
+ "required": [
+ "crylia_bar"
+ ]
+ },
+ {
+ "required": [
+ "crylia_wibox"
+ ]
+ }
+ ]
+}
diff --git a/awesome/src/assets/icons/systray/chevron-left.svg b/awesome/src/assets/icons/systray/chevron-left.svg
new file mode 100644
index 0000000..53831bc
--- /dev/null
+++ b/awesome/src/assets/icons/systray/chevron-left.svg
@@ -0,0 +1,3 @@
+
diff --git a/awesome/src/assets/icons/systray/chevron-right.svg b/awesome/src/assets/icons/systray/chevron-right.svg
new file mode 100644
index 0000000..b2da475
--- /dev/null
+++ b/awesome/src/assets/icons/systray/chevron-right.svg
@@ -0,0 +1,3 @@
+
diff --git a/awesome/src/assets/userpfp/userpfp.png b/awesome/src/assets/userpfp/userpfp.png
index cc2d872..f7f5c0d 100644
Binary files a/awesome/src/assets/userpfp/userpfp.png and b/awesome/src/assets/userpfp/userpfp.png differ
diff --git a/awesome/src/bindings/bind_to_tags.lua b/awesome/src/bindings/bind_to_tags.lua
index c231428..1ac6ad4 100644
--- a/awesome/src/bindings/bind_to_tags.lua
+++ b/awesome/src/bindings/bind_to_tags.lua
@@ -2,16 +2,17 @@
local akey = require('awful.key')
local ascreen = require('awful.screen')
local atag = require('awful.tag')
+local beautiful = require('beautiful')
local gtable = require('gears.table')
-- Local libs
local globalkeys = require('src.bindings.global_keys')
-local modkey = User_config.modkey
+local modkey = beautiful.user_config['modkey']
local capi = {
client = client,
- root = root
+ root = root,
}
for i = 1, 9 do
diff --git a/awesome/src/bindings/client_buttons.lua b/awesome/src/bindings/client_buttons.lua
index 2860eaf..36b8062 100644
--- a/awesome/src/bindings/client_buttons.lua
+++ b/awesome/src/bindings/client_buttons.lua
@@ -2,8 +2,10 @@
local abutton = require('awful.button')
local gtable = require('gears.table')
local amouse = require('awful.mouse')
+local beautiful = require('beautiful')
-local modkey = User_config.modkey
+
+local modkey = beautiful.user_config['modkey']
return gtable.join {
abutton({}, 1, function(c)
diff --git a/awesome/src/bindings/client_keys.lua b/awesome/src/bindings/client_keys.lua
index 46aac49..bcbba0d 100644
--- a/awesome/src/bindings/client_keys.lua
+++ b/awesome/src/bindings/client_keys.lua
@@ -2,9 +2,11 @@
local aclient = require('awful.client')
local akey = require('awful.key')
local ascreen = require('awful.screen')
+local beautiful = require('beautiful')
+
local gtable = require('gears.table')
-local modkey = User_config.modkey
+local modkey = beautiful.user_config['modkey']
return gtable.join(
--#region Basic interactions
diff --git a/awesome/src/bindings/global_keys.lua b/awesome/src/bindings/global_keys.lua
index 61fe4be..6af383c 100644
--- a/awesome/src/bindings/global_keys.lua
+++ b/awesome/src/bindings/global_keys.lua
@@ -14,7 +14,8 @@ local ruled = require('ruled')
local config = require('src.tools.config')
local audio_helper = require('src.tools.helpers.audio')
local backlight_helper = require('src.tools.helpers.backlight')
-local powermenu = require('src.modules.powermenu.init')
+local beautiful = require('beautiful')
+local powermenu = require('src.modules.powermenu')
local kb_helper = require('src.tools.helpers.kb_helper')
local capi = {
@@ -23,7 +24,7 @@ local capi = {
mouse = mouse,
}
-local modkey = User_config.modkey
+local modkey = beautiful.user_config['modkey']
akeygrabber {
keybindings = {
@@ -138,7 +139,7 @@ return gtable.join(
{ modkey },
'#36',
function()
- aspawn(User_config.terminal)
+ aspawn(beautiful.user_config.terminal)
end,
{ description = 'Open terminal', group = 'Applications' }
),
@@ -208,7 +209,7 @@ return gtable.join(
{ modkey },
'#26',
function()
- aspawn(User_config.file_manager)
+ aspawn(beautiful.user_config.file_manager)
end,
{ descripton = 'Open file manager', group = 'System' }
),
@@ -224,7 +225,7 @@ return gtable.join(
{},
'#107',
function()
- aspawn(User_config.screenshot_program)
+ aspawn(beautiful.user_config.screenshot_program)
end,
{ description = 'Screenshot', group = 'Applications' }
),
@@ -256,7 +257,7 @@ return gtable.join(
{},
'XF86MonBrightnessUp',
function(c)
- backlight_helper.brightness_increase()
+ backlight_helper:brightness_increase()
end,
{ description = 'Raise backlight brightness', group = 'System' }
),
@@ -264,7 +265,7 @@ return gtable.join(
{},
'XF86MonBrightnessDown',
function(c)
- backlight_helper.brightness_decrease()
+ backlight_helper:brightness_decrease()
end,
{ description = 'Lower backlight brightness', group = 'System' }
),
diff --git a/awesome/src/core/notifications.lua b/awesome/src/core/notifications.lua
index 5e2fdc5..f42ea77 100644
--- a/awesome/src/core/notifications.lua
+++ b/awesome/src/core/notifications.lua
@@ -4,10 +4,10 @@
-- Awesome Libs
local aspawn = require('awful.spawn')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
-local gshape = require('gears.shape')
local naughty = require('naughty')
local wibox = require('wibox')
local abutton = require('awful.button')
@@ -28,15 +28,13 @@ naughty.config.defaults.icon_size = dpi(80)
naughty.config.defaults.timeout = 5
naughty.config.defaults.title = 'System Notification'
naughty.config.defaults.margin = dpi(10)
-naughty.config.defaults.position = Theme_config.notification.position
-naughty.config.defaults.border_width = Theme_config.notification.border_width
-naughty.config.defaults.border_color = Theme_config.notification.border_color
-naughty.config.defaults.spacing = Theme_config.notification.spacing
-
-Theme.notification_spacing = Theme_config.notification.corner_spacing
+naughty.config.defaults.position = 'bottom_right'
+naughty.config.defaults.border_width = dpi(2)
+naughty.config.defaults.border_color = beautiful.colorscheme.border_color
+naughty.config.defaults.spacing = dpi(10)
naughty.connect_signal('request::display', function(n)
- if User_config.dnd then
+ if beautiful.user_config.dnd then
n:destroy()
else
if not n.icon then n.icon = gfilesystem.get_configuration_dir() .. 'src/assets/CT.svg' end
@@ -44,9 +42,9 @@ naughty.connect_signal('request::display', function(n)
if not n.title then n.title = 'System Notification' end
if not n.message then n.message = 'No message provided' end
- local color = Theme_config.notification.bg_normal
+ local color = beautiful.colorscheme.bg_blue
if n.urgency == 'critical' then
- color = Theme_config.notification.fg_urgent_message
+ color = beautiful.colorscheme.bg_red
end
if n.app_name == 'Spotify' then
@@ -104,28 +102,24 @@ naughty.connect_signal('request::display', function(n)
id = 'background_role',
widget = wibox.container.background,
bg = color,
- fg = Theme_config.notification.bg,
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[8],
},
style = {
underline_normal = false,
underline_selected = false,
- shape_normal = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
+ shape_normal = beautiful.shape[8],
--Don't remove or it will break
bg_normal = color,
bg_selected = color,
- fg_normal = Theme_config.notification.bg,
- fg_selected = Theme_config.notification.bg,
+ fg_normal = beautiful.colorscheme.bg,
+ fg_selected = beautiful.colorscheme.bg,
},
widget = naughty.list.actions,
}
-- Hack to get the action buttons to work even after update
- --[[ for i = 1, #action_template._private.layout.children, 1 do
+ for i = 1, #action_template._private.layout.children, 1 do
hover.bg_hover { widget = action_template._private.layout.children[i].children[1], overlay = 12, press_overlay = 24 }
end
if (#action_template._private.layout.children > 0) and action_template._private.notification[1].actions[1].program == 'Spotify' then
@@ -138,7 +132,7 @@ naughty.connect_signal('request::display', function(n)
action_template._private.layout.children[3].children[1]:connect_signal('button::press', function()
aspawn('playerctl next')
end)
- end ]]
+ end
local start_timer = n.timeout
if n.timeout == 0 then
@@ -164,9 +158,7 @@ naughty.connect_signal('request::display', function(n)
resize = true,
},
widget = wibox.container.background,
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
+ shape = beautiful.shape[4],
},
widget = wibox.container.place,
},
@@ -180,7 +172,7 @@ naughty.connect_signal('request::display', function(n)
notification = n,
widget = naughty.widget.title,
markup = [[]] .. (n.app_name or
+ beautiful.colorscheme.bg .. [[" font="JetBrainsMono Nerd Font, Bold 16">]] .. (n.app_name or
'Unknown App') .. [[ | ]] .. (n.title or 'System Notification') .. [[]],
halign = 'left',
valign = 'center',
@@ -203,7 +195,7 @@ naughty.connect_signal('request::display', function(n)
widget = wibox.widget.textclock,
format = '%H:%M',
font = 'JetBrainsMono Nerd Font, Bold 16',
- fg = Theme_config.notification.bg,
+ fg = beautiful.colorscheme.bg,
halign = 'right',
valign = 'center',
},
@@ -213,7 +205,7 @@ naughty.connect_signal('request::display', function(n)
{
{
widget = wibox.widget.imagebox,
- image = gcolor.recolor_image(icondir .. 'close.svg', Theme_config.notification.bg),
+ image = gcolor.recolor_image(icondir .. 'close.svg', beautiful.colorscheme.bg),
resize = true,
halign = 'center',
valign = 'center',
@@ -226,7 +218,7 @@ naughty.connect_signal('request::display', function(n)
widget = wibox.container.arcchart,
id = 'arc',
},
- fg = Theme_config.notification.bg_close,
+ fg = beautiful.colorscheme.bg,
bg = color,
widget = wibox.container.background,
id = 'arc_bg',
@@ -248,10 +240,8 @@ naughty.connect_signal('request::display', function(n)
},
widget = wibox.container.background,
bg = color,
- fg = '#212121',
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[8],
},
{ -- Main body
{ -- Image
@@ -266,9 +256,7 @@ naughty.connect_signal('request::display', function(n)
widget = naughty.widget.icon,
},
widget = wibox.container.background,
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(10))
- end,
+ shape = beautiful.shape[10],
},
widget = wibox.container.constraint,
strategy = 'exact',
@@ -293,7 +281,7 @@ naughty.connect_signal('request::display', function(n)
{ -- Spacer
{
widget = wibox.container.background,
- bg = Theme_config.notification.action_bg,
+ bg = beautiful.colorscheme.bg,
},
widget = wibox.container.constraint,
strategy = 'exact',
@@ -307,12 +295,10 @@ naughty.connect_signal('request::display', function(n)
widget = wibox.container.margin,
margins = dpi(15),
},
- bg = '#212121',
- border_color = '#414141',
+ bg = beautiful.colorscheme.bg,
+ border_color = beautiful.colorscheme.border_color,
border_width = dpi(2),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
+ shape = beautiful.shape[8],
widget = wibox.container.background,
},
widget = wibox.container.constraint,
@@ -388,171 +374,6 @@ naughty.connect_signal('request::display', function(n)
}
box.buttons = {}
n.buttons = {}
-
- -- This is stupid but there is on way to clone the notifaction widget and being able to modify only the clone
- --[=[ naughty.emit_signal('notification_surface', wibox.template {
- widget = wibox.widget {
- {
- {
- {
- { -- Title
- {
- {
- { -- Icon
- {
- {
- {
- {
- notification = n,
- widget = naughty.widget.icon,
- --image = n.icon or '',
- resize = true,
- },
- widget = wibox.container.background,
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- },
- widget = wibox.container.place,
- },
- widget = wibox.container.constraint,
- strategy = 'exact',
- width = dpi(20),
- height = dpi(20),
- },
- { -- Title
- {
- notification = n,
- widget = naughty.widget.title,
- markup = [[]] .. (n.app_name or
- 'Unknown App') .. [[ | ]] .. (n.title or 'System Notification') .. [[]],
- halign = 'left',
- valign = 'center',
- },
- widget = wibox.container.constraint,
- width = dpi(280),
- height = dpi(35),
- strategy = 'max',
- },
- spacing = dpi(10),
- layout = wibox.layout.fixed.horizontal,
- },
- widget = wibox.container.margin,
- left = dpi(10),
- },
- nil,
- {
- {
- { -- Clock
- widget = wibox.widget.textclock,
- format = '%H:%M',
- font = 'JetBrainsMono Nerd Font, Bold 16',
- fg = Theme_config.notification.bg,
- halign = 'right',
- valign = 'center',
- },
- { -- Close button
- {
- {
- {
- {
- widget = wibox.widget.imagebox,
- image = gcolor.recolor_image(icondir .. 'close.svg', Theme_config.notification.bg),
- resize = true,
- halign = 'center',
- valign = 'center',
- },
- start_angle = 4.71239,
- thickness = dpi(2),
- min_value = 0,
- max_value = start_timer,
- value = start_timer,
- widget = wibox.container.arcchart,
- id = 'arc',
- },
- fg = Theme_config.notification.bg_close,
- bg = color,
- widget = wibox.container.background,
- id = 'arc_bg',
- },
- strategy = 'exact',
- width = dpi(18),
- height = dpi(18),
- widget = wibox.container.constraint,
- },
- left = dpi(5),
- widget = wibox.container.margin,
- },
- layout = wibox.layout.fixed.horizontal,
- },
- right = dpi(5),
- widget = wibox.container.margin,
- },
- layout = wibox.layout.align.horizontal,
- },
- widget = wibox.container.background,
- bg = color,
- fg = '#212121',
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- },
- { -- Main body
- { -- Image
- {
- {
- notification = n,
- --image = n.icon or '',
- valign = 'center',
- halign = 'center',
- upscale = true,
- resize_strategy = 'scale',
- widget = naughty.widget.icon,
- },
- widget = wibox.container.background,
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(10))
- end,
- },
- widget = wibox.container.constraint,
- strategy = 'exact',
- height = dpi(128),
- width = dpi(128),
- },
- {
- {
- notification = n,
- widget = naughty.widget.message,
- text = n.message,
- font = 'JetBrainsMono Nerd Font, Regular 8',
- halign = 'left',
- valign = 'center',
- },
- widget = wibox.container.constraint,
- strategy = 'exact',
- height = dpi(128),
- },
- spacing = dpi(15),
- layout = wibox.layout.fixed.horizontal,
- },
- },
- widget = wibox.container.margin,
- margins = dpi(15),
- },
- bg = '#212121',
- border_color = '#414141',
- border_width = dpi(2),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- widget = wibox.container.background,
- },
- widget = wibox.container.constraint,
- strategy = 'exact',
- width = dpi(600),
- },
- }) ]=]
end
end)
--[[
diff --git a/awesome/src/core/rules.lua b/awesome/src/core/rules.lua
index a5f2f48..51050e5 100644
--- a/awesome/src/core/rules.lua
+++ b/awesome/src/core/rules.lua
@@ -6,6 +6,8 @@
local aclient = require('awful.client')
local aplacement = require('awful.placement')
local ascreen = require('awful.screen')
+local beautiful = require('beautiful')
+local dpi = require('beautiful').xresources.apply_dpi
local ruled = require('ruled')
local config = require('src.tools.config')
@@ -16,8 +18,8 @@ ruled.client.connect_signal('request::rules', function()
ruled.client.append_rule {
rule = {},
properties = {
- border_width = Theme.border_width,
- border_color = Theme.border_normal,
+ border_width = dpi(2),
+ border_color = beautiful.colorscheme.border_color,
maximized = false,
maximized_horizontal = false,
maximized_vertical = false,
diff --git a/awesome/src/core/setup.lua b/awesome/src/core/setup.lua
index 75d444c..8c42797 100644
--- a/awesome/src/core/setup.lua
+++ b/awesome/src/core/setup.lua
@@ -7,12 +7,13 @@ local aplacement = require('awful.placement')
local apopup = require('awful.popup')
local aspawn = require('awful.spawn')
local atooltip = require('awful.tooltip')
-local awidget = require('awful.widget')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gtable = require('gears.table')
local wibox = require('wibox')
local gfilesystem = require('gears.filesystem')
+local inputwidget = require('src.modules.inputbox')
--Own Libs
local toggle_button = require('awful.widget.toggle_widget')
@@ -147,11 +148,10 @@ end
--- The second page, with a list of wallpapers to choose from
function setup:wallpaper_page()
- local path_promt = awidget.inputbox {
- hint_text = 'Path to image...',
- halign = 'left',
- valign = 'center',
- font = 'JetBrainsMono Regular 12',
+ local path_promt = inputwidget {
+ text_hint = 'Path to image...',
+ mouse_focus = true,
+ font = 'JetBrainsMono Nerd Font 12 Regular',
}
local widget = wibox.widget {
@@ -164,7 +164,7 @@ function setup:wallpaper_page()
image = assets_dir .. 'space.jpg',
valign = 'center',
halign = 'center',
- clip_shape = Theme_config.setup.wallpaper.clip_shape,
+ clip_shape = beautiful.shape[12],
id = 'wallpaper',
},
widget = wibox.container.constraint,
@@ -203,9 +203,9 @@ function setup:wallpaper_page()
layout = wibox.layout.fixed.horizontal,
},
widget = wibox.container.background,
- bg = Theme_config.setup.wallpaper.button_bg,
- fg = Theme_config.setup.wallpaper.button_fg,
- shape = Theme_config.setup.wallpaper.button_shape,
+ bg = beautiful.colorscheme.bg_yellow,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[12],
id = 'choose_image',
},
widget = wibox.container.constraint,
@@ -223,7 +223,7 @@ function setup:wallpaper_page()
nil,
{ -- Text
{
- path_promt,
+ path_promt.widget,
widget = wibox.container.constraint,
width = dpi(600),
height = dpi(50),
@@ -242,14 +242,14 @@ function setup:wallpaper_page()
},
widget = wibox.container.background,
bg = gcolor.transparent,
- fg = Theme_config.setup.wallpaper.close_fg,
+ fg = beautiful.colorscheme.bg_red,
},
layout = wibox.layout.align.horizontal,
},
widget = wibox.container.background,
- bg = Theme_config.setup.wallpaper.path_bg,
- fg = Theme_config.setup.wallpaper.path_fg,
- shape = Theme_config.setup.wallpaper.path_shape,
+ bg = beautiful.colorscheme.bg1,
+ fg = beautiful.colorscheme.fg,
+ shape = beautiful.shape[12],
},
widget = wibox.container.constraint,
width = dpi(600),
@@ -309,7 +309,7 @@ local function get_widgets()
for _, widget in pairs(widget_list) do
local tb = toggle_button {
size = dpi(30),
- color = Theme_config.setup.bar.widget_toggle_color,
+ color = beautiful.colorscheme.bg_blue,
}
local w = wibox.widget {
@@ -321,17 +321,17 @@ local function get_widgets()
text = widget,
halign = 'left',
valign = 'center',
- font = User_config.font.specify .. ' Regular, 10',
+ font = beautiful.user_config.font,
},
widget = wibox.container.margin,
margins = dpi(5),
},
widget = wibox.widget.background,
- bg = Theme_config.setup.bar.widget_bg,
- fg = Theme_config.setup.bar.widget_fg,
- shape = Theme_config.setup.bar.widget_shape,
- border_color = Theme_config.setup.bar.widget_border_color,
- border_width = Theme_config.setup.bar.widget_border_width,
+ bg = beautiful.colorscheme.bg1,
+ fg = beautiful.colorscheme.fg,
+ shape = beautiful.shape[8],
+ border_color = beautiful.colorscheme.bg2,
+ border_width = dpi(2),
},
{
tb,
@@ -371,9 +371,9 @@ function setup:bar_page()
widget = wibox.widget.checkbox,
checked = true,
id = 'topbar_checkbox',
- shape = Theme_config.setup.bar.shape,
- color = Theme_config.setup.bar.color,
- padding = Theme_config.setup.bar.padding,
+ shape = gshape.circle,
+ color = beautiful.colorscheme.bg_green,
+ padding = dpi(4),
},
widget = wibox.container.constraint,
width = 30,
@@ -389,7 +389,7 @@ function setup:bar_page()
widget = wibox.widget.imagebox,
image = '/home/crylia/Downloads/2022-12-08_23-19.png', --icon_dir .. "topbar.svg",
resize = true,
- clip_shape = Theme_config.setup.bar.bar_image_shape,
+ clip_shape = beautiful.shape[4],
halign = 'center',
valign = 'center',
},
@@ -430,9 +430,9 @@ function setup:bar_page()
margins = dpi(10),
},
widget = wibox.container.background,
- border_color = Theme_config.setup.bar.border_color,
- border_width = Theme_config.setup.bar.border_width,
- shape = Theme_config.setup.bar.bar_shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[8],
},
{
{
@@ -457,9 +457,9 @@ function setup:bar_page()
margins = dpi(10),
},
widget = wibox.container.background,
- border_color = Theme_config.setup.bar.border_color,
- border_width = Theme_config.setup.bar.border_width,
- shape = Theme_config.setup.bar.bar_shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[8],
},
{
{
@@ -484,9 +484,9 @@ function setup:bar_page()
margins = dpi(10),
},
widget = wibox.container.background,
- border_color = Theme_config.setup.bar.border_color,
- border_width = Theme_config.setup.bar.border_width,
- shape = Theme_config.setup.bar.bar_shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[8],
},
expand = 'none',
forced_width = dpi(capi.screen.primary.geometry.width * 0.6) * 0.4,
@@ -538,9 +538,9 @@ function setup:bar_page()
margins = dpi(10),
},
widget = wibox.container.background,
- border_color = Theme_config.setup.bar.border_color,
- border_width = Theme_config.setup.bar.border_width,
- shape = Theme_config.setup.bar.bar_shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[8],
},
{
{
@@ -565,9 +565,9 @@ function setup:bar_page()
margins = dpi(10),
},
widget = wibox.container.background,
- border_color = Theme_config.setup.bar.border_color,
- border_width = Theme_config.setup.bar.border_width,
- shape = Theme_config.setup.bar.bar_shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[8],
},
{
{
@@ -592,9 +592,9 @@ function setup:bar_page()
margins = dpi(10),
},
widget = wibox.container.background,
- border_color = Theme_config.setup.bar.border_color,
- border_width = Theme_config.setup.bar.border_width,
- shape = Theme_config.setup.bar.bar_shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[8],
},
expand = 'none',
forced_width = dpi(capi.screen.primary.geometry.width * 0.6) * 0.4,
@@ -616,9 +616,9 @@ function setup:bar_page()
widget = wibox.widget.checkbox,
checked = false,
id = 'bottombar_checkbox',
- shape = Theme_config.setup.bar.shape,
- color = Theme_config.setup.bar.color,
- padding = Theme_config.setup.bar.padding,
+ shape = gshape.circle,
+ color = beautiful.colorscheme.bg_green,
+ padding = dpi(4),
},
widget = wibox.container.constraint,
width = 30,
@@ -634,7 +634,7 @@ function setup:bar_page()
widget = wibox.widget.imagebox,
image = '/home/crylia/Downloads/2022-12-08_23-19.png', --icon_dir .. "topbar.svg",
resize = true,
- clip_shape = Theme_config.setup.bar.bar_image_shape,
+ clip_shape = beautiful.shape[4],
halign = 'center',
valign = 'center',
},
@@ -664,7 +664,7 @@ function setup:bar_page()
},
{
widget = wibox.container.background,
- bg = gcolor('#212121BB'),
+ bg = beautiful.colorscheme.bg .. 'BB',
id = 'bottom_overlay',
},
layout = wibox.layout.stack,
@@ -687,9 +687,9 @@ function setup:bar_page()
bottom_checkbox.checked = not top_checkbox.checked
if top_checkbox.checked then
top_overlay.bg = gcolor.transparent
- bottom_overlay.bg = gcolor('#212121BB')
+ bottom_overlay.bg = beautiful.colorscheme.bg .. 'BB'
else
- top_overlay.bg = gcolor('#212121BB')
+ top_overlay.bg = beautiful.colorscheme.bg .. 'BB'
bottom_overlay.bg = gcolor.transparent
end
end
@@ -701,11 +701,11 @@ function setup:bar_page()
bottom_checkbox.checked = not bottom_checkbox.checked
top_checkbox.checked = not bottom_checkbox.checked
if bottom_checkbox.checked then
- top_overlay.bg = gcolor('#212121BB')
+ top_overlay.bg = beautiful.colorscheme.bg .. 'BB'
bottom_overlay.bg = gcolor.transparent
else
top_overlay.bg = gcolor.transparent
- bottom_overlay.bg = gcolor('#212121BB')
+ bottom_overlay.bg = beautiful.colorscheme.bg .. 'BB'
end
end
)
@@ -733,7 +733,7 @@ local function get_status_bars()
for i, widget in pairs(statusbar_list) do
local tb = toggle_button {
size = dpi(30),
- color = Theme_config.setup.bar.widget_toggle_color,
+ color = beautiful.colorscheme.bg_blue,
}
local w = wibox.widget {
@@ -744,7 +744,7 @@ local function get_status_bars()
text = widget,
halign = 'left',
valign = 'center',
- font = User_config.font.specify .. ' Regular, 14',
+ font = beautiful.user_config.font .. ' Regular, 14',
},
widget = wibox.container.margin,
margins = dpi(5),
@@ -770,15 +770,15 @@ end
--- The fourth page, to customize the notification center
function setup:notification_page()
local secrets = {
- api_key = awidget.inputbox {
- hint_text = 'API Key...',
- valign = 'center',
- halign = 'left',
+ api_key = inputwidget {
+ text_hint = 'API Key...',
+ font = 'JetBrainsMono Nerd Font 12 Regular',
+ mouse_focus = true,
},
- city_id = awidget.inputbox {
- hint_text = 'City ID...',
- valign = 'center',
- halign = 'left',
+ city_id = inputwidget {
+ text_hint = 'City ID...',
+ font = 'JetBrainsMono Nerd Font 12 Regular',
+ mouse_focus = true,
},
}
@@ -788,7 +788,7 @@ function setup:notification_page()
{
widget = wibox.widget.textbox,
text = 'Notification Center Setup',
- font = User_config.font.specify .. ' Regular, 24',
+ font = beautiful.user_config.font .. ' Regular 24',
halign = 'center',
valign = 'center',
},
@@ -801,7 +801,7 @@ function setup:notification_page()
{
widget = wibox.widget.textbox,
text = 'Status bars',
- font = User_config.font.specify .. ' Regular, 16',
+ font = beautiful.user_config.font .. ' Regular 16',
halign = 'center',
},
widget = wibox.container.margin,
@@ -834,7 +834,7 @@ function setup:notification_page()
{
widget = wibox.widget.textbox,
text = 'OpenWeatherMap API',
- font = User_config.font.specify .. ' Regular, 16',
+ font = beautiful.user_config.font .. ' Regular 16',
halign = 'center',
},
widget = wibox.container.margin,
@@ -860,7 +860,7 @@ function setup:notification_page()
{
widget = wibox.widget.textbox,
text = 'API Key',
- font = User_config.font.specify .. ' Regular, 16',
+ font = beautiful.user_config.font .. ' Regular 16',
halign = 'center',
valign = 'center',
},
@@ -869,7 +869,7 @@ function setup:notification_page()
},
{
{
- secrets.api_key,
+ secrets.api_key.widget,
widget = wibox.container.margin,
left = dpi(10),
},
@@ -877,9 +877,9 @@ function setup:notification_page()
forced_height = dpi(50),
forced_width = dpi(400),
widget = wibox.container.background,
- border_color = Theme_config.setup.notification.border_color,
- border_width = Theme_config.setup.notification.border_width,
- shape = Theme_config.setup.notification.shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
},
layout = wibox.layout.align.horizontal,
},
@@ -888,7 +888,7 @@ function setup:notification_page()
{
widget = wibox.widget.textbox,
text = 'City ID',
- font = User_config.font.specify .. ' Regular, 16',
+ font = beautiful.user_config.font .. ' Regular 16',
halign = 'center',
valign = 'center',
},
@@ -897,7 +897,7 @@ function setup:notification_page()
},
{
{
- secrets.city_id,
+ secrets.city_id.widget,
widget = wibox.container.margin,
left = dpi(10),
},
@@ -905,9 +905,9 @@ function setup:notification_page()
forced_height = dpi(50),
forced_width = dpi(400),
widget = wibox.container.background,
- border_color = Theme_config.setup.notification.border_color,
- border_width = Theme_config.setup.notification.border_width,
- shape = Theme_config.setup.notification.shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
},
layout = wibox.layout.align.horizontal,
},
@@ -921,9 +921,9 @@ function setup:notification_page()
{
widget = wibox.widget.checkbox,
checked = true,
- color = Theme_config.setup.notification.checkbox_color,
- paddings = Theme_config.setup.notification.checkbox_paddings,
- shape = Theme_config.setup.notification.checkbox_shape,
+ color = beautiful.colorscheme.green,
+ paddings = dpi(4),
+ shape = gshape.circle,
id = 'celsius_selector',
},
widget = wibox.container.constraint,
@@ -937,7 +937,7 @@ function setup:notification_page()
{
widget = wibox.widget.textbox,
text = 'Celsius °C',
- font = User_config.font.specify .. ' Regular, 14',
+ font = beautiful.user_config.font .. ' Regular 14',
halign = 'center',
valign = 'center',
},
@@ -950,9 +950,9 @@ function setup:notification_page()
{
widget = wibox.widget.checkbox,
checked = false,
- color = Theme_config.setup.notification.checkbox_color,
- paddings = Theme_config.setup.notification.checkbox_paddings,
- shape = Theme_config.setup.notification.checkbox_shape,
+ color = beautiful.colorscheme.green,
+ paddings = dpi(4),
+ shape = gshape.circle,
id = 'Fahrenheit_selector',
},
widget = wibox.container.constraint,
@@ -966,7 +966,7 @@ function setup:notification_page()
{
widget = wibox.widget.textbox,
text = 'Fahrenheit °F',
- font = User_config.font.specify .. ' Regular, 14',
+ font = beautiful.user_config.font .. ' Regular 14',
halign = 'center',
valign = 'center',
},
@@ -986,7 +986,7 @@ function setup:notification_page()
layout = wibox.layout.align.vertical,
},
spacing_widget = wibox.widget.separator {
- color = Theme_config.setup.notification.separator_color,
+ color = beautiful.colorscheme.bg1,
},
spacing = dpi(5),
layout = wibox.layout.flex.horizontal,
@@ -1072,14 +1072,14 @@ end
--- The fifth page, to customize the default programs
function setup:programs_page()
local applications = {
- power_manager = awidget.inputbox { hint_text = 'e.g. xfce4-power-manager-settings' },
- web_browser = awidget.inputbox { hint_text = 'e.g. firefox' },
- terminal = awidget.inputbox { hint_text = 'e.g. kitty' },
- text_editor = awidget.inputbox { hint_text = 'e.g. code' },
- music_player = awidget.inputbox { hint_text = 'e.g. flatpak run com.spotify.Client' },
- gtk_settings = awidget.inputbox { hint_text = 'e.g. lxappearance' },
- file_manager = awidget.inputbox { hint_text = 'e.g. nautilus' },
- screen_manager = awidget.inputbox { hint_text = 'e.g. arandr' },
+ power_manager = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. xfce4-power-manager-settings' },
+ web_browser = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. firefox' },
+ terminal = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. kitty' },
+ text_editor = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. code' },
+ music_player = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. flatpak run com.spotify.Client' },
+ gtk_settings = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. lxappearance' },
+ file_manager = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. nautilus' },
+ screen_manager = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. arandr' },
}
local widget = wibox.widget {
@@ -1088,7 +1088,7 @@ function setup:programs_page()
{
widget = wibox.widget.textbox,
text = 'Default Applications',
- font = User_config.font.specify .. ' Regular, 24',
+ font = beautiful.user_config.font .. ' Regular 24',
halign = 'center',
valign = 'center',
},
@@ -1103,7 +1103,7 @@ function setup:programs_page()
{
widget = wibox.widget.textbox,
text = 'Power Manager',
- font = User_config.font.specify .. ' Regular, 14',
+ font = beautiful.user_config.font .. ' Regular 14',
halign = 'center',
valign = 'center',
},
@@ -1113,7 +1113,7 @@ function setup:programs_page()
nil,
{
{
- applications.power_manager,
+ applications.power_manager.widget,
widget = wibox.container.margin,
left = dpi(10),
},
@@ -1121,9 +1121,9 @@ function setup:programs_page()
forced_height = dpi(50),
forced_width = dpi(350),
widget = wibox.container.background,
- border_color = Theme_config.setup.notification.border_color,
- border_width = Theme_config.setup.notification.border_width,
- shape = Theme_config.setup.notification.shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
},
expand = 'none',
layout = wibox.layout.align.horizontal,
@@ -1133,7 +1133,7 @@ function setup:programs_page()
{
widget = wibox.widget.textbox,
text = 'Web Browser',
- font = User_config.font.specify .. ' Regular, 14',
+ font = beautiful.user_config.font .. ' Regular 14',
halign = 'center',
valign = 'center',
},
@@ -1143,7 +1143,7 @@ function setup:programs_page()
nil,
{
{
- applications.web_browser,
+ applications.web_browser.widget,
widget = wibox.container.margin,
left = dpi(10),
},
@@ -1151,9 +1151,9 @@ function setup:programs_page()
forced_height = dpi(50),
forced_width = dpi(350),
widget = wibox.container.background,
- border_color = Theme_config.setup.notification.border_color,
- border_width = Theme_config.setup.notification.border_width,
- shape = Theme_config.setup.notification.shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
},
expand = 'none',
layout = wibox.layout.align.horizontal,
@@ -1163,7 +1163,7 @@ function setup:programs_page()
{
widget = wibox.widget.textbox,
text = 'Terminal',
- font = User_config.font.specify .. ' Regular, 14',
+ font = beautiful.user_config.font .. ' Regular 14',
halign = 'center',
valign = 'center',
},
@@ -1173,7 +1173,7 @@ function setup:programs_page()
nil,
{
{
- applications.terminal,
+ applications.terminal.widget,
widget = wibox.container.margin,
left = dpi(10),
},
@@ -1181,9 +1181,9 @@ function setup:programs_page()
forced_height = dpi(50),
forced_width = dpi(350),
widget = wibox.container.background,
- border_color = Theme_config.setup.notification.border_color,
- border_width = Theme_config.setup.notification.border_width,
- shape = Theme_config.setup.notification.shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
},
expand = 'none',
layout = wibox.layout.align.horizontal,
@@ -1193,7 +1193,7 @@ function setup:programs_page()
{
widget = wibox.widget.textbox,
text = 'Text Editor',
- font = User_config.font.specify .. ' Regular, 14',
+ font = beautiful.user_config.font .. ' Regular 14',
halign = 'center',
valign = 'center',
},
@@ -1203,7 +1203,7 @@ function setup:programs_page()
nil,
{
{
- applications.text_editor,
+ applications.text_editor.widget,
widget = wibox.container.margin,
left = dpi(10),
},
@@ -1211,9 +1211,9 @@ function setup:programs_page()
forced_height = dpi(50),
forced_width = dpi(350),
widget = wibox.container.background,
- border_color = Theme_config.setup.notification.border_color,
- border_width = Theme_config.setup.notification.border_width,
- shape = Theme_config.setup.notification.shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
},
expand = 'none',
layout = wibox.layout.align.horizontal,
@@ -1232,7 +1232,7 @@ function setup:programs_page()
{
widget = wibox.widget.textbox,
text = 'Music Player',
- font = User_config.font.specify .. ' Regular, 14',
+ font = beautiful.user_config.font .. ' Regular 14',
halign = 'center',
valign = 'center',
},
@@ -1242,7 +1242,7 @@ function setup:programs_page()
nil,
{
{
- applications.music_player,
+ applications.music_player.widget,
widget = wibox.container.margin,
left = dpi(10),
},
@@ -1250,9 +1250,9 @@ function setup:programs_page()
forced_height = dpi(50),
forced_width = dpi(350),
widget = wibox.container.background,
- border_color = Theme_config.setup.notification.border_color,
- border_width = Theme_config.setup.notification.border_width,
- shape = Theme_config.setup.notification.shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
},
expand = 'none',
layout = wibox.layout.align.horizontal,
@@ -1262,7 +1262,7 @@ function setup:programs_page()
{
widget = wibox.widget.textbox,
text = 'GTK Settings',
- font = User_config.font.specify .. ' Regular, 14',
+ font = beautiful.user_config.font .. ' Regular 14',
halign = 'center',
valign = 'center',
},
@@ -1272,7 +1272,7 @@ function setup:programs_page()
nil,
{
{
- applications.gtk_settings,
+ applications.gtk_settings.widget,
widget = wibox.container.margin,
left = dpi(10),
},
@@ -1280,9 +1280,9 @@ function setup:programs_page()
forced_height = dpi(50),
forced_width = dpi(350),
widget = wibox.container.background,
- border_color = Theme_config.setup.notification.border_color,
- border_width = Theme_config.setup.notification.border_width,
- shape = Theme_config.setup.notification.shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
},
expand = 'none',
layout = wibox.layout.align.horizontal,
@@ -1292,7 +1292,7 @@ function setup:programs_page()
{
widget = wibox.widget.textbox,
text = 'File Manager',
- font = User_config.font.specify .. ' Regular, 14',
+ font = beautiful.user_config.font .. ' Regular 14',
halign = 'center',
valign = 'center',
},
@@ -1302,7 +1302,7 @@ function setup:programs_page()
nil,
{
{
- applications.file_manager,
+ applications.file_manager.widget,
widget = wibox.container.margin,
left = dpi(10),
},
@@ -1310,9 +1310,9 @@ function setup:programs_page()
forced_height = dpi(50),
forced_width = dpi(350),
widget = wibox.container.background,
- border_color = Theme_config.setup.notification.border_color,
- border_width = Theme_config.setup.notification.border_width,
- shape = Theme_config.setup.notification.shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
},
expand = 'none',
layout = wibox.layout.align.horizontal,
@@ -1322,7 +1322,7 @@ function setup:programs_page()
{
widget = wibox.widget.textbox,
text = 'Screen Manager',
- font = User_config.font.specify .. ' Regular, 14',
+ font = beautiful.user_config.font .. ' Regular 14',
halign = 'center',
valign = 'center',
},
@@ -1332,7 +1332,7 @@ function setup:programs_page()
nil,
{
{
- applications.screen_manager,
+ applications.screen_manager.widget,
widget = wibox.container.margin,
left = dpi(10),
},
@@ -1340,9 +1340,9 @@ function setup:programs_page()
forced_height = dpi(50),
forced_width = dpi(350),
widget = wibox.container.background,
- border_color = Theme_config.setup.notification.border_color,
- border_width = Theme_config.setup.notification.border_width,
- shape = Theme_config.setup.notification.shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
},
expand = 'none',
layout = wibox.layout.align.horizontal,
@@ -1455,22 +1455,22 @@ end
local function get_layouts()
local layouts = {
- ['cornerne'] = Theme.layout_cornerne,
- ['cornernw'] = Theme.layout_cornernw,
- ['cornerse'] = Theme.layout_cornerse,
- ['cornersw'] = Theme.layout_cornersw,
- ['dwindle'] = Theme.layout_dwindle,
- ['fairh'] = Theme.layout_fairh,
- ['fairv'] = Theme.layout_fairv,
- ['floating'] = Theme.layout_floating,
- ['fullscreen'] = Theme.layout_fullscreen,
- ['magnifier'] = Theme.layout_magnifier,
- ['max'] = Theme.layout_max,
- ['spiral'] = Theme.layout_spiral,
- ['tile bottom'] = Theme.layout_cornerse,
- ['tile left'] = Theme.layout_cornernw,
- ['tile top'] = Theme.layout_cornersw,
- ['tile'] = Theme.layout_cornerne,
+ ['cornerne'] = beautiful.theme.layout_cornerne,
+ ['cornernw'] = beautiful.theme.layout_cornernw,
+ ['cornerse'] = beautiful.theme.layout_cornerse,
+ ['cornersw'] = beautiful.theme.layout_cornersw,
+ ['dwindle'] = beautiful.theme.layout_dwindle,
+ ['fairh'] = beautiful.theme.layout_fairh,
+ ['fairv'] = beautiful.theme.layout_fairv,
+ ['floating'] = beautiful.theme.layout_floating,
+ ['fullscreen'] = beautiful.theme.layout_fullscreen,
+ ['magnifier'] = beautiful.theme.layout_magnifier,
+ ['max'] = beautiful.theme.layout_max,
+ ['spiral'] = beautiful.theme.layout_spiral,
+ ['tile bottom'] = beautiful.theme.layout_cornerse,
+ ['tile left'] = beautiful.theme.layout_cornernw,
+ ['tile top'] = beautiful.theme.layout_cornersw,
+ ['tile'] = beautiful.theme.layout_cornerne,
}
local list = {}
@@ -1493,27 +1493,27 @@ local function get_layouts()
margins = dpi(10),
widget = wibox.container.margin,
},
- bg = Theme_config.setup.layout.bg,
- shape = Theme_config.setup.layout.shape,
+ bg = beautiful.colorscheme.bg_red,
+ shape = beautiful.shape[8],
widget = wibox.container.background,
},
margins = dpi(10),
widget = wibox.container.margin,
},
widget = wibox.container.background,
- border_color = Theme_config.setup.layout.border_color,
- border_width = Theme_config.setup.layout.border_width,
- shape = Theme_config.setup.layout.shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[8],
selected = false,
}
w:buttons(gtable.join {
abutton({}, 1, function()
if w.selected then
- w.border_color = Theme_config.setup.layout.border_color
+ w.border_color = beautiful.colorscheme.bg1
w.selected = false
else
- w.border_color = Theme_config.setup.layout.border_color_selected
+ w.border_color = beautiful.colorscheme.bg_red
w.selected = true
end
end),
@@ -1546,7 +1546,7 @@ function setup:layouts_page()
{
widget = wibox.widget.textbox,
text = 'Layouts',
- font = User_config.font.specify .. ' Regular, 24',
+ font = beautiful.user_config.font .. ' Regular, 24',
halign = 'center',
valign = 'center',
},
@@ -1614,7 +1614,7 @@ function setup:titlebar_page()
{
widget = wibox.widget.textbox,
text = 'Layouts',
- font = User_config.font.specify .. ' Regular, 24',
+ font = beautiful.user_config.font .. ' Regular, 24',
halign = 'center',
valign = 'center',
},
@@ -1631,9 +1631,9 @@ function setup:titlebar_page()
widget = wibox.widget.checkbox,
checked = true,
id = 'top_tb_radio',
- shape = Theme_config.setup.titlebar.checkbox_shape,
- color = Theme_config.setup.titlebar.checkbox_color,
- paddings = Theme_config.setup.titlebar.checkbox_padding,
+ shape = gshape.circle,
+ color = beautiful.colorscheme.bg_teal,
+ paddings = dpi(4),
},
width = dpi(45),
height = dpi(45),
@@ -1667,9 +1667,9 @@ function setup:titlebar_page()
widget = wibox.widget.checkbox,
checked = false,
id = 'left_tb_radio',
- shape = Theme_config.setup.titlebar.checkbox_shape,
- color = Theme_config.setup.titlebar.checkbox_color,
- paddings = Theme_config.setup.titlebar.checkbox_padding,
+ shape = gshape.circle,
+ color = beautiful.colorscheme.bg_teal,
+ paddings = dpi(4),
},
width = dpi(45),
height = dpi(45),
@@ -1716,7 +1716,7 @@ function setup:titlebar_page()
layout = wibox.layout.flex.vertical,
},
spacing_widget = wibox.widget.separator {
- color = Theme_config.setup.titlebar.seperator_color,
+ color = beautiful.colorscheme.bg1,
},
spacing = dpi(5),
layout = wibox.layout.flex.horizontal,
@@ -1805,7 +1805,7 @@ function setup.new(args)
},
widget = wibox.container.background,
id = 'page_left',
- bg = Theme_config.setup.bg .. '88',
+ bg = beautiful.colorscheme.bg .. '88',
},
widget = wibox.container.constraint,
width = dpi(64),
@@ -1826,7 +1826,7 @@ function setup.new(args)
},
widget = wibox.container.background,
id = 'page_right',
- bg = Theme_config.setup.bg .. '88',
+ bg = beautiful.colorscheme.bg .. '88',
},
widget = wibox.container.constraint,
width = dpi(64),
@@ -1858,9 +1858,9 @@ function setup.new(args)
strategy = 'exact',
},
screen = screen,
- bg = Theme_config.setup.bg,
- border_color = Theme_config.setup.border_color,
- border_width = Theme_config.setup.border_width,
+ bg = beautiful.colorscheme.bg,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
placement = aplacement.centered,
ontop = false, -- !CHANGE THIS TO TRUE WHEN DONE TESTING!
visible = true,
diff --git a/awesome/src/core/titlebar.lua b/awesome/src/core/titlebar.lua
index 23cba12..736c4d5 100644
--- a/awesome/src/core/titlebar.lua
+++ b/awesome/src/core/titlebar.lua
@@ -4,6 +4,7 @@ local math = math
local abutton = require('awful.button')
local atitlebar = require('awful.titlebar')
local atooltip = require('awful.tooltip')
+local beautiful = require('beautiful')
local cairo = require('lgi').cairo
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
@@ -26,7 +27,7 @@ local instance = nil
local titlebar = {}
-local titlebar_position = User_config.titlebar_position
+local titlebar_position = beautiful.user_config.titlebar_position
-- Converts the given hex color to hsv
local function hex2hsv(color)
@@ -229,12 +230,12 @@ end
local function create_button_image(name, is_focused, event, is_on)
titlebar.key = titlebar.key or {}
- titlebar.key.close_color = Theme_config.titlebar.close
- titlebar.key.minimize_color = Theme_config.titlebar.minimize
- titlebar.key.maximize_color = Theme_config.titlebar.maximize
- titlebar.key.floating_color = Theme_config.titlebar.floating
- titlebar.key.ontop_color = Theme_config.titlebar.ontop
- titlebar.key.sticky_color = Theme_config.titlebar.sticky
+ titlebar.key.close_color = beautiful.colorscheme.bg_red
+ titlebar.key.minimize_color = beautiful.colorscheme.bg_yellow
+ titlebar.key.maximize_color = beautiful.colorscheme.bg_green
+ titlebar.key.floating_color = beautiful.colorscheme.bg_purple
+ titlebar.key.ontop_color = beautiful.colorscheme.bg_purple
+ titlebar.key.sticky_color = beautiful.colorscheme.bg_purple
local focus_state = is_focused and 'focused' or 'unfocused'
local key_img
@@ -259,11 +260,11 @@ local function create_button_image(name, is_focused, event, is_on)
(event == 'press') and darken(button_color, 25) or button_color
titlebar.key[key_color] = button_color
end
- local button_size = Theme_config.titlebar.button_size
+ local button_size = dpi(18)
local surface = cairo.ImageSurface.create('ARGB32', button_size, button_size)
local cr = cairo.Context.create(surface)
cr:arc(button_size / 2, button_size / 2, button_size / 2, math.rad(0), math.rad(360))
- cr:set_source_rgba(gcolor.parse_color(titlebar.key[key_color] or '#fefefa'))
+ cr:set_source_rgba(gcolor.parse_color(titlebar.key[key_color] or beautiful.colorscheme.fg))
cr.antialias = cairo.Antialias.BEST
cr:fill()
titlebar.key[key_img] = surface
@@ -332,8 +333,8 @@ local function create_titlebar_button(c, name, button_callback, property)
{
button_img,
widget = wibox.container.constraint,
- height = Theme_config.titlebar.button_size,
- width = Theme_config.titlebar.button_size,
+ height = dpi(18),
+ width = dpi(18),
strategy = 'exact',
},
widget = wibox.container.margin,
@@ -387,8 +388,8 @@ local function create_titlebar_title(c)
local function update()
title_widget.markup = ("%s"):format(
- (((relative_luminance('#fefefa') + 0.05) / (relative_luminance(c.color) + 0.05)) >= 7 and true)
- and '#fefefa' or '#242424', c.name)
+ (((relative_luminance(beautiful.colorscheme.fg) + 0.05) / (relative_luminance(c.color) + 0.05)) >= 7 and true)
+ and beautiful.colorscheme.fg or beautiful.colorscheme.bg, c.name)
end
c:connect_signal('property::name', update)
@@ -400,7 +401,7 @@ local function create_titlebar_title(c)
return {
title_widget,
widget = wibox.container.margin,
- margins = Theme_config.titlebar.title_margin,
+ margins = dpi(5),
}
end
@@ -501,23 +502,23 @@ end
function add_titlebar(c)
if titlebar_position == 'top' then
atitlebar(c, {
- size = Theme_config.titlebar.size,
+ size = dpi(38),
bg = gcolor.transparent,
position = 'top',
}):setup {
{
{
- create_titlebar_items(c, User_config.titlebar_items.left_and_bottom),
+ create_titlebar_items(c, beautiful.user_config.titlebar_items.left_and_bottom),
widget = wibox.container.margin,
left = dpi(5),
},
{
- create_titlebar_items(c, User_config.titlebar_items.middle),
+ create_titlebar_items(c, beautiful.user_config.titlebar_items.middle),
buttons = get_titlebar_mouse_bindings(c),
layout = wibox.layout.flex.horizontal,
},
{
- create_titlebar_items(c, User_config.titlebar_items.right_and_top),
+ create_titlebar_items(c, beautiful.user_config.titlebar_items.right_and_top),
widget = wibox.container.margin,
right = dpi(5),
},
@@ -527,30 +528,30 @@ function add_titlebar(c)
bg = duotone_gradient_vertical(
lighten(c.color, 1),
c.color,
- Theme_config.titlebar.size,
+ dpi(38),
0,
0.5
),
}
elseif titlebar_position == 'left' then
atitlebar(c, {
- size = Theme_config.titlebar.size,
+ size = dpi(38),
bg = gcolor.transparent,
position = 'left',
}):setup {
{
{
- create_titlebar_items(c, User_config.titlebar_items.right_and_top),
+ create_titlebar_items(c, beautiful.user_config.titlebar_items.right_and_top),
widget = wibox.container.margin,
top = dpi(5),
},
{
- create_titlebar_items(c, User_config.titlebar_items.middle),
+ create_titlebar_items(c, beautiful.user_config.titlebar_items.middle),
buttons = get_titlebar_mouse_bindings(c),
layout = wibox.layout.flex.vertical,
},
{
- create_titlebar_items(c, User_config.titlebar_items.left_and_bottom),
+ create_titlebar_items(c, beautiful.user_config.titlebar_items.left_and_bottom),
widget = wibox.container.margin,
left = dpi(5),
},
@@ -560,7 +561,7 @@ function add_titlebar(c)
bg = duotone_gradient_horizontal(
lighten(c.color, 1),
c.color,
- Theme_config.titlebar.size,
+ dpi(38),
0,
0.5
),
@@ -608,7 +609,7 @@ if not instance then
c.color = color
add_titlebar(c)
else
- c.color = Theme_config.titlebar.color
+ c.color = beautiful.colorscheme.bg
add_titlebar(c)
c:connect_signal('request::activate', c._cb_add_window_decorations)
end
diff --git a/awesome/src/lib/dbus_proxy b/awesome/src/lib/dbus_proxy
deleted file mode 160000
index c9253bd..0000000
--- a/awesome/src/lib/dbus_proxy
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit c9253bde3fa5a64261953d1b196c57fabf9f8561
diff --git a/awesome/src/modules/application_launcher/application.lua b/awesome/src/modules/application_launcher/application.lua
index 91f5893..88a7774 100644
--- a/awesome/src/modules/application_launcher/application.lua
+++ b/awesome/src/modules/application_launcher/application.lua
@@ -6,6 +6,7 @@
local abutton = require('awful.button')
local aspawn = require('awful.spawn')
local base = require('wibox.widget.base')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears').filesystem
@@ -13,14 +14,12 @@ local Gio = require('lgi').Gio
local gtable = require('gears.table')
local wibox = require('wibox')
--- Third party libs
-
-local cm = require('src.modules.context_menu.init')
-local dock = require('src.modules.crylia_bar.dock')
-
-- Local libs
local config = require('src.tools.config')
local hover = require('src.tools.hover')
+local cm = require('src.modules.context_menu.init')
+local dock = require('src.modules.crylia_bar.dock')
+local icon_lookup = require('src.tools.gio_icon_lookup')()
local capi = {
awesome = awesome,
@@ -132,8 +131,8 @@ local function get_applications_from_file()
{ -- Icon
valign = 'center',
halign = 'center',
- image = Get_gicon_path(app_info.get_icon(app)) or
- Get_gicon_path(app_info.get_icon(app),
+ image = icon_lookup:get_gicon_path(app_info.get_icon(app)) or
+ icon_lookup:get_gicon_path(app_info.get_icon(app),
Gio.DesktopAppInfo.get_string(desktop_app_info, 'X-AppImage-Old-Icon')) or '',
resize = true,
widget = wibox.widget.imagebox,
@@ -173,11 +172,11 @@ local function get_applications_from_file()
terminal = Gio.DesktopAppInfo.get_string(desktop_app_info, 'Terminal') == 'true',
actions = Gio.DesktopAppInfo.list_actions(desktop_app_info),
desktop_file = Gio.DesktopAppInfo.get_filename(desktop_app_info) or '',
- border_color = Theme_config.application_launcher.application.border_color,
- border_width = Theme_config.application_launcher.application.border_width,
- bg = Theme_config.application_launcher.application.bg,
- fg = Theme_config.application_launcher.application.fg,
- shape = Theme_config.application_launcher.application.shape,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ bg = beautiful.colorscheme.bg1,
+ fg = beautiful.colorscheme.fg,
+ shape = beautiful.shape[4],
widget = wibox.container.background,
}
local context_menu = cm {
@@ -215,7 +214,7 @@ local function get_applications_from_file()
{
name = 'Execute as sudo',
icon = gcolor.recolor_image(icondir .. 'launch.svg',
- Theme_config.application_launcher.application.cm_icon_color),
+ beautiful.colorscheme.bg_purple),
callback = function()
capi.awesome.emit_signal('application_launcher::show')
aspawn('/home/crylia/.config/awesome/src/scripts/start_as_admin.sh ' .. app_widget.exec)
@@ -224,14 +223,14 @@ local function get_applications_from_file()
{
name = 'Pin to dock',
icon = gcolor.recolor_image(icondir .. 'pin.svg',
- Theme_config.application_launcher.application.cm_icon_color),
+ beautiful.colorscheme.bg_purple),
callback = function()
-- Open dock.js and read all its content into a table, add the new app into the table and write it back
--[[ async.read_json(gfilesystem.get_configuration_dir() .. 'src/config/dock.json', function(data)
table.insert(data, {
name = app_widget.name or '',
- icon = Get_gicon_path(app_info.get_icon(app)) or
- Get_gicon_path(app_info.get_icon(app),
+ icon = icon_lookup.get_gicon_path(app_info.get_icon(app)) or
+ icon_lookup.get_gicon_path(app_info.get_icon(app),
Gio.DesktopAppInfo.get_string(desktop_app_info, 'X-AppImage-Old-Icon')) or '',
comment = app_widget.comment or '',
exec = app_widget.exec or '',
@@ -254,12 +253,12 @@ local function get_applications_from_file()
{
name = 'Add to desktop',
icon = gcolor.recolor_image(icondir .. 'desktop.svg',
- Theme_config.application_launcher.application.cm_icon_color),
+ beautiful.colorscheme.bg_purple),
callback = function()
capi.awesome.emit_signal('application_launcher::show')
capi.awesome.emit_signal('desktop::add_to_desktop', {
label = app_info.get_name(app),
- icon = Get_gicon_path(app_info.get_icon(app)) or '',
+ icon = icon_lookup:get_gicon_path(app_info.get_icon(app)) or '',
exec = Gio.DesktopAppInfo.get_string(desktop_app_info, 'Exec'),
desktop_file = Gio.DesktopAppInfo.get_filename(desktop_app_info) or '',
})
@@ -372,9 +371,9 @@ function application_grid:set_applications(search_filter)
'update::selected',
function()
if self._private.curser.y == pos.row and self._private.curser.x == pos.col then
- app.border_color = Theme_config.application_launcher.application.border_color_active
+ app.border_color = beautiful.colorscheme.bg_purple
else
- app.border_color = Theme_config.application_launcher.application.border_color
+ app.border_color = beautiful.colorscheme.bg1
end
end
)
diff --git a/awesome/src/modules/application_launcher/init.lua b/awesome/src/modules/application_launcher/init.lua
index 2425b64..d5d28e4 100644
--- a/awesome/src/modules/application_launcher/init.lua
+++ b/awesome/src/modules/application_launcher/init.lua
@@ -8,12 +8,15 @@ local akeygrabber = require('awful.keygrabber')
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
local awidget = require('awful.widget')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears.table')
local wibox = require('wibox')
+local gtimer = require('gears.timer')
-- Own libs
local app_grid = require('src.modules.application_launcher.application')
+local input = require('src.modules.inputbox')
local capi = {
awesome = awesome,
@@ -29,10 +32,11 @@ function application_launcher.new(args)
args = args or {}
-- Create a new inputbox
- local searchbar = awidget.inputbox {
- hint_text = 'Search...',
- valign = 'center',
- halign = 'left',
+ local searchbar = input {
+ text_hint = 'Search...',
+ mouse_focus = true,
+ fg = beautiful.colorscheme.fg,
+ password_mode = true,
}
-- Application launcher popup
local application_container = apopup {
@@ -42,7 +46,12 @@ function application_launcher.new(args)
{
{
{
- searchbar,
+ {
+ searchbar.widget,
+ halign = 'left',
+ valign = 'center',
+ widget = wibox.container.place,
+ },
widget = wibox.container.margin,
margins = 5,
},
@@ -51,11 +60,11 @@ function application_launcher.new(args)
height = dpi(50),
},
widget = wibox.container.background,
- bg = Theme_config.application_launcher.searchbar.bg,
- fg = Theme_config.application_launcher.searchbar.fg,
- border_color = Theme_config.application_launcher.searchbar.border_color,
- border_width = Theme_config.application_launcher.searchbar.border_width,
- shape = Theme_config.application_launcher.searchbar.shape,
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.fg,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
id = 'searchbar_bg',
},
{
@@ -79,19 +88,19 @@ function application_launcher.new(args)
stretch = false,
screen = args.screen,
placement = aplacement.centered,
- bg = Theme_config.application_launcher.bg,
- border_color = Theme_config.application_launcher.border_color,
- border_width = Theme_config.application_launcher.border_width,
+ bg = beautiful.colorscheme.bg,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
}
- gtable.crush(application_container, application_launcher, true)
+ -- Delayed call to give the popup some time to evaluate its width
+ gtimer.delayed_call(function()
+ if application_container.width then
+ application_container.widget.width = application_container.width
+ end
+ end)
- -- Focus the searchbar when its left clicked
- searchbar:buttons(gtable.join {
- abutton({}, 1, function()
- searchbar:focus()
- end),
- })
+ gtable.crush(application_container, application_launcher, true)
--#region Hover signals to change the cursor to a text cursor
local old_cursor, old_wibox
@@ -119,7 +128,7 @@ function application_launcher.new(args)
application_container.visible = not application_container.visible
end
if application_container.visible then
- searchbar_bg.border_color = Theme_config.application_launcher.searchbar.border_active
+ searchbar_bg.border_color = beautiful.colorscheme.bg_blue
searchbar:focus()
else
searchbar:set_text('')
@@ -128,44 +137,41 @@ function application_launcher.new(args)
end
end)
- -- Execute the currently selected application, reset the searchbar and hide the launcher
- searchbar:connect_signal('submit', function(_, text)
- application_grid:execute()
- capi.awesome.emit_signal('application_launcher::show')
- searchbar:set_text('')
- application_grid:set_applications(searchbar:get_text())
- searchbar_bg.border_color = Theme_config.application_launcher.searchbar.border_color
- end)
-
-- Hide the application launcher when the keygrabber stops and reset the searchbar
- searchbar:connect_signal('stopped', function(_, stop_key)
+ searchbar:connect_signal('inputbox::stop', function(_, stop_key)
if stop_key == 'Escape' then
capi.awesome.emit_signal('application_launcher::show')
end
searchbar:set_text('')
application_grid:set_applications(searchbar:get_text())
- searchbar_bg.border_color = Theme_config.application_launcher.searchbar.border_color
+ searchbar_bg.border_color = beautiful.colorscheme.border_color
end)
-- When started change the background for the searchbar
- searchbar:connect_signal('started', function()
- searchbar_bg.border_color = Theme_config.application_launcher.searchbar.border_active
+ searchbar:connect_signal('inputbox::start', function()
+ searchbar_bg.border_color = beautiful.colorscheme.bg_blue
end)
-- On every keypress in the searchbar check for certain inputs
- searchbar:connect_signal('inputbox::key_pressed', function(_, modkey, key)
+ searchbar:connect_signal('inputbox::keypressed', function(_, modkey, key)
if key == 'Escape' then -- Escape to stop the keygrabber, hide the launcher and reset the searchbar
- searchbar:stop()
+ searchbar:unfocus()
capi.awesome.emit_signal('application_launcher::show')
application_grid:reset()
searchbar:set_text('')
- elseif key == 'Down' or key == 'Right' then --If down or right is pressed initiate the grid navigation
+ elseif key == 'Return' then
+ application_grid:execute()
+ capi.awesome.emit_signal('application_launcher::show')
+ searchbar:set_text('')
+ application_grid:set_applications(searchbar:get_text())
+ searchbar_bg.border_color = beautiful.colorscheme.border_color
+ elseif key == 'Down' then --If down or right is pressed initiate the grid navigation
if key == 'Down' then
application_grid:move_down()
elseif key == 'Right' then
application_grid:move_right()
end
- searchbar:stop()
+ searchbar:unfocus()
--New keygrabber to allow for key navigation
akeygrabber.run(function(mod, key2, event)
if event == 'press' then
@@ -197,7 +203,7 @@ function application_launcher.new(args)
end
end
end)
- searchbar_bg.border_color = Theme_config.application_launcher.searchbar.border_color
+ searchbar_bg.border_color = beautiful.colorscheme.border_color
end
-- Update the applications in the grid
application_grid:set_applications(searchbar:get_text())
diff --git a/awesome/src/modules/audio/audio_controller.lua b/awesome/src/modules/audio/audio_controller.lua
index 6dcb917..1b519fb 100644
--- a/awesome/src/modules/audio/audio_controller.lua
+++ b/awesome/src/modules/audio/audio_controller.lua
@@ -2,6 +2,7 @@
local abutton = require('awful.button')
local aspawn = require('awful.spawn')
local base = require('wibox.widget.base')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gshape = require('gears.shape')
@@ -70,11 +71,11 @@ function audio_controller:get_device_widget(device, name, device_type)
name = name:gsub('^%s*(.-)%s*$', '%1')
local icon_color, fg
if device_type == 'source' then
- icon_color = Theme_config.volume_controller.device_microphone_fg
- fg = Theme_config.volume_controller.device_microphone_fg
+ icon_color = beautiful.colorscheme.bg_blue
+ fg = beautiful.colorscheme.bg_blue
elseif device_type == 'sink' then
- icon_color = Theme_config.volume_controller.device_headphones_fg
- fg = Theme_config.volume_controller.device_headphones_fg
+ icon_color = beautiful.colorscheme.bg_purple
+ fg = beautiful.colorscheme.bg_purple
end
local device_widget = wibox.widget {
@@ -112,11 +113,11 @@ function audio_controller:get_device_widget(device, name, device_type)
margins = dpi(10),
widget = wibox.container.margin,
},
- bg = Theme_config.volume_controller.device_bg,
+ bg = beautiful.colorscheme.bg,
fg = fg,
- border_color = Theme_config.volume_controller.device_border_color,
- border_width = Theme_config.volume_controller.device_border_width,
- shape = Theme_config.volume_controller.device_shape,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
widget = wibox.container.background,
sink = device,
}
@@ -137,11 +138,11 @@ function audio_controller:get_device_widget(device, name, device_type)
self:connect_signal('AC::device_changed', function(new_sink)
if device_widget.device == new_sink then
- device_widget.bg = Theme_config.volume_controller.device_headphones_selected_bg
- device_widget.fg = Theme_config.volume_controller.device_headphones_selected_fg
- device_widget:get_children_by_id('icon')[1].image = gcolor.recolor_image(icondir .. 'volume-high.svg', Theme_config.volume_controller.device_headphones_selected_fg)
+ device_widget.bg = beautiful.colorscheme.bg_purple
+ device_widget.fg = beautiful.colorscheme.bg
+ device_widget:get_children_by_id('icon')[1].image = gcolor.recolor_image(icondir .. 'volume-high.svg', beautiful.colorscheme.bg)
else
- device_widget.bg = Theme_config.volume_controller.device_bg
+ device_widget.bg = beautiful.colorscheme.bg
device_widget.fg = fg
device_widget:get_children_by_id('icon')[1].image = gcolor.recolor_image(icondir .. 'volume-high.svg', icon_color)
end
@@ -198,7 +199,7 @@ function audio_controller.new()
{
resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg',
- Theme_config.volume_controller.device_headphones_selected_icon_color),
+ beautiful.colorscheme.bg_purple),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
@@ -217,9 +218,11 @@ function audio_controller.new()
layout = wibox.layout.fixed.horizontal,
},
id = 'sink_dd_shape',
- bg = Theme_config.volume_controller.list_bg,
- fg = Theme_config.volume_controller.list_headphones_fg,
- shape = Theme_config.volume_controller.list_shape,
+ bg = beautiful.colorscheme.bg1,
+ fg = beautiful.colorscheme.bg_purple,
+ shape = function(cr, width, height)
+ gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
+ end,
widget = wibox.container.background,
},
{ -- sink dropdown
@@ -235,10 +238,12 @@ function audio_controller.new()
margins = dpi(10),
widget = wibox.container.margin,
},
- border_color = Theme_config.volume_controller.list_border_color,
- border_width = Theme_config.volume_controller.list_border_width,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
id = 'sink_list_shape',
- shape = Theme_config.volume_controller.list_shape,
+ shape = function(cr, width, height)
+ gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
+ end,
widget = wibox.container.background,
},
id = 'sink_height',
@@ -256,7 +261,7 @@ function audio_controller.new()
{
resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg',
- Theme_config.volume_controller.device_headphones_selected_icon_color),
+ beautiful.colorscheme.bg_purple),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
@@ -275,9 +280,11 @@ function audio_controller.new()
layout = wibox.layout.fixed.horizontal,
},
id = 'source_dd_shape',
- bg = Theme_config.volume_controller.list_bg,
- fg = Theme_config.volume_controller.list_headphones_fg,
- shape = Theme_config.volume_controller.list_shape,
+ bg = beautiful.colorscheme.bg1,
+ fg = beautiful.colorscheme.bg_purple,
+ shape = function(cr, width, height)
+ gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
+ end,
widget = wibox.container.background,
},
{ -- source dropdown
@@ -293,10 +300,12 @@ function audio_controller.new()
margins = dpi(10),
widget = wibox.container.margin,
},
- border_color = Theme_config.volume_controller.list_border_color,
- border_width = Theme_config.volume_controller.list_border_width,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
id = 'source_list_shape',
- shape = Theme_config.volume_controller.list_shape,
+ shape = function(cr, width, height)
+ gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
+ end,
widget = wibox.container.background,
},
id = 'source_height',
@@ -317,7 +326,7 @@ function audio_controller.new()
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
- image = gcolor.recolor_image(icondir .. 'volume-high.svg', Theme_config.volume_controller.volume_fg),
+ image = gcolor.recolor_image(icondir .. 'volume-high.svg', beautiful.colorscheme.bg_purple),
id = 'sink_icon',
},
widget = wibox.container.constraint,
@@ -326,15 +335,13 @@ function audio_controller.new()
strategy = 'exact',
},
{
- bar_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(5))
- end,
+ bar_shape = beautiful.shape[4],
bar_height = dpi(5),
- bar_color = Theme_config.volume_controller.border_color,
- bar_active_color = Theme_config.volume_controller.volume_fg,
- handle_color = Theme_config.volume_controller.volume_fg,
+ bar_color = beautiful.colorscheme.border_color,
+ bar_active_color = beautiful.colorscheme.bg_purple,
+ handle_color = beautiful.colorscheme.bg_purple,
handle_shape = gshape.circle,
- handle_border_color = Theme_config.volume_controller.volume_fg,
+ handle_border_color = beautiful.colorscheme.bg_purple,
handle_width = dpi(15),
handle_cursor = 'left_ptr',
maximum = 100,
@@ -363,7 +370,7 @@ function audio_controller.new()
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
- image = gcolor.recolor_image(icondir .. 'microphone.svg', Theme_config.volume_controller.volume_fg),
+ image = gcolor.recolor_image(icondir .. 'microphone.svg', beautiful.colorscheme.bg_purple),
id = 'source_icon',
},
widget = wibox.container.constraint,
@@ -372,15 +379,13 @@ function audio_controller.new()
strategy = 'exact',
},
{
- bar_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(5))
- end,
+ bar_shape = beautiful.shape[4],
bar_height = dpi(5),
- bar_color = Theme_config.volume_controller.border_color,
- bar_active_color = Theme_config.volume_controller.volume_fg,
- handle_color = Theme_config.volume_controller.volume_fg,
+ bar_color = beautiful.colorscheme.border_color,
+ bar_active_color = beautiful.colorscheme.bg_purple,
+ handle_color = beautiful.colorscheme.bg_purple,
handle_shape = gshape.circle,
- handle_border_color = Theme_config.volume_controller.volume_fg,
+ handle_border_color = beautiful.colorscheme.bg_purple,
handle_width = dpi(15),
handle_cursor = 'left_ptr',
maximum = 100,
@@ -426,7 +431,7 @@ function audio_controller.new()
w.sink_volume = volume
w.sink_muted = muted
if muted then
- sink_icon:set_image(gcolor.recolor_image(icondir .. 'volume-mute.svg', Theme_config.volume_controller.volume_fg))
+ sink_icon:set_image(gcolor.recolor_image(icondir .. 'volume-mute.svg', beautiful.colorscheme.bg_purple))
else
local icon = icondir .. 'volume'
if volume == 0 then
@@ -440,7 +445,7 @@ function audio_controller.new()
end
sink_slider:set_value(volume)
- sink_icon:set_image(gcolor.recolor_image(icon .. '.svg', Theme_config.volume_controller.volume_fg))
+ sink_icon:set_image(gcolor.recolor_image(icon .. '.svg', beautiful.colorscheme.bg_purple))
end
end)
@@ -460,14 +465,14 @@ function audio_controller.new()
w.source_volume = volume
w.source_muted = muted
if muted then
- source_icon:set_image(gcolor.recolor_image(icondir .. 'microphone-off.svg', Theme_config.volume_controller.microphone_fg))
+ source_icon:set_image(gcolor.recolor_image(icondir .. 'microphone-off.svg', beautiful.colorscheme.bg_blue))
else
if not volume then return end
source_slider:set_value(tonumber(volume))
if volume > 0 then
- source_icon:set_image(gcolor.recolor_image(icondir .. 'microphone.svg', Theme_config.volume_controller.microphone_fg))
+ source_icon:set_image(gcolor.recolor_image(icondir .. 'microphone.svg', beautiful.colorscheme.bg_blue))
else
- source_icon:set_image(gcolor.recolor_image(icondir .. 'microphone-off.svg', Theme_config.volume_controller.microphone_fg))
+ source_icon:set_image(gcolor.recolor_image(icondir .. 'microphone-off.svg', beautiful.colorscheme.bg_blue))
end
end
end)
@@ -500,16 +505,14 @@ function audio_controller.new()
end
sink_dd_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
- Theme_config.volume_controller.device_headphones_selected_icon_color))
+ beautiful.colorscheme.bg_purple))
else
rubato_timer.target = 0
- sink_dd_shape.shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, 4)
- end
+ sink_dd_shape.shape = beautiful.shape[4]
sink_dd_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg',
- Theme_config.volume_controller.device_headphones_selected_icon_color))
+ beautiful.colorscheme.bg_purple))
end
end),
})
@@ -543,16 +546,14 @@ function audio_controller.new()
end
source_dd_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
- Theme_config.volume_controller.device_headphones_selected_icon_color))
+ beautiful.colorscheme.bg_purple))
else
rubato_timer.target = 0
- source_dd_shape.shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, 4)
- end
+ source_dd_shape.shape = beautiful.shape[4]
source_dd_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg',
- Theme_config.volume_controller.device_headphones_selected_icon_color))
+ beautiful.colorscheme.bg_purple))
end
end),
})
diff --git a/awesome/src/modules/audio/volume_osd.lua b/awesome/src/modules/audio/volume_osd.lua
index 54c5233..b4f1594 100644
--- a/awesome/src/modules/audio/volume_osd.lua
+++ b/awesome/src/modules/audio/volume_osd.lua
@@ -5,6 +5,7 @@
-- Awesome Libs
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
@@ -39,7 +40,7 @@ function osd.new(args)
{
{ -- Volume Icon
{
- image = gcolor.recolor_image(icondir .. 'volume-off.svg', Theme_config.volume_osd.icon_color),
+ image = gcolor.recolor_image(icondir .. 'volume-off.svg', beautiful.colorscheme.bg_purple),
valign = 'center',
halign = 'center',
resize = true,
@@ -55,8 +56,8 @@ function osd.new(args)
{
{
id = 'progressbar',
- color = Theme_config.volume_osd.bar_bg_active,
- background_color = Theme_config.volume_osd.bar_bg,
+ color = beautiful.colorscheme.bg_purple,
+ background_color = beautiful.colorscheme.bg1,
max_value = 100,
value = 0,
shape = gshape.rounded_rect,
@@ -84,16 +85,16 @@ function osd.new(args)
bottom = dpi(20),
widget = wibox.container.margin,
},
- shape = Theme_config.volume_osd.shape,
+ shape = beautiful.shape[12],
widget = wibox.container.background,
},
ontop = true,
stretch = false,
visible = false,
- 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,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ fg = beautiful.colorscheme.bg_purple,
+ bg = beautiful.colorscheme.bg,
screen = 1,
placement = function(c) aplacement.bottom(c, { margins = dpi(20) }) end,
}
@@ -111,7 +112,7 @@ function osd.new(args)
audio_helper:connect_signal('output::get', function(_, muted, volume)
volume = tonumber(volume or 0)
if muted then
- w.widget:get_children_by_id('icon_role')[1]:set_image(gcolor.recolor_image(icondir .. 'volume-mute' .. '.svg', Theme_config.volume_osd.icon_color))
+ w.widget:get_children_by_id('icon_role')[1]:set_image(gcolor.recolor_image(icondir .. 'volume-mute' .. '.svg', beautiful.colorscheme.bg_purple))
w.widget:get_children_by_id('progressbar')[1].value = 0
else
w.widget:get_children_by_id('progressbar')[1].value = volume
@@ -126,7 +127,7 @@ function osd.new(args)
icon = icon .. '-high'
end
- w.widget:get_children_by_id('icon_role')[1]:set_image(gcolor.recolor_image(icon .. '.svg', Theme_config.volume_osd.icon_color))
+ w.widget:get_children_by_id('icon_role')[1]:set_image(gcolor.recolor_image(icon .. '.svg', beautiful.colorscheme.bg_purple))
w.widget:get_children_by_id('text_role')[1].text = volume
end
w:run()
diff --git a/awesome/src/modules/bluetooth/device.lua b/awesome/src/modules/bluetooth/device.lua
index 03a4fce..8da4b4f 100644
--- a/awesome/src/modules/bluetooth/device.lua
+++ b/awesome/src/modules/bluetooth/device.lua
@@ -6,6 +6,7 @@
local abutton = require('awful.button')
local awidget = require('awful.widget')
local base = require('wibox.widget.base')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears').color
local gfilesystem = require('gears').filesystem
@@ -50,7 +51,7 @@ end
--#endregion
-local dbus_proxy = require('dbus_proxy')
+local dbus_proxy = require('src.lib.lua-dbus_proxy.src.dbus_proxy')
--- Connect to a device if not connected else disconnect
function device:toggle_connect()
if not self.device.Paired then
@@ -110,8 +111,8 @@ function device.new(args)
local inputbox = input {
text = args.device.Alias or args.device.Name,
- font = 'JetBrainsMono Nerd Font 12',
- fg = Theme_config.bluetooth_controller.device_fg,
+ font = beautiful.user_config.font .. ' 12',
+ fg = beautiful.colorscheme.bg_blue,
}
local ret = base.make_widget_from_value(wibox.widget {
@@ -121,7 +122,7 @@ function device.new(args)
{
{
image = gcolor.recolor_image(
- icondir .. icon .. '.svg', Theme_config.bluetooth_controller.icon_color),
+ icondir .. icon .. '.svg', beautiful.colorscheme.bg_purple),
resize = false,
valign = 'center',
halign = 'center',
@@ -165,8 +166,8 @@ function device.new(args)
margins = dpi(2),
widget = wibox.container.margin,
},
- shape = Theme_config.bluetooth_controller.icon_shape,
- bg = Theme_config.bluetooth_controller.con_button_color,
+ shape = beautiful.shape[4],
+ bg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background,
},
margin = dpi(5),
@@ -177,12 +178,12 @@ function device.new(args)
margins = dpi(5),
widget = wibox.container.margin,
},
- 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,
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.bg_blue,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
id = 'background',
- shape = Theme_config.bluetooth_controller.device_shape,
+ shape = beautiful.shape[4],
widget = wibox.container.background,
})
@@ -195,7 +196,7 @@ function device.new(args)
-- Set the image of the connection button depending on the connection state
ret:get_children_by_id('con')[1].image = gcolor.recolor_image(ret.device.Connected and icondir .. 'link.svg' or
icondir .. 'link-off.svg',
- Theme_config.bluetooth_controller.icon_color_dark)
+ beautiful.colorscheme.bg)
local cm = context_menu {
widget_template = wibox.widget {
@@ -232,7 +233,7 @@ function device.new(args)
name = ret.device.Connected and 'Disconnect' or 'Connect',
icon = gcolor.recolor_image(ret.device.Connected and icondir .. 'bluetooth-off.svg' or
icondir .. 'bluetooth-on.svg',
- Theme_config.bluetooth_controller.icon_color),
+ beautiful.colorscheme.bg_purple),
callback = function()
ret:toggle_connect()
end,
@@ -242,7 +243,7 @@ function device.new(args)
name = 'Pair',
icon = gcolor.recolor_image(ret.device.Paired and icondir .. 'link-off.svg' or
icondir .. 'link.svg',
- Theme_config.bluetooth_controller.icon_color),
+ beautiful.colorscheme.bg_purple),
callback = function()
ret:toggle_pair()
end,
@@ -250,7 +251,7 @@ function device.new(args)
{ -- Trust/Untrust a device
name = ret.device.Trusted and 'Untrust' or 'Trust',
icon = gcolor.recolor_image(ret.device.Trusted and icondir .. 'untrusted.svg' or icondir .. 'trusted.svg',
- Theme_config.bluetooth_controller.icon_color),
+ beautiful.colorscheme.bg_purple),
callback = function()
ret:toggle_trusted()
end,
@@ -258,7 +259,7 @@ function device.new(args)
},
{ -- Rename a device
name = 'Rename',
- icon = gcolor.recolor_image(icondir .. 'edit.svg', Theme_config.bluetooth_controller.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'edit.svg', beautiful.colorscheme.bg_purple),
callback = function()
inputbox:focus()
inputbox:connect_signal('inputbox::keypressed', function(_, mod, key)
@@ -271,7 +272,7 @@ function device.new(args)
},
{ -- Remove a device
name = 'Remove',
- icon = gcolor.recolor_image(icondir .. 'delete.svg', Theme_config.bluetooth_controller.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'delete.svg', beautiful.colorscheme.bg_purple),
callback = function()
args.remove_callback(ret.device)
end,
@@ -296,14 +297,14 @@ function device.new(args)
value:get_children_by_id('text_role')[1].text = ret.device.Connected and 'Disconnect' or 'Connect'
value:get_children_by_id('icon_role')[1].image = gcolor.recolor_image(ret.device.Connected and
icondir .. 'bluetooth-off.svg' or icondir .. 'bluetooth-on.svg',
- Theme_config.bluetooth_controller.icon_color)
+ beautiful.colorscheme.bg_purple)
elseif value.id:match('trusted') then
value:get_children_by_id('text_role')[1].text = ret.device.Trusted and 'Untrust' or 'Trust'
value:get_children_by_id('icon_role')[1].image = gcolor.recolor_image(ret.device.Trusted and
- icondir .. 'untrusted.svg' or icondir .. 'trusted.svg', Theme_config.bluetooth_controller.icon_color)
+ icondir .. 'untrusted.svg' or icondir .. 'trusted.svg', beautiful.colorscheme.bg_purple)
elseif value.id:match('paired') then
value:get_children_by_id('icon_role')[1].image = gcolor.recolor_image(ret.device.Paired and
- icondir .. 'link-off.svg' or icondir .. 'link.svg', Theme_config.bluetooth_controller.icon_color)
+ icondir .. 'link-off.svg' or icondir .. 'link.svg', beautiful.colorscheme.bg_purple)
end
end
cm:toggle()
@@ -314,7 +315,7 @@ function device.new(args)
capi.awesome.connect_signal(ret.device.object_path .. '_updated', function(d)
ret:get_children_by_id('con')[1].image = gcolor.recolor_image(d.Connected and icondir .. 'link.svg' or
icondir .. 'link-off.svg',
- Theme_config.bluetooth_controller.icon_color_dark)
+ beautiful.colorscheme.bg)
end)
hover.bg_hover { widget = ret }
diff --git a/awesome/src/modules/bluetooth/init.lua b/awesome/src/modules/bluetooth/init.lua
index 09904e1..026df24 100644
--- a/awesome/src/modules/bluetooth/init.lua
+++ b/awesome/src/modules/bluetooth/init.lua
@@ -6,6 +6,7 @@
local abutton = require('awful.button')
local aspawn = require('awful.spawn')
local base = require('wibox.widget.base')
+local beautiful = require('beautiful')
local dbus_proxy = require('src.lib.lua-dbus_proxy.src.dbus_proxy')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears').color
@@ -263,7 +264,7 @@ function bluetooth.new(args)
{
resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg',
- Theme_config.bluetooth_controller.connected_icon_color),
+ beautiful.colorscheme.bg_purple),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
@@ -281,9 +282,9 @@ function bluetooth.new(args)
},
layout = wibox.layout.fixed.horizontal,
},
- bg = Theme_config.bluetooth_controller.connected_bg,
- fg = Theme_config.bluetooth_controller.connected_fg,
- shape = Theme_config.bluetooth_controller.connected_shape,
+ bg = beautiful.colorscheme.bg1,
+ fg = beautiful.colorscheme.bg_purple,
+ shape = beautiful.shape[4],
widget = wibox.container.background,
id = 'connected_bg',
},
@@ -304,9 +305,9 @@ function bluetooth.new(args)
margins = dpi(10),
widget = wibox.container.margin,
},
- border_color = Theme_config.bluetooth_controller.con_device_border_color,
- border_width = Theme_config.bluetooth_controller.con_device_border_width,
- shape = Theme_config.bluetooth_controller.con_device_shape,
+ border_color = beautiful.colorscheme.bg1,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
widget = wibox.container.background,
},
widget = wibox.container.constraint,
@@ -320,7 +321,7 @@ function bluetooth.new(args)
{
resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg',
- Theme_config.bluetooth_controller.discovered_icon_color),
+ beautiful.colorscheme.bg_blue),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
@@ -339,9 +340,9 @@ function bluetooth.new(args)
layout = wibox.layout.fixed.horizontal,
},
id = 'discovered_bg',
- bg = Theme_config.bluetooth_controller.discovered_bg,
- fg = Theme_config.bluetooth_controller.discovered_fg,
- shape = Theme_config.bluetooth_controller.discovered_shape,
+ bg = beautiful.colorscheme.bg1,
+ fg = beautiful.colorscheme.bg_blue,
+ shape = beautiful.shape[4],
widget = wibox.container.background,
},
id = 'discovered_margin',
@@ -360,9 +361,9 @@ function bluetooth.new(args)
margins = dpi(10),
widget = wibox.container.margin,
},
- border_color = Theme_config.bluetooth_controller.con_device_border_color,
- border_width = Theme_config.bluetooth_controller.con_device_border_width,
- shape = Theme_config.bluetooth_controller.con_device_shape,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
widget = wibox.container.background,
forced_height = 0,
id = 'discovered_list',
@@ -371,7 +372,7 @@ function bluetooth.new(args)
{ -- action buttons
{
dnd_widget {
- color = Theme_config.bluetooth_controller.power_bg,
+ color = beautiful.colorscheme.bg_blue,
size = dpi(40),
},
id = 'dnd',
@@ -384,7 +385,7 @@ function bluetooth.new(args)
{
{
image = gcolor.recolor_image(icondir .. 'refresh.svg',
- Theme_config.bluetooth_controller.refresh_icon_color),
+ beautiful.colorscheme.bg),
resize = false,
valign = 'center',
halign = 'center',
@@ -393,8 +394,8 @@ function bluetooth.new(args)
widget = wibox.container.margin,
margins = dpi(5),
},
- shape = Theme_config.bluetooth_controller.refresh_shape,
- bg = Theme_config.bluetooth_controller.refresh_bg,
+ shape = beautiful.shape[4],
+ bg = beautiful.colorscheme.bg_blue,
id = 'scan',
widget = wibox.container.background,
},
@@ -515,7 +516,7 @@ function bluetooth.new(args)
end
connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
- Theme_config.bluetooth_controller.connected_icon_color))
+ beautiful.colorscheme.bg_purple))
end
end
end)
@@ -530,7 +531,7 @@ function bluetooth.new(args)
end
connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
- Theme_config.bluetooth_controller.connected_icon_color))
+ beautiful.colorscheme.bg_purple))
end
end)
@@ -545,16 +546,14 @@ function bluetooth.new(args)
end
connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
- Theme_config.bluetooth_controller.connected_icon_color))
+ beautiful.colorscheme.bg_purple))
end
else
connected_animation.target = 0
- connected_margin.connected_bg.shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, 4)
- end
+ connected_margin.connected_bg.shape = beautiful.shape[4]
connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg',
- Theme_config.bluetooth_controller.connected_icon_color))
+ beautiful.colorscheme.bg_purple))
end
end)
@@ -584,7 +583,7 @@ function bluetooth.new(args)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
- Theme_config.bluetooth_controller.discovered_icon_color))
+ beautiful.colorscheme.bg_blue))
end
end
end)
@@ -600,7 +599,7 @@ function bluetooth.new(args)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
- Theme_config.bluetooth_controller.discovered_icon_color))
+ beautiful.colorscheme.bg_blue))
end
end)
@@ -616,15 +615,13 @@ function bluetooth.new(args)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
- Theme_config.bluetooth_controller.discovered_icon_color))
+ beautiful.colorscheme.bg_blue))
end
else
discovered_animation.target = 0
- discovered_bg.shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, 4)
- end
+ discovered_bg.shape = beautiful.shape[4]
discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg',
- Theme_config.bluetooth_controller.discovered_icon_color))
+ beautiful.colorscheme.bg_blue))
end
end)
--#endregion
diff --git a/awesome/src/modules/brightness/brightness_osd.lua b/awesome/src/modules/brightness/brightness_osd.lua
index e89e179..5afcbf2 100644
--- a/awesome/src/modules/brightness/brightness_osd.lua
+++ b/awesome/src/modules/brightness/brightness_osd.lua
@@ -5,6 +5,7 @@
-- Awesome Libs
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
@@ -44,61 +45,61 @@ function brightness_osd.new(args)
{
{ -- Brightness Icon
{
- image = gcolor.recolor_image(icondir .. 'volume-off.svg', Theme_config.brightness_ods.icon_color),
+ image = gcolor.recolor_image(icondir .. 'volume-off.svg', beautiful.colorscheme.bg_blue),
valign = 'center',
halign = 'center',
resize = true,
id = 'icon_role',
- widget = wibox.widget.imagebox
+ widget = wibox.widget.imagebox,
},
widget = wibox.container.constraint,
width = dpi(25),
height = dpi(25),
- strategy = 'exact'
+ strategy = 'exact',
},
{ -- Brightness Bar
{
{
id = 'progressbar',
- color = Theme_config.brightness_ods.bar_bg_active,
- background_color = Theme_config.brightness_ods.bar_bg,
+ color = beautiful.colorscheme.bg_blue,
+ background_color = beautiful.colorscheme.bg,
max_value = 100,
value = 0,
shape = gshape.rounded_rect,
- widget = wibox.widget.progressbar
+ widget = wibox.widget.progressbar,
},
widget = wibox.container.constraint,
width = dpi(250),
height = dpi(5),
},
- widget = wibox.container.place
+ widget = wibox.container.place,
},
{ -- Brightness text
widget = wibox.widget.textbox,
id = 'text_role',
text = '0',
valign = 'center',
- halign = 'center'
+ halign = 'center',
},
spacing = dpi(10),
- layout = wibox.layout.fixed.horizontal
+ layout = wibox.layout.fixed.horizontal,
},
left = dpi(10),
right = dpi(10),
top = dpi(20),
bottom = dpi(20),
- widget = wibox.container.margin
+ widget = wibox.container.margin,
},
- shape = Theme_config.brightness_ods.shape,
- widget = wibox.container.background
+ shape = beautiful.shape[4],
+ widget = wibox.container.background,
},
ontop = true,
stretch = false,
visible = false,
- border_color = Theme_config.brightness_ods.border_color,
- border_width = Theme_config.brightness_ods.border_width,
- fg = Theme_config.brightness_ods.fg,
- bg = Theme_config.brightness_ods.bg,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ fg = beautiful.colorscheme.bg_blue,
+ bg = beautiful.colorscheme.bg,
screen = 1,
placement = function(c) aplacement.bottom(c, { margins = dpi(20) }) end,
}
@@ -110,7 +111,7 @@ function brightness_osd.new(args)
autostart = true,
callback = function()
w.visible = false
- end
+ end,
}
backlight_helper:connect_signal('brightness_changed', function()
@@ -127,7 +128,7 @@ function brightness_osd.new(args)
icon = icon .. '-high.svg'
end
- w.widget:get_children_by_id('icon')[1]:set_image(gcolor.recolor_image(icon, Theme_config.brightness_osd.icon_color))
+ w.widget:get_children_by_id('icon')[1]:set_image(gcolor.recolor_image(icon, beautiful.colorscheme.bg_blue))
w.widget:get_children_by_id('text_role')[1].text = brightness
w:run()
end)
diff --git a/awesome/src/modules/calendar/init.lua b/awesome/src/modules/calendar/init.lua
index 65fdf3d..37b2cc5 100644
--- a/awesome/src/modules/calendar/init.lua
+++ b/awesome/src/modules/calendar/init.lua
@@ -1,5 +1,7 @@
-- Awesome Libs
local awful = require('awful')
+local apopup = require('awful.popup')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears.table')
local gcolor = require('gears.color')
@@ -348,7 +350,7 @@ function calendar:create_calendar_weeks_widget()
widget = wibox.widget.textbox,
},
id = 'background',
- fg = Theme_config.calendar.day.fg_unfocus,
+ fg = beautiful.colorscheme.bg2,
widget = wibox.container.background,
},
strategy = 'exact',
@@ -371,8 +373,8 @@ function calendar:create_weekdays_widget()
valign = 'center',
widget = wibox.widget.textbox,
},
- bg = Theme_config.calendar.weekdays.bg,
- fg = Theme_config.calendar.weekdays.fg,
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background,
})
end
@@ -421,9 +423,9 @@ function calendar:create_calendar_widget()
margins = dpi(2),
widget = wibox.container.margin,
},
- fg = Theme_config.calendar.task.fg,
+ fg = beautiful.colorscheme.bg,
bg = bg,
- shape = Theme_config.calendar.task.shape,
+ shape = beautiful.shape[4],
forced_height = dpi(20),
widget = wibox.container.background,
}
@@ -460,11 +462,11 @@ function calendar:create_calendar_widget()
color = cal.color,
}
- local task_popup = awful.popup {
+ local task_popup = apopup {
widget = ti,
ontop = true,
visible = false,
- bg = '#00000000',
+ bg = gcolor.transparent,
x = capi.mouse.coords().x,
y = capi.mouse.coords().y,
screen = capi.mouse.screen,
@@ -508,16 +510,16 @@ function calendar:create_calendar_widget()
local last_month_length = self:get_last_day_in_month(last_month, year)
for i = last_month_length - months_t[self.date.month].first_day + 2, last_month_length, 1 do
- local border = Theme_config.calendar.day.border_color
- local bg = Theme_config.calendar.day.bg_unfocus
- local fg = Theme_config.calendar.day.fg_unfocus
+ local border = beautiful.colorscheme.border_color
+ local bg = beautiful.colorscheme.bg
+ local fg = beautiful.colorscheme.bg2
local y = tonumber(os.date('%Y'))
local m = tonumber(os.date('%m'))
if (i == self.date.day) and (m == last_month) and (y == year) then
- bg = Theme_config.calendar.day.bg_focus
- fg = Theme_config.calendar.day.fg_focus
+ bg = beautiful.colorscheme.bg_teal
+ fg = beautiful.colorscheme.bg
end
local day = wibox.widget {
@@ -540,7 +542,7 @@ function calendar:create_calendar_widget()
id = 'day_bg',
widget = wibox.container.background,
bg = bg,
- shape = Theme_config.calendar.day.shape,
+ shape = beautiful.shape[4],
fg = fg,
},
widget = wibox.container.place,
@@ -563,11 +565,11 @@ function calendar:create_calendar_widget()
},
id = 'background',
widget = wibox.container.background,
- bg = Theme_config.calendar.day.bg_unfocus,
- fg = Theme_config.calendar.day.fg_unfocus,
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.bg2,
border_color = border,
- border_width = Theme_config.calendar.day.border_width,
- shape = Theme_config.calendar.day.shape,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
},
id = 'day',
widget = wibox.container.constraint,
@@ -586,15 +588,15 @@ function calendar:create_calendar_widget()
local row = 1
local col = months_t[self.date.month].first_day
for i = 1, months_t[self.date.month].day_count, 1 do
- local border = Theme_config.calendar.day.border_color
- local bg = Theme_config.calendar.day.bg
- local fg = Theme_config.calendar.day.fg
+ local border = beautiful.colorscheme.border_color
+ local bg = beautiful.colorscheme.bg
+ local fg = beautiful.colorscheme.fg
local m = tonumber(os.date('%m'))
local y = tonumber(os.date('%Y'))
if (i == self.date.day) and (m == self.date.month) and (y == self.date.year) then
- bg = Theme_config.calendar.day.bg_focus
- fg = Theme_config.calendar.day.fg_focus
+ bg = beautiful.colorscheme.bg_teal
+ fg = beautiful.colorscheme.bg
end
local day = wibox.widget {
@@ -617,7 +619,7 @@ function calendar:create_calendar_widget()
id = 'day_bg',
widget = wibox.container.background,
bg = bg,
- shape = Theme_config.calendar.day.shape,
+ shape = beautiful.shape[4],
fg = fg,
},
widget = wibox.container.place,
@@ -638,11 +640,11 @@ function calendar:create_calendar_widget()
},
id = 'background',
widget = wibox.container.background,
- bg = Theme_config.calendar.day.bg,
- fg = Theme_config.calendar.day.fg,
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.fg,
border_color = border,
- border_width = Theme_config.calendar.day.border_width,
- shape = Theme_config.calendar.day.shape,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
},
widget = wibox.container.constraint,
width = dpi(100),
@@ -668,15 +670,15 @@ function calendar:create_calendar_widget()
end
for i = 1, 7 - months_t[self.date.month].last_day, 1 do
- local border = Theme_config.calendar.day.border_color
- local bg = Theme_config.calendar.day.bg_unfocus
- local fg = Theme_config.calendar.day.fg_unfocus
+ local border = beautiful.colorscheme.border_color
+ local bg = beautiful.colorscheme.bg
+ local fg = beautiful.colorscheme.bg2
local m = tonumber(os.date('%m'))
local y = tonumber(os.date('%Y'))
if (i == self.date.day) and (m == next_month) and (y == year) then
- bg = Theme_config.calendar.day.bg_focus
- fg = Theme_config.calendar.day.fg_focus
+ bg = beautiful.colorscheme.bg_teal
+ fg = beautiful.colorscheme.bg
end
local day = wibox.widget {
{
@@ -698,7 +700,7 @@ function calendar:create_calendar_widget()
id = 'day_bg',
widget = wibox.container.background,
bg = bg,
- shape = Theme_config.calendar.day.shape,
+ shape = beautiful.shape[4],
fg = fg,
},
widget = wibox.container.place,
@@ -719,11 +721,11 @@ function calendar:create_calendar_widget()
},
id = 'background',
widget = wibox.container.background,
- bg = Theme_config.calendar.day.bg_unfocus,
- fg = Theme_config.calendar.day.fg_unfocus,
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.bg2,
border_color = border,
- border_width = Theme_config.calendar.day.border_width,
- shape = Theme_config.calendar.day.shape,
+ border_width = dpi(2),
+ shape = beautiful.shape[4],
},
widget = wibox.container.constraint,
width = dpi(100),
@@ -752,13 +754,13 @@ function calendar.new(args)
{
widget = wibox.widget.imagebox,
resize = false,
- image = gcolor.recolor_image(icondir .. 'add_ical.svg', Theme_config.calendar.add_ical.fg_focus),
+ image = gcolor.recolor_image(icondir .. 'add_ical.svg', beautiful.colorscheme.bg_red),
halign = 'center',
valign = 'center',
},
id = 'add_ical',
- shape = Theme_config.calendar.add_ical.shape,
- bg = Theme_config.calendar.add_ical.bg,
+ shape = beautiful.shape[4],
+ bg = beautiful.colorscheme.bg_red,
widget = wibox.container.background,
},
widget = wibox.container.margin,
@@ -769,13 +771,13 @@ function calendar.new(args)
{
widget = wibox.widget.imagebox,
resize = false,
- image = gcolor.recolor_image(icondir .. 'add_task.svg', Theme_config.calendar.add_task.fg),
+ image = gcolor.recolor_image(icondir .. 'add_task.svg', beautiful.colorscheme.bg),
halign = 'center',
valign = 'center',
},
id = 'add_task',
- shape = Theme_config.calendar.add_task.shape,
- bg = Theme_config.calendar.add_task.bg,
+ shape = beautiful.shape[4],
+ bg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background,
},
widget = wibox.container.margin,
@@ -876,12 +878,12 @@ function calendar.new(args)
layout = wibox.layout.fixed.horizontal,
},
widget = wibox.container.background,
- bg = Theme_config.calendar.bg,
- border_color = Theme_config.calendar.border_color,
- border_width = Theme_config.calendar.border_width,
+ bg = beautiful.colorscheme.bg,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
border_strategy = 'inner',
- fg = Theme_config.calendar.fg,
- shape = Theme_config.calendar.shape,
+ fg = beautiful.colorscheme.fg,
+ shape = beautiful.shape,
})
ret:get_tasks()
diff --git a/awesome/src/modules/calendar/task_info.lua b/awesome/src/modules/calendar/task_info.lua
index c54bd98..7bfc1da 100644
--- a/awesome/src/modules/calendar/task_info.lua
+++ b/awesome/src/modules/calendar/task_info.lua
@@ -1,5 +1,6 @@
-- Awesome Libs
local awful = require('awful')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gtable = require('gears.table')
@@ -21,7 +22,7 @@ function task_info.new(args)
local ret = gobject {}
gtable.crush(ret, task_info, true)
- args.color = args.color or '#ffffff'
+ args.color = args.color or beautiful.colorscheme.fg
local date_long_written = os.date('%A, %d. %B %Y', os.time(args.date_start))
@@ -133,9 +134,9 @@ function task_info.new(args)
top = dpi(15),
bottom = dpi(15),
},
- bg = Theme_config.calendar.task_info.bg,
- fg = Theme_config.calendar.task_info.fg,
- shape = Theme_config.calendar.task_info.shape,
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.fg,
+ shape = beautiful.shape[12],
widget = wibox.container.background,
}
diff --git a/awesome/src/modules/context_menu/init.lua b/awesome/src/modules/context_menu/init.lua
index 955094c..fb215c7 100644
--- a/awesome/src/modules/context_menu/init.lua
+++ b/awesome/src/modules/context_menu/init.lua
@@ -3,7 +3,9 @@
---------------------------------------
-- Awesome Libs
local awful = require('awful')
+local apopup = require('awful.popup')
local abutton = awful.button
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears.table')
local base = require('wibox.widget.base')
@@ -101,8 +103,8 @@ function context_menu:make_entries(wtemplate, entries, spacing)
margins = dpi(5),
widget = wibox.container.margin,
},
- bg = Theme_config.desktop.context_menu.entry_bg,
- fg = Theme_config.desktop.context_menu.entry_fg,
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.bg_red,
widget = wibox.container.background,
}
@@ -114,7 +116,7 @@ function context_menu:make_entries(wtemplate, entries, spacing)
menu_entry:get_children_by_id('text_role')[1].text = entry.name
if entry.submenu then
menu_entry:get_children_by_id('arrow_role')[1].image =
- gcolor.recolor_image(icondir .. 'entry.svg', Theme_config.desktop.context_menu.entry_fg)
+ gcolor.recolor_image(icondir .. 'entry.svg', beautiful.colorscheme.bg_red)
end
gtable.crush(menu_entry, entry, true)
@@ -133,14 +135,13 @@ function context_menu:make_entries(wtemplate, entries, spacing)
})
if entry.submenu then
- menu_entry.popup = awful.popup {
+ menu_entry.popup = apopup {
widget = self:make_entries(wtemplate, entry.submenu, spacing),
- bg = Theme_config.desktop.context_menu.bg,
+ bg = beautiful.colorscheme.bg,
ontop = true,
- fg = Theme_config.desktop.context_menu.fg,
- border_width = Theme_config.desktop.context_menu.border_width,
- border_color = Theme_config.desktop.context_menu.border_color,
- shape = Theme_config.desktop.context_menu.shape,
+ fg = beautiful.colorscheme.bg_red,
+ border_width = dpi(2),
+ border_color = beautiful.colorscheme.border_color,
visible = false,
}
@@ -197,14 +198,13 @@ function context_menu.new(args)
local entries = ret:make_entries(args.widget_template, args.entries, args.spacing)
- ret = awful.popup {
+ ret = apopup {
widget = entries,
- bg = Theme_config.desktop.context_menu.bg,
- fg = Theme_config.desktop.context_menu.fg,
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.bg_red,
ontop = true,
- border_width = Theme_config.desktop.context_menu.border_width,
- border_color = Theme_config.desktop.context_menu.border_color,
- shape = Theme_config.desktop.context_menu.shape,
+ border_width = dpi(2),
+ border_color = beautiful.colorscheme.border_color,
visible = false,
x = capi.mouse.coords().x + 10,
y = capi.mouse.coords().y - 10,
diff --git a/awesome/src/modules/crylia_bar/center_bar.lua b/awesome/src/modules/crylia_bar/center_bar.lua
index 35382c0..cffbdcd 100644
--- a/awesome/src/modules/crylia_bar/center_bar.lua
+++ b/awesome/src/modules/crylia_bar/center_bar.lua
@@ -1,10 +1,11 @@
---------------------------------------------------------------------------------------------------------------
--- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
---------------------------------------------------------------------------------------------------------------
+local tinsert = table.insert
+local pairs = pairs
+
-- Awesome Libs
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
-local dpi = require('beautiful').xresources.apply_dpi
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
local wibox = require('wibox')
local capi = {
@@ -12,93 +13,99 @@ local capi = {
client = client,
}
-return function(s, widgets)
-
- local function prepare_widgets(w)
- local layout = {
- forced_height = dpi(50),
- layout = wibox.layout.fixed.horizontal,
- }
- for i, widget in pairs(w) do
- if i == 1 then
- table.insert(layout,
- {
- widget,
- left = dpi(6),
- right = dpi(6),
- top = dpi(6),
- bottom = dpi(6),
- widget = wibox.container.margin,
- })
- elseif i == #w then
- table.insert(layout,
- {
- widget,
- left = dpi(3),
- right = dpi(6),
- top = dpi(6),
- bottom = dpi(6),
- widget = wibox.container.margin,
- })
- else
- table.insert(layout,
- {
- widget,
- left = dpi(3),
- right = dpi(3),
- top = dpi(6),
- bottom = dpi(6),
- widget = wibox.container.margin,
- })
- end
+local function prepare_widgets(w)
+ local layout = {
+ layout = wibox.layout.fixed.horizontal,
+ }
+ for i, widget in pairs(w) do
+ if i == 1 then
+ tinsert(layout,
+ {
+ widget,
+ left = dpi(6),
+ right = dpi(6),
+ top = dpi(6),
+ bottom = dpi(6),
+ widget = wibox.container.margin,
+ })
+ elseif i == #w then
+ tinsert(layout,
+ {
+ widget,
+ left = dpi(3),
+ right = dpi(6),
+ top = dpi(6),
+ bottom = dpi(6),
+ widget = wibox.container.margin,
+ })
+ else
+ tinsert(layout,
+ {
+ widget,
+ left = dpi(3),
+ right = dpi(3),
+ top = dpi(6),
+ bottom = dpi(6),
+ widget = wibox.container.margin,
+ })
end
- return layout
end
-
- local top_center = apopup {
- screen = s,
- widget = prepare_widgets(widgets),
- ontop = false,
- bg = Theme_config.center_bar.bg,
- visible = true,
- maximum_width = dpi(500),
- placement = function(c) aplacement.top(c, { margins = dpi(10) }) end,
- }
-
- top_center:struts {
- top = dpi(55),
- }
-
- capi.client.connect_signal('manage', function(c)
- if #s.selected_tag:clients() < 1 then
- top_center.visible = false
- else
- top_center.visible = true
- end
- end)
-
- capi.client.connect_signal('unmanage', function(c)
- if #s.selected_tag:clients() < 1 then
- top_center.visible = false
- else
- top_center.visible = true
- end
- end)
-
- capi.client.connect_signal('property::selected', function(c)
- if #s.selected_tag:clients() < 1 then
- top_center.visible = false
- else
- top_center.visible = true
- end
- end)
-
- capi.awesome.connect_signal('refresh', function(c)
- if #s.selected_tag:clients() < 1 then
- top_center.visible = false
- else
- top_center.visible = true
- end
- end)
-
+ return layout
end
+
+return setmetatable({}, {
+ __call = function(_, s, widgets)
+
+ local top_center = apopup {
+ screen = s,
+ widget = {
+ prepare_widgets(widgets),
+ widget = wibox.container.constraint,
+ strategy = 'exact',
+ height = dpi(50),
+ },
+ ontop = false,
+ bg = beautiful.colorscheme.bg,
+ visible = true,
+ maximum_width = dpi(500),
+ placement = function(c) aplacement.top(c, { margins = dpi(10) }) end,
+ }
+
+ top_center:struts {
+ top = dpi(60),
+ }
+
+ capi.client.connect_signal('manage', function(c)
+ if #s.selected_tag:clients() < 1 then
+ top_center.visible = false
+ else
+ top_center.visible = true
+ end
+ end)
+
+ capi.client.connect_signal('unmanage', function(c)
+ if #s.selected_tag:clients() < 1 then
+ top_center.visible = false
+ else
+ top_center.visible = true
+ end
+ end)
+
+ capi.client.connect_signal('property::selected', function(c)
+ if #s.selected_tag:clients() < 1 then
+ top_center.visible = false
+ else
+ top_center.visible = true
+ end
+ end)
+
+ capi.awesome.connect_signal('refresh', function(c)
+ if #s.selected_tag:clients() < 1 then
+ top_center.visible = false
+ else
+ top_center.visible = true
+ end
+ end)
+
+ end,
+})
diff --git a/awesome/src/modules/crylia_bar/dock.lua b/awesome/src/modules/crylia_bar/dock.lua
index 33bd440..2b12ffa 100644
--- a/awesome/src/modules/crylia_bar/dock.lua
+++ b/awesome/src/modules/crylia_bar/dock.lua
@@ -1,25 +1,28 @@
---------------------------------------------------------------------------------------------------------------
--- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
---------------------------------------------------------------------------------------------------------------
+local setmetatable = setmetatable
+local table = table
+local ipairs = ipairs
+local pairs = pairs
+
-- Awesome Libs
-local lgi = require('lgi')
-local Gio = lgi.Gio
local abutton = require('awful.button')
+local aplacement = require('awful.placement')
local apopup = require('awful.popup')
+local awidget = require('awful.widget')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
+local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table')
-local wibox = require('wibox')
-local gcolor = require('gears.color')
-local awidget = require('awful.widget')
-local aplacement = require('awful.placement')
local gtimer = require('gears.timer')
-local amenu = require('awful.menu')
+local lgi = require('lgi')
+local Gio = lgi.Gio
+local wibox = require('wibox')
-- Local libs
local config = require('src.tools.config')
-local context_menu = require('src.modules.context_menu.init')
+local context_menu = require('src.modules.context_menu')
local hover = require('src.tools.hover')
+local icon_lookup = require('src.tools.gio_icon_lookup')()
local capi = {
awesome = awesome,
@@ -102,8 +105,8 @@ function dock:get_element_widget(desktop_file)
local GDesktopAppInfo = Gio.DesktopAppInfo.new_from_filename(desktop_file)
- local icon = Get_gicon_path(nil, GDesktopAppInfo.get_string(GDesktopAppInfo, 'Icon')) or
- Get_gicon_path(nil, Gio.DesktopAppInfo.get_string(GDesktopAppInfo, 'X-AppImage-Old-Icon')) or ''
+ local icon = icon_lookup:get_gicon_path(nil, GDesktopAppInfo.get_string(GDesktopAppInfo, 'Icon')) or
+ icon_lookup:get_gicon_path(nil, Gio.DesktopAppInfo.get_string(GDesktopAppInfo, 'X-AppImage-Old-Icon')) or ''
local widget = wibox.widget {
{
@@ -118,19 +121,19 @@ function dock:get_element_widget(desktop_file)
id = 'icon_role',
},
widget = wibox.container.constraint,
- width = User_config.dock_icon_size,
- height = User_config.dock_icon_size,
+ width = beautiful.user_config.dock_icon_size,
+ height = beautiful.user_config.dock_icon_size,
},
widget = wibox.container.margin,
margins = dpi(5),
},
widget = wibox.container.constraint,
- width = User_config.dock_icon_size + dpi(10), -- + margins
- height = User_config.dock_icon_size + dpi(10),
+ width = beautiful.user_config.dock_icon_size + dpi(10), -- + margins
+ height = beautiful.user_config.dock_icon_size + dpi(10),
strategy = 'exact',
},
- bg = Theme_config.dock.element.bg,
- shape = Theme_config.dock.element.shape,
+ bg = beautiful.colorscheme.bg1,
+ shape = beautiful.shape[8],
widget = wibox.container.background,
}
@@ -138,9 +141,9 @@ function dock:get_element_widget(desktop_file)
for _, action in ipairs(Gio.DesktopAppInfo.list_actions(GDesktopAppInfo)) do
table.insert(action_entries, {
name = Gio.DesktopAppInfo.get_action_name(GDesktopAppInfo, action) or '',
- icon = Get_gicon_path(nil, GDesktopAppInfo.get_string(GDesktopAppInfo, 'Icon')) or
- Get_gicon_path(nil, Gio.DesktopAppInfo.get_string(GDesktopAppInfo, 'X-AppImage-Old-Icon')) or
- gcolor.recolor_image(icondir .. 'entry.svg', Theme_config.dock.cm_icon),
+ icon = icon_lookup:get_gicon_path(nil, GDesktopAppInfo.get_string(GDesktopAppInfo, 'Icon')) or
+ icon_lookup:get_gicon_path(nil, Gio.DesktopAppInfo.get_string(GDesktopAppInfo, 'X-AppImage-Old-Icon')) or
+ gcolor.recolor_image(icondir .. 'entry.svg', beautiful.colorscheme.bg_yellow),
callback = function()
Gio.DesktopAppInfo.launch_action(GDesktopAppInfo, action)
end,
@@ -149,7 +152,7 @@ function dock:get_element_widget(desktop_file)
table.insert(action_entries, {
name = 'Remove from Dock',
- icon = gcolor.recolor_image(icondir .. 'context_menu/entry.svg', Theme_config.dock.cm_icon),
+ icon = gcolor.recolor_image(icondir .. 'context_menu/entry.svg', beautiful.colorscheme.bg_yellow),
callback = function()
local data = config.read_json(gfilesystem.get_configuration_dir() .. 'src/config/dock_' .. self.screen.index .. '.json')
for i, v in ipairs(data) do
@@ -243,11 +246,8 @@ end
---@param args {desktop_file: string} The path to the .desktop file
function dock:pin_element(args)
if not args then return end
-
local e = args.desktop_file
- assert(e, 'No desktop file provided')
-
self:emit_signal('dock::pin_element', e)
self:write_elements_to_file_async()
@@ -267,19 +267,19 @@ function dock:add_start_element()
id = 'icon_role',
},
widget = wibox.container.constraint,
- width = User_config.dock_icon_size,
- height = User_config.dock_icon_size,
+ width = beautiful.user_config.dock_icon_size,
+ height = beautiful.user_config.dock_icon_size,
},
widget = wibox.container.margin,
margins = dpi(5),
},
widget = wibox.container.constraint,
- width = User_config.dock_icon_size + dpi(10), -- + margins
- height = User_config.dock_icon_size + dpi(10),
+ width = beautiful.user_config.dock_icon_size + dpi(10), -- + margins
+ height = beautiful.user_config.dock_icon_size + dpi(10),
strategy = 'exact',
},
- bg = Theme_config.dock.element.bg,
- shape = Theme_config.dock.element.shape,
+ bg = beautiful.colorscheme.bg1,
+ shape = beautiful.shape[8],
widget = wibox.container.background,
}
@@ -297,9 +297,6 @@ function dock:add_start_element()
return widget
end
----Unpins an element from the dock by removing it from the pinned table, then writes the table to the file
----emits the signal `dock::unpin_element` then successfully removed from the table
----@param args {desktop_file: string} The path to the .desktop file
function dock:unpin_element(args)
if not args then return end
@@ -367,7 +364,7 @@ local function check_for_dock_hide(self, a_popup)
minimized = false
local y = c:geometry().y
local h = c.height
- if (y + h) >= self.screen.geometry.height - User_config.dock_icon_size - 35 then
+ if (y + h) >= self.screen.geometry.height - beautiful.user_config.dock_icon_size - 35 then
self.visible = false
return
else
@@ -451,7 +448,7 @@ function dock.new(args)
forced_width = dpi(2),
forced_height = dpi(20),
thickness = dpi(2),
- color = Theme_config.dock.element.border,
+ color = beautiful.colorscheme.border_color,
},
{
spacing = dpi(5),
@@ -473,7 +470,7 @@ function dock.new(args)
ontop = true,
visible = true,
placement = function(c) aplacement.bottom(c, { margins = dpi(10) }) end,
- bg = Theme_config.dock.bg,
+ bg = beautiful.colorscheme.bg,
screen = args.screen,
}
@@ -500,7 +497,7 @@ function dock.new(args)
forced_height = dpi(20),
forced_width = dpi(2),
thickness = dpi(2),
- color = Theme_config.dock.element.border,
+ color = beautiful.colorscheme.border_color,
},
widget = wibox.container.margin,
right = dpi(5),
@@ -520,19 +517,19 @@ function dock.new(args)
id = 'icon_role',
},
widget = wibox.container.constraint,
- width = User_config.dock_icon_size,
- height = User_config.dock_icon_size,
+ width = beautiful.user_config.dock_icon_size,
+ height = beautiful.user_config.dock_icon_size,
},
widget = wibox.container.margin,
margins = dpi(5),
},
widget = wibox.container.constraint,
- width = User_config.dock_icon_size + dpi(10), -- + margins
- height = User_config.dock_icon_size + dpi(10),
+ width = beautiful.user_config.dock_icon_size + dpi(10), -- + margins
+ height = beautiful.user_config.dock_icon_size + dpi(10),
strategy = 'exact',
},
- bg = Theme_config.dock.element.bg,
- shape = Theme_config.dock.element.shape,
+ bg = beautiful.colorscheme.bg1,
+ shape = beautiful.shape[8],
widget = wibox.container.background,
}
@@ -543,15 +540,19 @@ function dock.new(args)
}
element:buttons(gtable.join(
- abutton({}, 1, function(c)
- if c == client.focus then
- c.minimized = true
+ abutton({}, 1, function()
+ if client == client.focus then
+ client.minimized = true
else
- c:emit_signal('request::activate', 'tasklist', { raise = true })
+ if client.first_tag then
+ client.first_tag:view_only()
+ end
+ client:emit_signal('request::activate')
+ client:raise()
end
end),
abutton({}, 3, function()
- amenu.client_list { theme = { width = dpi(250) } }
+ --TODO: Add context menu with options
end)
))
diff --git a/awesome/src/modules/crylia_bar/init.lua b/awesome/src/modules/crylia_bar/init.lua
index c803644..fc78042 100644
--- a/awesome/src/modules/crylia_bar/init.lua
+++ b/awesome/src/modules/crylia_bar/init.lua
@@ -1,71 +1,71 @@
---------------------------------------------------------------------------------------------------------------
--- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
---------------------------------------------------------------------------------------------------------------
+local tinsert = table.insert
+local ipairs = ipairs
-return function(s)
- ---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_kind))
- elseif widget == 'Bluetooth' then
- table.insert(widget_table, require('src.widgets.bluetooth')(s))
- 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'))
- 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')(s))
- 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') { screen = s })
- 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')())
- 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))
+local beautiful = require('beautiful')
+
+return setmetatable({}, {
+ __call = function(_, s)
+ local function get_widgets(widgets)
+ local widget_table = {}
+ if widgets then
+ for _, widget in ipairs(widgets) do
+ if widget == 'Audio' then
+ tinsert(widget_table, require('src.widgets.audio')(s))
+ elseif widget == 'Battery' then
+ tinsert(widget_table, require('src.widgets.battery')(beautiful.user_config.battery_kind))
+ elseif widget == 'Bluetooth' then
+ tinsert(widget_table, require('src.widgets.bluetooth')(s))
+ elseif widget == 'Clock' then
+ tinsert(widget_table, require('src.widgets.clock') {})
+ elseif widget == 'Cpu Frequency' then
+ tinsert(widget_table, require('src.widgets.cpu_info')('freq'))
+ elseif widget == 'Cpu Temperature' then
+ tinsert(widget_table, require('src.widgets.cpu_info')('temp'))
+ elseif widget == 'Cpu Usage' then
+ tinsert(widget_table, require('src.widgets.cpu_info')('usage'))
+ elseif widget == 'Date' then
+ tinsert(widget_table, require('src.widgets.date')(s))
+ elseif widget == 'Gpu Temperature' then
+ tinsert(widget_table, require('src.widgets.gpu_info')('temp'))
+ elseif widget == 'Gpu Usage' then
+ tinsert(widget_table, require('src.widgets.gpu_info')('usage'))
+ elseif widget == 'Keyboard Layout' then
+ tinsert(widget_table, require('src.widgets.kblayout')(s))
+ elseif widget == 'Tiling Layout' then
+ tinsert(widget_table, require('src.widgets.layout_list')(s))
+ elseif widget == 'Network' then
+ tinsert(widget_table, require('src.widgets.network')(s))
+ elseif widget == 'Power Button' then
+ tinsert(widget_table, require('src.widgets.power') {})
+ elseif widget == 'Ram Usage' then
+ tinsert(widget_table, require('src.widgets.ram_info') {})
+ elseif widget == 'Systray' then
+ tinsert(widget_table, require('src.widgets.systray') {})
+ elseif widget == 'Taglist' then
+ tinsert(widget_table, require('src.widgets.taglist')(s))
+ elseif widget == 'Tasklist' then
+ tinsert(widget_table, require('src.widgets.tasklist')(s))
+ end
+ end
+ end
+ return widget_table
+ end
+
+ if beautiful.user_config.crylia_bar then
+ for index, screen in ipairs(beautiful.user_config.crylia_bar) 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
- return widget_table
- end
-
- if User_config.crylia_bar then
- for index, screen in ipairs(User_config.crylia_bar) 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') { screen = s }
-end
+ require('src.modules.crylia_bar.dock') { screen = s }
+ end,
+})
diff --git a/awesome/src/modules/crylia_bar/left_bar.lua b/awesome/src/modules/crylia_bar/left_bar.lua
index ab1c7da..a823706 100644
--- a/awesome/src/modules/crylia_bar/left_bar.lua
+++ b/awesome/src/modules/crylia_bar/left_bar.lua
@@ -1,66 +1,72 @@
---------------------------------------------------------------------------------------------------------------
--- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
---------------------------------------------------------------------------------------------------------------
+local tinsert = table.insert
+local pairs = pairs
+
-- Awesome Libs
-local awful = require('awful')
+local aplacement = require('awful.placement')
+local apopup = require('awful.popup')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox')
-return function(s, w)
- local function prepare_widgets(widgets)
- local layout = {
- forced_height = dpi(50),
- layout = wibox.layout.fixed.horizontal,
- }
- for i, widget in pairs(widgets) do
- if i == 1 then
- table.insert(layout,
- {
- widget,
- left = dpi(6),
- right = dpi(3),
- top = dpi(6),
- bottom = dpi(6),
- widget = wibox.container.margin,
- })
- elseif i == #widgets then
- table.insert(layout,
- {
- widget,
- left = dpi(3),
- right = dpi(6),
- top = dpi(6),
- bottom = dpi(6),
- widget = wibox.container.margin,
- })
- else
- table.insert(layout,
- {
- widget,
- left = dpi(3),
- right = dpi(3),
- top = dpi(6),
- bottom = dpi(6),
- widget = wibox.container.margin,
- })
- end
- end
- return layout
- end
-
- local top_left = awful.popup {
- screen = s,
- widget = prepare_widgets(w),
- ontop = false,
- bg = Theme_config.left_bar.bg,
- visible = true,
- maximum_width = dpi(650),
- placement = function(c) awful.placement.top_left(c, { margins = dpi(10) }) end,
- }
-
- top_left:struts {
- top = dpi(55),
+local function prepare_widgets(w)
+ local layout = {
+ layout = wibox.layout.fixed.horizontal,
}
-
- Global_config.top_struts = dpi(55)
+ for i, widget in pairs(w) do
+ if i == 1 then
+ tinsert(layout,
+ {
+ widget,
+ left = dpi(6),
+ right = dpi(3),
+ top = dpi(6),
+ bottom = dpi(6),
+ widget = wibox.container.margin,
+ })
+ elseif i == #w then
+ tinsert(layout,
+ {
+ widget,
+ left = dpi(3),
+ right = dpi(6),
+ top = dpi(6),
+ bottom = dpi(6),
+ widget = wibox.container.margin,
+ })
+ else
+ tinsert(layout,
+ {
+ widget,
+ left = dpi(3),
+ right = dpi(3),
+ top = dpi(6),
+ bottom = dpi(6),
+ widget = wibox.container.margin,
+ })
+ end
+ end
+ return layout
end
+
+return setmetatable({}, {
+ __call = function(_, s, w)
+ local top_left = apopup {
+ screen = s,
+ widget = {
+ prepare_widgets(w),
+ widget = wibox.container.constraint,
+ strategy = 'exact',
+ height = dpi(50),
+ },
+ ontop = false,
+ bg = beautiful.colorscheme.bg,
+ visible = true,
+ maximum_width = dpi(850),
+ placement = function(c) aplacement.top_left(c, { margins = dpi(10) }) end,
+ }
+
+ top_left:struts {
+ top = dpi(60),
+ }
+ end,
+})
diff --git a/awesome/src/modules/crylia_bar/right_bar.lua b/awesome/src/modules/crylia_bar/right_bar.lua
index 2fd677d..4512701 100644
--- a/awesome/src/modules/crylia_bar/right_bar.lua
+++ b/awesome/src/modules/crylia_bar/right_bar.lua
@@ -1,65 +1,72 @@
---------------------------------------------------------------------------------------------------------------
--- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
---------------------------------------------------------------------------------------------------------------
+local tinsert = table.insert
+local pairs = pairs
+
-- Awesome Libs
-local awful = require('awful')
-local dpi = require('beautiful').xresources.apply_dpi
+local aplacement = require('awful.placement')
+local apopup = require('awful.popup')
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
local wibox = require('wibox')
-return function(s, w)
- local function prepare_widgets(widgets)
- local layout = {
- forced_height = dpi(50),
- layout = wibox.layout.fixed.horizontal,
- }
- for i, widget in pairs(widgets) do
- if i == 1 then
- table.insert(layout,
- {
- widget,
- left = dpi(6),
- right = dpi(3),
- top = dpi(6),
- bottom = dpi(6),
- widget = wibox.container.margin,
- })
- elseif i == #widgets then
- table.insert(layout,
- {
- widget,
- left = dpi(3),
- right = dpi(6),
- top = dpi(6),
- bottom = dpi(6),
- widget = wibox.container.margin,
- })
- else
- table.insert(layout,
- {
- widget,
- left = dpi(3),
- right = dpi(3),
- top = dpi(6),
- bottom = dpi(6),
- widget = wibox.container.margin,
- })
- end
+local function prepare_widgets(w)
+ local layout = {
+ layout = wibox.layout.fixed.horizontal,
+ }
+
+ for i, widget in pairs(w) do
+ if i == 1 then
+ tinsert(layout,
+ {
+ widget,
+ left = dpi(6),
+ right = dpi(3),
+ top = dpi(6),
+ bottom = dpi(6),
+ widget = wibox.container.margin,
+ })
+ elseif i == #w then
+ tinsert(layout,
+ {
+ widget,
+ left = dpi(3),
+ right = dpi(6),
+ top = dpi(6),
+ bottom = dpi(6),
+ widget = wibox.container.margin,
+ })
+ else
+ tinsert(layout,
+ {
+ widget,
+ left = dpi(3),
+ right = dpi(3),
+ top = dpi(6),
+ bottom = dpi(6),
+ widget = wibox.container.margin,
+ })
end
- return layout
end
-
- local top_right = awful.popup {
- widget = prepare_widgets(w),
- ontop = false,
- bg = Theme_config.right_bar.bg,
- visible = true,
- screen = s,
- placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end,
- }
-
- top_right:struts {
- top = dpi(55),
- }
-
- Global_config.top_struts = top_right
+ return layout
end
+
+return setmetatable({}, {
+ __call = function(_, s, w)
+ local top_right = apopup {
+ widget = {
+ prepare_widgets(w),
+ widget = wibox.container.constraint,
+ strategy = 'exact',
+ height = dpi(50),
+ },
+ ontop = false,
+ bg = beautiful.colorscheme.bg,
+ visible = true,
+ screen = s,
+ placement = function(c) aplacement.top_right(c, { margins = dpi(10) }) end,
+ }
+
+ top_right:struts {
+ top = dpi(60),
+ }
+ end,
+})
diff --git a/awesome/src/modules/crylia_wibox/init.lua b/awesome/src/modules/crylia_wibox/init.lua
index 08c446f..7b12b44 100644
--- a/awesome/src/modules/crylia_wibox/init.lua
+++ b/awesome/src/modules/crylia_wibox/init.lua
@@ -4,6 +4,7 @@
local wibox = require('wibox')
local dpi = require('beautiful').xresources.apply_dpi
local gshape = require('gears.shape')
+local beautiful = require('beautiful')
return function(s)
---Lookup function to return the widget from its easy name string
@@ -16,13 +17,13 @@ return function(s)
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_kind))
+ table.insert(widget_table, require('src.widgets.battery')(beautiful.user_config.battery_kind))
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))
+ table.insert(widget_table, require('src.widgets.cpu_info')('freq', beautiful.user_config.cpu_frequency))
elseif widget == 'Cpu Temperature' then
table.insert(widget_table, require('src.widgets.cpu_info')('temp'))
elseif widget == 'Cpu Usage' then
@@ -55,8 +56,8 @@ return function(s)
return widget_table
end
- if User_config.crylia_wibox then
- for index, screen in ipairs(User_config.crylia_wibox) do
+ if beautiful.user_config.crylia_wibox then
+ for index, screen in ipairs(beautiful.user_config.crylia_wibox) do
if index == s.index then
local function prepare_widgets(widgets)
local layout = {
@@ -112,17 +113,15 @@ return function(s)
type = 'desktop',
height = dpi(55),
width = 1920,
- bg = '#212121',
+ bg = beautiful.colorscheme.bg,
shape = function(cr, width, height)
- gshape.partially_rounded_rect(cr, width, height, true, true, false, false, 8)
+ gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(8))
end,
}
w:struts {
- bottom = dpi(55),
+ bottom = dpi(60),
}
-
- Global_config.bottom_struts = dpi(55)
end
end
end
diff --git a/awesome/src/modules/desktop/desktop.lua b/awesome/src/modules/desktop/desktop.lua
index d8e62b9..4ce099d 100644
--- a/awesome/src/modules/desktop/desktop.lua
+++ b/awesome/src/modules/desktop/desktop.lua
@@ -1,6 +1,7 @@
local Gio = require('lgi').Gio
local awful = require('awful')
local dpi = require('beautiful').xresources.apply_dpi
+local beautiful = require('beautiful')
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
local grid = require('wibox.layout.grid')
@@ -17,6 +18,7 @@ local capi = {
awesome = awesome,
screen = screen,
}
+
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/desktop/'
local desktop = { mt = {} }
@@ -88,14 +90,14 @@ end
function desktop:get_grid_index_at(y, x)
local margin_x, margin_y = dpi(10), dpi(10)
local screen_width, screen_height = self.args.screen.geometry.width - margin_x * 2, self.args.screen.geometry.height - dpi(75) - dpi(95) - margin_y * 2
- local cell_width, cell_height = screen_width / 20, screen_height / 11
+ local cell_width, cell_height = screen_width / 15, screen_height / 8
local col = math.floor((x - margin_x) / cell_width) + 1
- col = math.min(col, 20)
+ col = math.min(col, 15)
col = math.max(col, 1)
local row = math.floor((y - margin_y) / cell_height) + 1
- row = math.min(row, 11)
+ row = math.min(row, 8)
row = math.max(row, 1)
return col, row
@@ -159,32 +161,32 @@ function desktop:add_element(args, pos)
entries = {
{
name = 'Open with',
- icon = gcolor.recolor_image(icondir .. 'launch.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'launch.svg', beautiful.colorscheme.bg_purple),
submenu = {
--!TODO: Fetch programs and add them as entries
},
},
{
name = 'Copy',
- icon = gcolor.recolor_image(icondir .. 'copy.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'copy.svg', beautiful.colorscheme.bg_purple),
callback = function()
end,
},
{
name = 'Cut',
- icon = gcolor.recolor_image(icondir .. 'cut.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'cut.svg', beautiful.colorscheme.bg_purple),
callback = function()
end,
},
{
name = 'Rename',
- icon = gcolor.recolor_image(icondir .. 'edit.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'edit.svg', beautiful.colorscheme.bg_purple),
callback = function()
end,
},
{
name = 'Remove',
- icon = gcolor.recolor_image(icondir .. 'delete.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'delete.svg', beautiful.colorscheme.bg_purple),
callback = function()
self:remove_element(e)
self:save_layout()
@@ -192,7 +194,7 @@ function desktop:add_element(args, pos)
},
{
name = 'Actions',
- icon = gcolor.recolor_image(icondir .. 'dots-vertical.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'dots-vertical.svg', beautiful.colorscheme.bg_purple),
submenu = {
-- TODO: fetch actions from desktop file
},
@@ -295,9 +297,7 @@ function desktop:draw_selector()
x = start_pos.x - self.args.screen.geometry.x,
y = start_pos.y - self.args.screen.geometry.y,
visible = true,
- shape = function(cr, w, h)
- gshape.rounded_rect(cr, w, h, dpi(10))
- end,
+ shape = beautiful.shape[10],
}
selector.point = { x = start_pos.x - self.args.screen.geometry.x, y = start_pos.y - self.args.screen.geometry.y }
self.widget.manual:add(selector)
@@ -359,8 +359,8 @@ function desktop.new(args)
args.icon_size = dpi(48)
- local rows = 20
- local cols = 11
+ local rows = 15
+ local cols = 8
local h_spacing = dpi(10)
local v_spacing = dpi(20)
@@ -449,11 +449,11 @@ function desktop.new(args)
entries = {
{
name = 'Create new',
- icon = gcolor.recolor_image(icondir .. 'file_add.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'file_add.svg', beautiful.colorscheme.bg_purple),
submenu = {
{
name = 'Folder',
- icon = gcolor.recolor_image(icondir .. 'folder.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'folder.svg', beautiful.colorscheme.bg_purple),
callback = function()
--create a new folder and if it exists add a number to the end
local folder_name = 'New folder'
@@ -475,7 +475,7 @@ function desktop.new(args)
},
{
name = 'File',
- icon = gcolor.recolor_image(icondir .. 'file.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'file.svg', beautiful.colorscheme.bg_purple),
callback = function()
--create new text file and if it exists add a number to the end
local file_name = 'New file.txt'
@@ -499,76 +499,76 @@ function desktop.new(args)
},
{
name = 'Terminal',
- icon = gcolor.recolor_image(icondir .. 'terminal.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'terminal.svg', beautiful.colorscheme.bg_purple),
callback = function()
- awful.spawn(User_config.terminal)
+ awful.spawn(beautiful.user_config.terminal)
end,
},
{
name = 'Web Browser',
- icon = gcolor.recolor_image(icondir .. 'web_browser.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'web_browser.svg', beautiful.colorscheme.bg_purple),
callback = function()
- awful.spawn(User_config.web_browser)
+ awful.spawn(beautiful.user_config.web_browser)
end,
},
{
name = 'File Manager',
- icon = gcolor.recolor_image(icondir .. 'file_manager.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'file_manager.svg', beautiful.colorscheme.bg_purple),
callback = function()
- awful.spawn(User_config.file_manager)
+ awful.spawn(beautiful.user_config.file_manager)
end,
},
{
name = 'Text Editor',
- icon = gcolor.recolor_image(icondir .. 'text_editor.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'text_editor.svg', beautiful.colorscheme.bg_purple),
callback = function()
- awful.spawn(User_config.text_editor)
+ awful.spawn(beautiful.user_config.text_editor)
end,
},
{
name = 'Music Player',
- icon = gcolor.recolor_image(icondir .. 'music_player.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'music_player.svg', beautiful.colorscheme.bg_purple),
callback = function()
- awful.spawn(User_config.music_player)
+ awful.spawn(beautiful.user_config.music_player)
end,
},
{
name = 'Applications',
- icon = gcolor.recolor_image(icondir .. 'application.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'application.svg', beautiful.colorscheme.bg_purple),
callback = function()
end,
},
{
name = 'GTK Settings',
- icon = gcolor.recolor_image(icondir .. 'gtk_settings.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'gtk_settings.svg', beautiful.colorscheme.bg_purple),
callback = function()
- awful.spawn(User_config.gtk_settings)
+ awful.spawn(beautiful.user_config.gtk_settings)
end,
},
{
name = 'Energy Settings',
- icon = gcolor.recolor_image(icondir .. 'energy_settings.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'energy_settings.svg', beautiful.colorscheme.bg_purple),
callback = function()
- awful.spawn(User_config.energy_manager)
+ awful.spawn(beautiful.user_config.energy_manager)
end,
},
{
name = 'Screen Settings',
- icon = gcolor.recolor_image(icondir .. 'screen_settings.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'screen_settings.svg', beautiful.colorscheme.bg_purple),
callback = function()
- awful.spawn(User_config.screen_settings)
+ awful.spawn(beautiful.user_config.screen_settings)
end,
},
{
name = 'Reload Awesome',
- icon = gcolor.recolor_image(icondir .. 'refresh.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'refresh.svg', beautiful.colorscheme.bg_purple),
callback = function()
capi.awesome.restart()
end,
},
{
name = 'Quit',
- icon = gcolor.recolor_image(icondir .. 'quit.svg', Theme_config.desktop.context_menu.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'quit.svg', beautiful.colorscheme.bg_purple),
callback = function()
capi.awesome.quit()
end,
diff --git a/awesome/src/modules/desktop/element.lua b/awesome/src/modules/desktop/element.lua
index 89a0e50..0f3a9eb 100644
--- a/awesome/src/modules/desktop/element.lua
+++ b/awesome/src/modules/desktop/element.lua
@@ -1,4 +1,5 @@
local base = require('wibox.widget.base')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gshape = require('gears.shape')
@@ -7,6 +8,8 @@ local lgi = require('lgi')
local cairo = lgi.cairo
local wibox = require('wibox')
+local input = require('src.modules.inputbox')
+
local element = { mt = {} }
function element:layout(_, width, height)
@@ -196,6 +199,12 @@ function element.new(args)
local text_img, size = outlined_text(args.label, args.width)
+ local inputbox = input {
+ font = 'JetBrainsMono Nerd Font 12 Regular',
+ mouse_focus = false,
+ text = args.label,
+ }
+
local w = base.make_widget_from_value(wibox.widget {
{
{
@@ -231,7 +240,7 @@ function element.new(args)
halign = 'center',
widget = wibox.container.place,
},
- fg = '#ffffff',
+ fg = beautiful.colorscheme.fg,
bg = gcolor.transparent,
border_color = gcolor.transparent,
border_width = dpi(2),
diff --git a/awesome/src/modules/init.lua b/awesome/src/modules/init.lua
index 76e98b8..f5f1a8f 100644
--- a/awesome/src/modules/init.lua
+++ b/awesome/src/modules/init.lua
@@ -1,45 +1,32 @@
---------------------------------------------------------------------------------------------------------------
--- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
---------------------------------------------------------------------------------------------------------------
+local tinsert = table.insert
+local load = load
+local ipairs = ipairs
+
-- Awesome Libs
local awful = require('awful')
+local beautiful = require('beautiful')
-awful.screen.connect_for_each_screen(function(s)
- -- Create 9 tags
- awful.layout.append_default_layouts(User_config.layouts)
- awful.tag({ '1', '2', '3', '4', '5', '6', '7', '8', '9' }, s, User_config.layouts[1])
+local instance = nil
+if not instance then
+ instance = setmetatable({}, {
+ __call = function()
+ awful.screen.connect_for_each_screen(function(s)
+ local layouts = {}
+ for _, str in ipairs(beautiful.user_config.layouts) do
+ tinsert(layouts, load('return ' .. str, nil, 't', { awful = awful })())
+ end
- require('src.modules.desktop.desktop') { screen = s }
- require('src.modules.crylia_bar.init')(s)
- --require('src.modules.crylia_wibox.init')(s)
- require('src.modules.notification-center.init') { screen = s }
- --require('src.modules.window_switcher.init')(s)
- require('src.modules.application_launcher.init') { screen = s }
-end)
+ awful.layout.append_default_layouts(layouts)
+ awful.tag({ '1', '2', '3', '4', '5', '6', '7', '8', '9' }, s, layouts[1])
-local ip = require('src.modules.inputbox.init') {
- text = 'inputboxtest',
- cursor_pos = 4,
- highlight = {
- start_pos = 1,
- end_pos = 4,
- },
- text_hint = 'Start typing...',
-}
-
---[[ awful.popup {
- widget = ip.widget,
- bg = '#212121',
- visible = true,
- screen = 1,
- placement = awful.placement.centered,
-} ]]
---[[ require('src.modules.inputbox.init') {
- text = 'inputboxtest',
- cursor_pos = 4,
- highlight = {
- start_pos = 5,
- end_pos = 8,
- },
-}
- ]]
+ require('src.modules.desktop.desktop') { screen = s }
+ require('src.modules.crylia_bar')(s)
+ --require('src.modules.crylia_wibox.init')(s)
+ require('src.modules.notification-center') { screen = s }
+ --require('src.modules.window_switcher.init') { screen = s }
+ require('src.modules.application_launcher') { screen = s }
+ end)
+ end,
+ })
+end
+return instance
diff --git a/awesome/src/modules/inputbox/init.lua b/awesome/src/modules/inputbox/init.lua
index 61a3b51..f1c0a58 100644
--- a/awesome/src/modules/inputbox/init.lua
+++ b/awesome/src/modules/inputbox/init.lua
@@ -2,6 +2,7 @@ local Pango = require('lgi').Pango
local PangoCairo = require('lgi').PangoCairo
local akey = require('awful.key')
local akeygrabber = require('awful.keygrabber')
+local beautiful = require('beautiful')
local cairo = require('lgi').cairo
local gobject = require('gears.object')
local gtable = require('gears.table')
@@ -33,21 +34,10 @@ local function get_subtext_layout(layout, starti, endi)
end
function inputbox.draw_text(self)
- local text = self:get_text()
local highlight = self:get_highlight()
local fg_color = { 1, 1, 1, 1 }
local cursor_color = { 1, 1, 1, 1 }
- if text == '' then
- fg_color = { 0.2, 0.2, 0.2, 1 }
- --self._private.layout:set_text(self._private.text_hint)
- --local cairo_text = self._private.text_hint
- -- Get the text extents from Pango so we don't need to use cairo to get a possibly wrong extent
- -- Then draw the text with cairo
-
- --return
- end
-
local _, pango_extent = self._private.layout:get_extents()
local surface = cairo.ImageSurface(cairo.Format.ARGB32, (pango_extent.width / Pango.SCALE) + pango_extent.x + 2, (pango_extent.height / Pango.SCALE) + pango_extent.y)
@@ -56,8 +46,8 @@ function inputbox.draw_text(self)
-- Draw highlight
if highlight.start_pos ~= highlight.end_pos then
cr:set_source_rgb(0, 0, 1)
- local sub_extent = get_subtext_layout(self._private.layout, self:get_highlight().start_pos, self:get_highlight().end_pos)
- local _, x_offset = self._private.layout:index_to_line_x(self:get_highlight().start_pos, false)
+ local sub_extent = get_subtext_layout(self._private.layout, highlight.start_pos, highlight.end_pos)
+ local _, x_offset = self._private.layout:index_to_line_x(highlight.start_pos, false)
cr:rectangle(
x_offset / Pango.SCALE,
pango_extent.y / Pango.SCALE,
@@ -68,23 +58,11 @@ function inputbox.draw_text(self)
end
-- Draw text
- if not self.password_mode then
- PangoCairo.update_layout(cr, self._private.layout)
- cr:set_source_rgba(table.unpack(fg_color))
- cr:move_to(0, 0)
- PangoCairo.show_layout(cr, self._private.layout)
- else
- local count = #self._private.layout:get_text()
- local passwd_string = ''
- for i = 1, count, 1 do
- passwd_string = passwd_string .. '🞄'
- end
- self._private.layout:set_text(passwd_string)
- PangoCairo.update_layout(cr, self._private.layout)
- cr:set_source_rgba(table.unpack(fg_color))
- cr:move_to(0, 0)
- PangoCairo.show_layout(cr, self._private.layout)
- end
+ PangoCairo.update_layout(cr, self._private.layout)
+ cr:set_source_rgba(table.unpack(fg_color))
+ cr:move_to(0, 0)
+ PangoCairo.show_layout(cr, self._private.layout)
+
-- Draw cursor
if self._private.show_cursor then
cr:set_source_rgba(table.unpack(cursor_color))
@@ -141,7 +119,6 @@ function inputbox:start_keygrabber()
self:set_text(text:sub(1, cursor_pos - 1) .. text:sub(cursor_pos + 1))
self:set_cursor_pos(cursor_pos - 1)
end
- self:emit_signal('inputbox::keypressed', {}, 'BackSpace')
end,
},
akey { -- Delete highlight or right of cursor
@@ -158,7 +135,6 @@ function inputbox:start_keygrabber()
else
self:set_text(text:sub(1, cursor_pos) .. text:sub(cursor_pos + 2, #text))
end
- self:emit_signal('inputbox::keypressed', {}, 'Delete')
end,
},
akey { -- Move cursor to left
@@ -211,8 +187,6 @@ function inputbox:start_keygrabber()
self:set_cursor_pos(cursor_pos - 1)
self:set_highlight(nil, hl.end_pos - 1)
end
-
- print('cursor_pos', self:get_cursor_index(), 'hl.start_pos', self:get_highlight().start_pos, 'hl.end_pos', self:get_highlight().end_pos)
end,
},
akey { -- Highlight to the right
@@ -405,7 +379,6 @@ function inputbox:start_mousegrabber(x, y)
self:set_cursor_pos(index)
mb_start = index
end
- print(self:get_highlight().start_pos, self:get_highlight().end_pos)
hl = self:get_highlight()
return m.buttons[1]
end, 'xterm')
@@ -428,7 +401,7 @@ end
function inputbox:set_text(text)
if self:get_text() == text then return end
- text = '' .. text .. ''
+ text = '' .. text .. ''
local attributes, parsed = Pango.parse_markup(text, -1, 0)
@@ -524,7 +497,7 @@ function inputbox.new(args)
trailing = 0,
}
- ret._private.fg = args.fg or '#ffffff'
+ ret._private.fg = args.fg or beautiful.colorscheme.fg
ret._private.highlight = args.highlight or {
start_pos = 0,
end_pos = 0,
diff --git a/awesome/src/modules/network_controller/access_point.lua b/awesome/src/modules/network_controller/access_point.lua
index 8028bba..82140f8 100644
--- a/awesome/src/modules/network_controller/access_point.lua
+++ b/awesome/src/modules/network_controller/access_point.lua
@@ -5,6 +5,7 @@
-- Awesome Libs
local abutton = require('awful.button')
local awidget = require('awful.widget')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears').table
local gfilesystem = require('gears').filesystem
@@ -169,7 +170,7 @@ function access_point.new(args)
{
image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(args.NetworkManagerAccessPoint.Strength / 25) + 1 .. '.svg',
- Theme_config.network_manager.access_point.icon_color),
+ beautiful.colorscheme.bg_red),
id = 'icon',
resize = true,
valign = 'center',
@@ -237,12 +238,12 @@ function access_point.new(args)
margins = dpi(5),
widget = wibox.container.margin,
},
- bg = Theme_config.network_manager.access_point.bg,
- fg = Theme_config.network_manager.access_point.fg,
- border_color = Theme_config.network_manager.access_point.border_color,
- border_width = Theme_config.network_manager.access_point.border_width,
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.bg_red,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
id = 'background',
- shape = Theme_config.network_manager.access_point.device_shape,
+ shape = beautiful.shape[8],
widget = wibox.container.background,
})
@@ -270,31 +271,31 @@ function access_point.new(args)
if ret.is_ap_active(ret.NetworkManagerAccessPoint.object_path) then
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(data.Strength / 25) + 1 .. '.svg',
- Theme_config.network_manager.access_point.icon_color2)
+ beautiful.colorscheme.bg)
else
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(data.Strength / 25) + 1 .. '.svg',
- Theme_config.network_manager.access_point.icon_color)
+ beautiful.colorscheme.bg_red)
end
end
end, 'PropertiesChanged')
if ret:is_ap_active(ret.NetworkManagerAccessPoint) then
- ret.bg = Theme_config.network_manager.access_point.fg
- ret.fg = Theme_config.network_manager.access_point.bg
+ ret.bg = beautiful.colorscheme.bg_red
+ ret.fg = beautiful.colorscheme.bg
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(ret.NetworkManagerAccessPoint.Strength / 25) + 1 .. '.svg',
- Theme_config.network_manager.access_point.icon_color2)
+ beautiful.colorscheme.bg)
ret:get_children_by_id('con')[1].image = gcolor.recolor_image(
- icondir .. 'link.svg', Theme_config.network_manager.access_point.icon_color2)
+ icondir .. 'link.svg', beautiful.colorscheme.bg)
else
- ret.bg = Theme_config.network_manager.access_point.bg
- ret.fg = Theme_config.network_manager.access_point.fg
+ ret.bg = beautiful.colorscheme.bg
+ ret.fg = beautiful.colorscheme.bg_red
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(ret.NetworkManagerAccessPoint.Strength / 25) + 1 .. '.svg',
- Theme_config.network_manager.access_point.icon_color)
+ beautiful.colorscheme.bg_red)
ret:get_children_by_id('con')[1].image = gcolor.recolor_image(
- icondir .. 'link.svg', Theme_config.network_manager.access_point.icon_color)
+ icondir .. 'link.svg', beautiful.colorscheme.bg_red)
end
ret.ap_form = ap_form {
@@ -338,7 +339,7 @@ function access_point.new(args)
name = 'ret.device.Connected' and 'Disconnect' or 'Connect',
icon = gcolor.recolor_image('ret.device.Connected' and icondir .. 'link-off.svg' or
icondir .. 'link.svg',
- Theme_config.network_manager.access_point.icon_color),
+ beautiful.colorscheme.bg_red),
callback = function()
ret:toggle_connection(ret.NetworkManagerAccessPoint)
end,
diff --git a/awesome/src/modules/network_controller/ap_form.lua b/awesome/src/modules/network_controller/ap_form.lua
index 3916c90..72224c4 100644
--- a/awesome/src/modules/network_controller/ap_form.lua
+++ b/awesome/src/modules/network_controller/ap_form.lua
@@ -2,6 +2,7 @@ local abutton = require('awful.button')
local aplacement = require('awful.placement')
local apopup = require('awful.popup')
local awidget = require('awful.widget')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears.table')
local gcolor = require('gears.color')
@@ -42,7 +43,7 @@ function ap_form.new(args)
{
widget = wibox.widget.textbox,
text = NM.utils_ssid_to_utf8(args.NetworkManagerAccessPoint.Ssid),
- font = User_config.font.specify .. ',extra bold 16',
+ font = beautiful.user_config.font.specify .. ',extra bold 16',
halign = 'center',
valign = 'center',
},
@@ -53,7 +54,7 @@ function ap_form.new(args)
{
{
widget = wibox.widget.imagebox,
- image = gcolor.recolor_image(icondir .. 'close.svg', Theme_config.network_manager.form.icon_fg),
+ image = gcolor.recolor_image(icondir .. 'close.svg', beautiful.colorscheme.bg),
resize = false,
valign = 'center',
halign = 'center',
@@ -62,15 +63,15 @@ function ap_form.new(args)
margins = dpi(5),
},
widget = wibox.container.background,
- shape = Theme_config.network_manager.form.close_icon_shape,
+ shape = beautiful.shape[8],
id = 'close_button',
- bg = Theme_config.network_manager.form.close_bg,
+ bg = beautiful.colorscheme.bg_red,
},
layout = wibox.layout.align.horizontal,
},
widget = wibox.container.background,
- bg = Theme_config.network_manager.form.header_bg,
- fg = Theme_config.network_manager.form.header_fg,
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.bg_red,
},
{ -- Form
{ -- Password
@@ -100,10 +101,10 @@ function ap_form.new(args)
id = 'const',
},
widget = wibox.container.background,
- bg = '#212121',
- fg = '#F0F0F0',
- border_color = '#414141',
- border_width = 2,
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.fg,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
shape = gshape.rounded_rect,
forced_width = 300,
forced_height = 50,
@@ -117,12 +118,12 @@ function ap_form.new(args)
{
{
checked = false,
- shape = Theme_config.network_manager.form.checkbox_shape,
- color = Theme_config.network_manager.form.checkbox_fg,
+ shape = beautiful.shape[4],
+ color = beautiful.colorscheme.bg,
paddings = dpi(3),
- check_color = Theme_config.network_manager.form.checkbox_bg,
- border_color = Theme_config.network_manager.form.checkbox_bg,
- border_width = 2,
+ check_color = beautiful.colorscheme.bg_red,
+ border_color = beautiful.colorscheme.bg_red,
+ border_width = dpi(2),
id = 'checkbox',
widget = wibox.widget.checkbox,
},
@@ -158,9 +159,9 @@ function ap_form.new(args)
margins = dpi(10),
},
widget = wibox.container.background,
- bg = Theme_config.network_manager.form.button_bg,
- fg = Theme_config.network_manager.form.button_fg,
- shape = Theme_config.network_manager.form.button_shape,
+ bg = beautiful.colorscheme.bg_blue,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[8],
id = 'connect_button',
},
widget = wibox.container.margin,
@@ -179,11 +180,10 @@ function ap_form.new(args)
visible = false,
width = dpi(600),
height = dpi(400),
- bg = Theme_config.network_manager.form.bg,
- fg = Theme_config.network_manager.form.fg,
- shape = Theme_config.network_manager.form.shape,
- border_color = Theme_config.network_manager.form.border_color,
- border_width = Theme_config.network_manager.form.border_width,
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.fg,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
type = 'dialog',
screen = args.screen,
}
diff --git a/awesome/src/modules/network_controller/init.lua b/awesome/src/modules/network_controller/init.lua
index 2ff6dd2..9517731 100644
--- a/awesome/src/modules/network_controller/init.lua
+++ b/awesome/src/modules/network_controller/init.lua
@@ -6,6 +6,7 @@
local abutton = require('awful.button')
local base = require('wibox.widget.base')
local dbus_proxy = require('src.lib.lua-dbus_proxy.src.dbus_proxy')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
@@ -168,7 +169,7 @@ function network:scan_access_points()
app_name = 'Network Manager',
title = 'Error: Scan failed!',
message = 'Failed to scan for access points.\n' .. failure,
- icon = gcolor.recolor_image(icondir .. 'ethernet.svg', Theme_config.network.icon_color),
+ icon = gcolor.recolor_image(icondir .. 'ethernet.svg', beautiful.colorscheme.bg),
timeout = 5,
}
return
@@ -239,7 +240,7 @@ function network.new(args)
{
resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg',
- Theme_config.network_manager.wifi_icon_color),
+ beautiful.colorscheme.bg_red),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
@@ -263,11 +264,9 @@ function network.new(args)
layout = wibox.layout.fixed.horizontal,
},
id = 'wifi_bg',
- bg = Theme_config.network_manager.wifi_bg,
- fg = Theme_config.network_manager.wifi_fg,
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
+ bg = beautiful.colorscheme.bg1,
+ fg = beautiful.colorscheme.bg_red,
+ shape = beautiful.shape[4],
widget = wibox.container.background,
},
id = 'wifi_margin',
@@ -287,8 +286,8 @@ function network.new(args)
margins = dpi(10),
widget = wibox.container.margin,
},
- border_color = Theme_config.network_manager.ap_border_color,
- border_width = Theme_config.network_manager.ap_border_width,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
@@ -299,7 +298,7 @@ function network.new(args)
{ -- action buttons
{
dnd_widget {
- color = Theme_config.network_manager.power_icon_color,
+ color = beautiful.colorscheme.bg_red,
size = dpi(40),
},
id = 'dnd',
@@ -312,7 +311,7 @@ function network.new(args)
{
{
image = gcolor.recolor_image(icondir .. 'refresh.svg',
- Theme_config.network_manager.refresh_icon_color),
+ beautiful.colorscheme.bg_red),
resize = false,
valign = 'center',
halign = 'center',
@@ -324,11 +323,9 @@ function network.new(args)
id = 'center',
},
border_width = dpi(2),
- border_color = Theme_config.network_manager.border_color,
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- bg = Theme_config.network_manager.refresh_bg,
+ border_color = beautiful.colorscheme.border_color,
+ shape = beautiful.shape[4],
+ bg = beautiful.colorscheme.bg,
widget = wibox.container.background,
id = 'refresh',
},
@@ -345,12 +342,10 @@ function network.new(args)
margins = dpi(15),
widget = wibox.container.margin,
},
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- border_color = Theme_config.network_manager.border_color,
- border_width = Theme_config.network_manager.border_width,
- bg = Theme_config.network_manager.bg,
+ shape = beautiful.shape[8],
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ bg = beautiful.colorscheme.bg,
id = 'background',
widget = wibox.container.background,
},
@@ -460,14 +455,14 @@ function network.new(args)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
wifi.icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
- Theme_config.network_manager.wifi_icon_color))
+ beautiful.colorscheme.bg_red))
else
rubato_timer.target = 0
wifi_margin.wifi_bg.shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, true, true, true, true, dpi(4))
end
wifi.icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg',
- Theme_config.network_manager.wifi_icon_color))
+ beautiful.colorscheme.bg_red))
end
end
)
diff --git a/awesome/src/modules/notification-center/init.lua b/awesome/src/modules/notification-center/init.lua
index cc2aa1d..f4e032e 100644
--- a/awesome/src/modules/notification-center/init.lua
+++ b/awesome/src/modules/notification-center/init.lua
@@ -3,6 +3,7 @@
-------------------------------------
-- Awesome Libs
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gfilesystem = require('gears.filesystem')
local base = require('wibox.widget.base')
@@ -81,7 +82,7 @@ function info_center.new(args)
{
{
{
- bg = Theme_config.notification_center.spacing_line.color,
+ bg = beautiful.colorscheme.bg1,
widget = wibox.container.background,
},
widget = wibox.container.constraint,
@@ -152,8 +153,8 @@ function info_center.new(args)
{
dnd_widget {
text = 'Do not disturb',
- color = Theme_config.notification_center.dnd_color,
- fg = Theme_config.notification_center.dnd_fg,
+ color = beautiful.colorscheme.bg_purple,
+ fg = beautiful.colorscheme.bg_red,
size = dpi(40),
},
id = 'dnd',
@@ -171,11 +172,9 @@ function info_center.new(args)
widget = wibox.widget.textbox,
id = 'clear',
},
- fg = Theme_config.notification_center.clear_all_button.fg,
- bg = Theme_config.notification_center.clear_all_button.bg,
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, 12)
- end,
+ fg = beautiful.colorscheme.bg,
+ bg = beautiful.colorscheme.bg_blue,
+ shape = beautiful.shape[12],
id = 'clear_all_bg',
widget = wibox.container.background,
},
@@ -200,7 +199,7 @@ function info_center.new(args)
},
spacing_widget = {
thickness = dpi(2),
- color = Theme_config.notification_center.spacing_color,
+ color = beautiful.colorscheme.bg1,
span_ratio = 0.9,
widget = wibox.widget.separator,
},
@@ -243,14 +242,14 @@ function info_center.new(args)
end)
w:get_children_by_id('dnd')[1]:get_widget():connect_signal('dnd::toggle', function(enabled)
- User_config.dnd = enabled
+ beautiful.user_config.dnd = enabled
end)
w.container = apopup {
widget = w,
- bg = Theme_config.notification_center.bg,
- border_color = Theme_config.notification_center.border_color,
- border_width = Theme_config.notification_center.border_width,
+ bg = beautiful.colorscheme.bg,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
placement = function(c)
aplacement.top(c, { margins = dpi(10) })
end,
diff --git a/awesome/src/modules/notification-center/widgets/notification_list.lua b/awesome/src/modules/notification-center/widgets/notification_list.lua
index 578e319..1820132 100644
--- a/awesome/src/modules/notification-center/widgets/notification_list.lua
+++ b/awesome/src/modules/notification-center/widgets/notification_list.lua
@@ -7,9 +7,16 @@ local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox')
local naughty = require('naughty')
local gtimer = require('gears.timer')
+local beautiful = require('beautiful')
+local gcolor = require('gears.color')
+local gfilesystem = require('gears.filesystem')
+local gtable = require('gears.table')
+local abutton = require('awful.button')
local hover = require('src.tools.hover')
+local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/notifications/'
+
return setmetatable({}, {
__call = function()
local ret = wibox.widget {
@@ -19,35 +26,203 @@ return setmetatable({}, {
spacing = dpi(20),
}
- --!No, :get_children_by_id() does not work here for some reason, yes I hate it too
- --[[ naughty.connect_signal('notification_surface', function(b)
+ naughty.connect_signal('request::display', function(n)
local start_time = os.time()
- local w = wibox.template.make_from_value(b)
- w = w:get_widget()
- assert(type(w) == 'table', 'w is not a wibox.widget.base')
-
- -- Change the clock to a timer how long ago the notification was created
- w.children[1].children[1].children[1].children[1].children[1].children[2].children[1].children[1] = wibox.widget {
- text = 'now',
- font = 'JetBrainsMono Nerd Font, Bold 12',
- halign = 'center',
- valign = 'center',
- widget = wibox.widget.textbox,
+ local color = beautiful.colorscheme.bg_blue
+ local w = wibox.widget {
+ {
+ {
+ {
+ { -- Title
+ {
+ {
+ { -- Icon
+ {
+ {
+ {
+ {
+ notification = n,
+ widget = naughty.widget.icon,
+ image = n.icon,
+ resize = true,
+ },
+ widget = wibox.container.background,
+ shape = beautiful.shape[4],
+ },
+ widget = wibox.container.place,
+ },
+ widget = wibox.container.constraint,
+ strategy = 'exact',
+ width = dpi(20),
+ height = dpi(20),
+ },
+ { -- Title
+ {
+ notification = n,
+ widget = naughty.widget.title,
+ markup = [[]] .. (n.app_name or
+ 'Unknown App') .. [[ | ]] .. (n.title or 'System Notification') .. [[]],
+ halign = 'left',
+ valign = 'center',
+ },
+ widget = wibox.container.constraint,
+ width = dpi(430),
+ height = dpi(35),
+ strategy = 'max',
+ },
+ spacing = dpi(10),
+ layout = wibox.layout.fixed.horizontal,
+ },
+ widget = wibox.container.margin,
+ left = dpi(10),
+ },
+ nil,
+ {
+ {
+ { -- Clock
+ widget = wibox.widget.textbox,
+ test = 'now',
+ font = 'JetBrainsMono Nerd Font, Bold 12',
+ fg = beautiful.colorscheme.bg,
+ halign = 'center',
+ valign = 'center',
+ id = 'timer',
+ },
+ { -- Close button
+ {
+ {
+ {
+ {
+ widget = wibox.widget.imagebox,
+ image = gcolor.recolor_image(icondir .. 'close.svg', beautiful.colorscheme.bg),
+ resize = true,
+ halign = 'center',
+ valign = 'center',
+ },
+ start_angle = 4.71239,
+ thickness = dpi(2),
+ min_value = 0,
+ max_value = 1,
+ value = 1,
+ widget = wibox.container.arcchart,
+ id = 'arc',
+ },
+ fg = beautiful.colorscheme.bg,
+ bg = color,
+ widget = wibox.container.background,
+ id = 'arc_bg',
+ },
+ strategy = 'exact',
+ width = dpi(18),
+ height = dpi(18),
+ widget = wibox.container.constraint,
+ },
+ id = 'close',
+ visible = false,
+ left = dpi(5),
+ widget = wibox.container.margin,
+ },
+ layout = wibox.layout.fixed.horizontal,
+ },
+ right = dpi(5),
+ widget = wibox.container.margin,
+ },
+ layout = wibox.layout.align.horizontal,
+ },
+ widget = wibox.container.background,
+ bg = color,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[8],
+ },
+ { -- Main body
+ { -- Image
+ {
+ {
+ notification = n,
+ image = n.icon,
+ valign = 'center',
+ halign = 'center',
+ upscale = true,
+ resize_strategy = 'scale',
+ widget = naughty.widget.icon,
+ },
+ widget = wibox.container.background,
+ shape = beautiful.shape[10],
+ },
+ widget = wibox.container.constraint,
+ strategy = 'exact',
+ height = dpi(96),
+ width = dpi(96),
+ },
+ {
+ {
+ notification = n,
+ widget = naughty.widget.message,
+ font = 'JetBrainsMono Nerd Font, Regular 10',
+ halign = 'left',
+ valign = 'center',
+ },
+ widget = wibox.container.constraint,
+ strategy = 'exact',
+ height = dpi(96),
+ },
+ spacing = dpi(15),
+ layout = wibox.layout.fixed.horizontal,
+ },
+ { -- Spacer
+ {
+ widget = wibox.container.background,
+ bg = beautiful.colorscheme.bg,
+ },
+ widget = wibox.container.constraint,
+ strategy = 'exact',
+ height = dpi(2),
+ },
+ spacing = dpi(15),
+ id = 'main_layout',
+ layout = wibox.layout.fixed.vertical,
+ },
+ widget = wibox.container.margin,
+ margins = dpi(15),
+ },
+ bg = beautiful.colorscheme.bg,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ shape = beautiful.shape[8],
+ widget = wibox.container.background,
+ },
+ widget = wibox.container.constraint,
+ strategy = 'exact',
+ width = dpi(600),
}
-
- hover.bg_hover { widget = w.children[1].children[1].children[1].children[1].children[1].children[2].children[1].children[2].children[1].children[1] }
- w.children[1].children[1].children[1].children[1].children[1].children[2].children[1].children[2]:connect_signal('button::press', function()
- ret:remove_widgets(w)
- ret:emit_signal('new_children')
+ local close = w:get_children_by_id('close')[1]
+ w:connect_signal('mouse::enter', function()
+ close.visible = true
+ --w:get_children_by_id('timer')[1].visible = false
end)
+ w:connect_signal('mouse::leave', function()
+ close.visible = false
+ --w:get_children_by_id('timer')[1].visible = true
+ end)
+
+ hover.bg_hover(close.children[1])
+
+ close:buttons(gtable.join(
+ abutton({}, 1, function()
+ ret:remove_widgets(w)
+ ret:emit_signal('new_children')
+ end)
+ ))
+
gtimer {
timeout = 1,
autostart = true,
call_now = true,
callback = function()
local time_ago = math.floor(os.time() - start_time)
- local timer_text = w.children[1].children[1].children[1].children[1].children[1].children[2].children[1].children[1]
+ local timer_text = w:get_children_by_id('timer')[1]
if time_ago < 5 then
timer_text:set_text('now')
elseif time_ago < 60 then
@@ -64,7 +239,7 @@ return setmetatable({}, {
ret:add(w)
ret:emit_signal('new_children')
- end) ]]
+ end)
return ret
end,
diff --git a/awesome/src/modules/notification-center/widgets/profile.lua b/awesome/src/modules/notification-center/widgets/profile.lua
index 36886dc..72d5787 100644
--- a/awesome/src/modules/notification-center/widgets/profile.lua
+++ b/awesome/src/modules/notification-center/widgets/profile.lua
@@ -4,6 +4,7 @@
-- Awesome Libs
local aspawn = require('awful.spawn')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
@@ -30,9 +31,7 @@ if not instance then
image = gsurface.load_uncached(gfilesystem.get_configuration_dir() .. 'src/assets/userpfp/userpfp.png'),
valign = 'center',
halign = 'center',
- clip_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(12))
- end,
+ clip_shape = beautiful.shape[12],
widget = wibox.widget.imagebox,
},
strategy = 'exact',
@@ -46,10 +45,11 @@ if not instance then
{
{ -- Username
image = gcolor.recolor_image(icondir .. 'user.svg',
- Theme_config.notification_center.profile.username_icon_color),
+ beautiful.colorscheme.bg_blue),
valign = 'center',
halign = 'left',
- resize = false,
+ resize = true,
+ width = dpi(20),
widget = wibox.widget.imagebox,
},
{ -- Username
@@ -64,10 +64,11 @@ if not instance then
{
{
image = gcolor.recolor_image(icondir .. 'laptop.svg',
- Theme_config.notification_center.profile.os_prefix_icon_color),
+ beautiful.colorscheme.bg_blue),
valign = 'center',
halign = 'left',
- resize = false,
+ resize = true,
+ width = dpi(20),
widget = wibox.widget.imagebox,
},
{ -- OS
@@ -82,10 +83,11 @@ if not instance then
{
{
image = gcolor.recolor_image(icondir .. 'penguin.svg',
- Theme_config.notification_center.profile.kernel_icon_color),
+ beautiful.colorscheme.bg_blue),
valign = 'center',
halign = 'left',
- resize = false,
+ resize = true,
+ width = dpi(20),
widget = wibox.widget.imagebox,
},
{ -- Kernel
@@ -100,10 +102,11 @@ if not instance then
{
{
image = gcolor.recolor_image(icondir .. 'clock.svg',
- Theme_config.notification_center.profile.uptime_icon_color),
+ beautiful.colorscheme.bg_blue),
valign = 'center',
halign = 'left',
- resize = false,
+ resize = true,
+ width = dpi(20),
widget = wibox.widget.imagebox,
},
{ -- Uptime
@@ -124,10 +127,10 @@ if not instance then
},
widget = wibox.layout.fixed.vertical,
},
- fg = Theme_config.notification_center.profile.fg,
- border_color = Theme_config.notification_center.profile.border_color,
- border_width = Theme_config.notification_center.profile.border_width,
- shape = Theme_config.notification_center.profile.shape,
+ fg = beautiful.colorscheme.bg_green,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ shape = beautiful.shape[12],
widget = wibox.container.background,
},
strategy = 'exact',
diff --git a/awesome/src/modules/notification-center/widgets/song_info.lua b/awesome/src/modules/notification-center/widgets/song_info.lua
index 8356d26..94df1c5 100644
--- a/awesome/src/modules/notification-center/widgets/song_info.lua
+++ b/awesome/src/modules/notification-center/widgets/song_info.lua
@@ -3,6 +3,7 @@
---------------------------
-- Awesome Libs
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox')
local gfilesystem = require('gears.filesystem')
@@ -29,9 +30,7 @@ return setmetatable({}, { __call = function()
{
image = icondir .. 'default_image.svg',
resize = true,
- clip_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
+ clip_shape = beautiful.shape[8],
valign = 'center',
halign = 'center',
widget = wibox.widget.imagebox,
@@ -53,7 +52,7 @@ return setmetatable({}, { __call = function()
id = 'title',
widget = wibox.widget.textbox,
},
- fg = Theme_config.notification_center.song_info.title_fg,
+ fg = beautiful.colorscheme.bg_red,
widget = wibox.container.background,
},
strategy = 'max',
@@ -72,7 +71,7 @@ return setmetatable({}, { __call = function()
text = 'Unknown Artist',
widget = wibox.widget.textbox,
},
- fg = Theme_config.notification_center.song_info.artist_fg,
+ fg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background,
},
strategy = 'max',
@@ -86,7 +85,7 @@ return setmetatable({}, { __call = function()
{
resize = false,
image = gcolor.recolor_image(icondir .. 'shuffle.svg',
- Theme_config.notification_center.song_info.shuffle_disabled),
+ beautiful.colorscheme.bg1),
valign = 'center',
halign = 'center',
id = 'shuffle',
@@ -97,7 +96,7 @@ return setmetatable({}, { __call = function()
valign = 'center',
halign = 'center',
id = 'prev',
- image = gcolor.recolor_image(icondir .. 'skip-prev.svg', Theme_config.notification_center.song_info.prev_enabled),
+ image = gcolor.recolor_image(icondir .. 'skip-prev.svg', beautiful.colorscheme.bg_teal),
widget = wibox.widget.imagebox,
},
{
@@ -106,7 +105,7 @@ return setmetatable({}, { __call = function()
halign = 'center',
id = 'play_pause',
image = gcolor.recolor_image(icondir .. 'play-pause.svg',
- Theme_config.notification_center.song_info.play_enabled),
+ beautiful.colorscheme.bg_teal),
widget = wibox.widget.imagebox,
},
{
@@ -114,12 +113,12 @@ return setmetatable({}, { __call = function()
valign = 'center',
halign = 'center',
id = 'next',
- image = gcolor.recolor_image(icondir .. 'skip-next.svg', Theme_config.notification_center.song_info.next_enabled),
+ image = gcolor.recolor_image(icondir .. 'skip-next.svg', beautiful.colorscheme.bg_teal),
widget = wibox.widget.imagebox,
},
{
resize = false,
- image = gcolor.recolor_image(icondir .. 'repeat.svg', Theme_config.notification_center.song_info.repeat_disabled),
+ image = gcolor.recolor_image(icondir .. 'repeat.svg', beautiful.colorscheme.bg1),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
@@ -146,7 +145,7 @@ return setmetatable({}, { __call = function()
valign = 'center',
halign = 'center',
},
- fg = Theme_config.notification_center.song_info.duration_fg,
+ fg = beautiful.colorscheme.bg_teal,
widget = wibox.container.background,
},
right = dpi(10),
@@ -154,15 +153,13 @@ return setmetatable({}, { __call = function()
},
{ -- Progressbar
{
- color = Theme_config.notification_center.song_info.progress_color,
- background_color = Theme_config.notification_center.song_info.progress_background_color,
+ color = beautiful.colorscheme.bg_purple,
+ background_color = beautiful.colorscheme.bg1,
max_value = 100,
value = 0,
id = 'progress',
forced_height = dpi(5),
- shape = function(cr, width)
- gshape.rounded_bar(cr, width, dpi(5))
- end,
+ shape = beautiful.shape[4],
widget = wibox.widget.progressbar,
},
widget = wibox.container.place,
@@ -176,7 +173,7 @@ return setmetatable({}, { __call = function()
valign = 'center',
halign = 'center',
},
- fg = Theme_config.notification_center.song_info.duration_fg,
+ fg = beautiful.colorscheme.bg_teal,
widget = wibox.container.background,
},
left = dpi(10),
@@ -189,9 +186,9 @@ return setmetatable({}, { __call = function()
widget = wibox.container.margin,
margins = dpi(10),
},
- border_color = Theme_config.notification_center.song_info.border_color,
- border_width = Theme_config.notification_center.song_info.border_width,
- shape = Theme_config.notification_center.song_info.shape,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ shape = beautiful.shape[12],
widget = wibox.container.background,
},
widget = wibox.container.margin,
diff --git a/awesome/src/modules/notification-center/widgets/status_bars.lua b/awesome/src/modules/notification-center/widgets/status_bars.lua
index 79135b2..a860087 100644
--- a/awesome/src/modules/notification-center/widgets/status_bars.lua
+++ b/awesome/src/modules/notification-center/widgets/status_bars.lua
@@ -4,6 +4,7 @@
-- Awesome Libs
local awful = require('awful')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gears = require('gears')
local wibox = require('wibox')
@@ -39,8 +40,8 @@ return setmetatable({}, { __call = function()
{
{
{ --Bar
- color = Theme_config.notification_center.status_bar.cpu_usage_color,
- background_color = Theme_config.notification_center.status_bar.bar_bg_color,
+ color = beautiful.colorscheme.bg_teal,
+ background_color = beautiful.colorscheme.bg1,
max_value = 100,
value = 0,
forced_height = dpi(8),
@@ -99,13 +100,15 @@ return setmetatable({}, { __call = function()
if widget == 'cpu_usage' then
cpu_usage:connect_signal('update::cpu_usage', function(_, v)
+ if not v then return nil end
tooltip.text = 'CPU Usage: ' .. v .. '%'
rubato_timer.target = v
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icondir .. 'cpu/cpu.svg',
- Theme_config.notification_center.status_bar.cpu_usage_color)
+ beautiful.colorscheme.bg_teal)
end)
elseif widget == 'cpu_temp' then
cpu_temp:connect_signal('update::cpu_temp', function(_, v)
+ if not v then return nil end
local temp_icon
if v < 50 then
temp_icon = icondir .. 'cpu/thermometer-low.svg'
@@ -115,29 +118,31 @@ return setmetatable({}, { __call = function()
temp_icon = icondir .. 'cpu/thermometer-high.svg'
end
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(temp_icon,
- Theme_config.notification_center.status_bar.cpu_temp_color)
+ beautiful.colorscheme.bg_blue)
tooltip.text = 'CPU Temp: ' .. v .. '°C'
rubato_timer.target = v
end)
elseif widget == 'ram_usage' then
ram:connect_signal('update::ram_widget', function(_, MemTotal, _, MemAvailable)
+ if not MemTotal and MemAvailable then return nil end
if not MemTotal or not MemAvailable then return end
local ram_usage = math.floor(((MemTotal - MemAvailable) / MemTotal * 100) + 0.5)
tooltip.text = 'RAM Usage: ' .. ram_usage .. '%'
rubato_timer.target = ram_usage
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icondir .. 'cpu/ram.svg',
- Theme_config.notification_center.status_bar.ram_usage_color)
+ beautiful.colorscheme.bg_red)
end)
elseif widget == 'gpu_usage' then
gpu_usage:connect_signal('update::gpu_usage', function(_, v)
- if not v then return end
+ if not v then return nil end
tooltip.text = 'GPU Usage: ' .. v .. '%'
rubato_timer.target = tonumber(v)
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icondir .. 'cpu/gpu.svg',
- Theme_config.notification_center.status_bar.gpu_usage_color)
+ beautiful.colorscheme.bg_green)
end)
elseif widget == 'gpu_temp' then
gpu_temp:connect_signal('update::gpu_temp', function(_, v)
+ if not v then return nil end
local temp_icon, temp_num
if v then
@@ -154,12 +159,13 @@ return setmetatable({}, { __call = function()
temp_icon = icondir .. 'cpu/thermometer-low.svg'
end
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(temp_icon,
- Theme_config.notification_center.status_bar.gpu_temp_color)
+ beautiful.colorscheme.bg_green)
tooltip.text = 'GPU Temp: ' .. temp_num .. '°C'
rubato_timer.target = temp_num
end)
elseif widget == 'volume' then
audio:connect_signal('sink::get', function(_, muted, volume)
+ if not volume and muted then return nil end
local icon = icondir .. 'audio/volume'
volume = tonumber(volume)
if not volume then
@@ -179,12 +185,13 @@ return setmetatable({}, { __call = function()
end
end
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icon .. '.svg',
- Theme_config.notification_center.status_bar.volume_color)
+ beautiful.colorscheme.bg_yellow)
tooltip.text = 'Volume: ' .. volume .. '%'
rubato_timer.target = volume
end)
elseif widget == 'microphone' then
audio:connect_signal('source::get', function(_, muted, volume)
+ if not volume and muted then return nil end
if not volume then
return
end
@@ -197,12 +204,13 @@ return setmetatable({}, { __call = function()
icon = icon .. '-off'
end
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icon .. '.svg',
- Theme_config.notification_center.status_bar.microphone_color)
+ beautiful.colorscheme.bg_blue)
tooltip.text = 'Microphone: ' .. volume .. '%'
rubato_timer.target = volume
end)
elseif widget == 'backlight' then
backlight:connect_signal('brightness::get', function(_, v)
+ if not v then return nil end
local icon = icondir .. 'brightness'
if v >= 0 and v < 34 then
icon = icon .. '-low'
@@ -212,18 +220,19 @@ return setmetatable({}, { __call = function()
icon = icon .. '-high'
end
w:get_children_by_id('image_role')[1]:set_image(gears.color.recolor_image(icon .. '.svg',
- Theme_config.notification_center.status_bar.backlight_color))
+ beautiful.colorscheme.bg_purple))
tooltip.text = 'Backlight: ' .. v .. '%'
rubato_timer.target = v
end)
elseif widget == 'battery' then
--[[ battery:connect_signal('update::battery_widget', function(battery, battery_icon)
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(battery_icon,
- Theme_config.notification_center.status_bar.battery_color)
+ beautiful.colorscheme.bg_purple)
tooltip.text = 'Battery: ' .. battery .. '%'
rubato_timer.target = battery
end) ]]
end
+
table.insert(bar_layout, w)
end
@@ -236,7 +245,7 @@ return setmetatable({}, { __call = function()
{
{
{
- create_bar_layout(User_config.status_bar_widgets),
+ create_bar_layout(beautiful.user_config.status_bar_widgets),
width = dpi(480),
strategy = 'exact',
widget = wibox.container.constraint,
@@ -246,9 +255,9 @@ return setmetatable({}, { __call = function()
magins = dpi(10),
layout = wibox.container.margin,
},
- border_color = Theme_config.notification_center.status_bar.border_color,
- border_width = Theme_config.notification_center.status_bar.border_width,
- shape = Theme_config.notification_center.status_bar.shape,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ shape = beautiful.shape[12],
widget = wibox.container.background,
},
widget = wibox.container.constraint,
diff --git a/awesome/src/modules/notification-center/widgets/weather.lua b/awesome/src/modules/notification-center/widgets/weather.lua
index 7efe804..77d68f2 100644
--- a/awesome/src/modules/notification-center/widgets/weather.lua
+++ b/awesome/src/modules/notification-center/widgets/weather.lua
@@ -3,6 +3,7 @@
--------------------------------
-- Awesome Libs
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox')
local gfilesystem = require('gears.filesystem')
@@ -82,12 +83,12 @@ if not instance then
widget = wibox.widget.textbox,
id = 'description',
},
- fg = Theme_config.notification_center.weather.description_fg,
+ fg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background,
},
{ -- line
{
- bg = Theme_config.notification_center.weather.line_color,
+ bg = beautiful.colorscheme.bg1,
widget = wibox.container.background,
},
widget = wibox.container.constraint,
@@ -99,7 +100,7 @@ if not instance then
{ -- Speed
{
image = gcolor.recolor_image(icondir .. 'weather-windy.svg',
- Theme_config.notification_center.weather.speed_icon_color),
+ beautiful.colorscheme.bg_red),
valign = 'center',
halign = 'center',
widget = wibox.widget.imagebox,
@@ -127,7 +128,7 @@ if not instance then
valign = 'center',
halign = 'center',
image = gcolor.recolor_image(icondir .. 'humidity.svg',
- Theme_config.notification_center.weather.humidity_icon_color),
+ beautiful.colorscheme.bg_red),
},
widget = wibox.container.constraint,
width = dpi(24),
@@ -154,9 +155,9 @@ if not instance then
},
widget = wibox.container.place,
},
- border_color = Theme_config.notification_center.weather.border_color,
- border_width = Theme_config.notification_center.weather.border_width,
- shape = Theme_config.notification_center.weather.shape,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ shape = beautiful.shape[12],
widget = wibox.container.background,
},
top = dpi(20),
@@ -176,7 +177,7 @@ if not instance then
call_now = true,
callback = function()
aspawn.easy_async_with_shell("curl -sf 'http://api.openweathermap.org/data/2.5/weather?id=" ..
- User_config.weather_secrets.city_id .. '&units=' .. User_config.weather_secrets.unit .. '&appid=' .. User_config.weather_secrets.key .. "'",
+ beautiful.user_config.weather_secrets.city_id .. '&units=' .. beautiful.user_config.weather_secrets.unit .. '&appid=' .. beautiful.user_config.weather_secrets.key .. "'",
function(stdout)
if not stdout:match('error') then
local weather_metadata = json_lua:decode(stdout)
diff --git a/awesome/src/modules/powermenu/init.lua b/awesome/src/modules/powermenu/init.lua
index ee1c14d..a0bd8e2 100644
--- a/awesome/src/modules/powermenu/init.lua
+++ b/awesome/src/modules/powermenu/init.lua
@@ -7,6 +7,7 @@ local abutton = require('awful.button')
local akey = require('awful.key')
local akeygrabber = require('awful.keygrabber')
local aspawn = require('awful.spawn')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table')
@@ -31,27 +32,27 @@ local function get_button(type)
if type == 'shutdown' then
icon = icondir .. 'shutdown.svg'
name = 'Shutdown'
- bg_color = Theme_config.powermenu.shutdown_button_bg
+ bg_color = beautiful.colorscheme.bg_blue
command = 'shutdown now'
elseif type == 'reboot' then
icon = icondir .. 'reboot.svg'
name = 'Reboot'
- bg_color = Theme_config.powermenu.reboot_button_bg
+ bg_color = beautiful.colorscheme.bg_red
command = 'reboot'
elseif type == 'logout' then
icon = icondir .. 'logout.svg'
name = 'Logout'
- bg_color = Theme_config.powermenu.logout_button_bg
+ bg_color = beautiful.colorscheme.bg_yellow
command = 'awesome-client "awesome.quit()"'
elseif type == 'lock' then
icon = icondir .. 'lock.svg'
name = 'Lock'
- bg_color = Theme_config.powermenu.lock_button_bg
+ bg_color = beautiful.colorscheme.bg_green
command = 'dm-tool lock'
elseif type == 'suspend' then
icon = icondir .. 'suspend.svg'
name = 'Suspend'
- bg_color = Theme_config.powermenu.suspend_button_bg
+ bg_color = beautiful.colorscheme.bg_purple
command = 'systemctl suspend'
end
@@ -81,9 +82,9 @@ local function get_button(type)
margins = dpi(10),
widget = wibox.container.margin,
},
- fg = Theme_config.powermenu.button_fg,
+ fg = beautiful.colorscheme.bg,
bg = bg_color,
- shape = Theme_config.powermenu.button_shape,
+ shape = beautiful.shape[12],
widget = wibox.container.background,
id = 'background',
},
@@ -117,7 +118,7 @@ function powermenu.new()
{
image = icondir .. 'defaultpfp.svg',
resize = true,
- clip_shape = Theme_config.powermenu.profile_picture_shape,
+ clip_shape = beautiful.shape[30],
valign = 'center',
halign = 'center',
id = 'icon_role',
@@ -159,7 +160,7 @@ function powermenu.new()
type = 'splash',
visible = false,
ontop = true,
- bg = Theme_config.powermenu.container_bg,
+ bg = beautiful.colorscheme.bg .. '88',
height = capi.screen.primary.geometry.height,
width = capi.screen.primary.geometry.width,
x = capi.screen.primary.geometry.x,
@@ -201,7 +202,7 @@ function powermenu.new()
end
end)
- aspawn.easy_async_with_shell("./.config/awesome/src/scripts/pfp.sh 'userName' '" .. User_config.namestyle .. "'", function(stdout)
+ aspawn.easy_async_with_shell("./.config/awesome/src/scripts/pfp.sh 'userName' '" .. beautiful.user_config.namestyle .. "'", function(stdout)
w:get_children_by_id('text_role')[1].text = stdout:gsub('\n', '')
end)
diff --git a/awesome/src/modules/window_switcher/init.lua b/awesome/src/modules/window_switcher/init.lua
index d754ba4..11d8f19 100644
--- a/awesome/src/modules/window_switcher/init.lua
+++ b/awesome/src/modules/window_switcher/init.lua
@@ -3,19 +3,30 @@
---------------------------------
-- Awesome Libs
-local awful = require("awful")
-local dpi = require("beautiful").xresources.apply_dpi
-local gears = require("gears")
-local wibox = require("wibox")
+local aplacement = require('awful.placement')
+local apopup = require('awful.popup')
+local beautiful = require('beautiful')
+local dpi = require('beautiful').xresources.apply_dpi
+local gcolor = require('gears.color')
+local gshape = require('gears.shape')
+local gsurface = require('gears.surface')
+local gtable = require('gears.table')
+local wibox = require('wibox')
+local gobject = require('gears.object')
+local base = require('wibox.widget.base')
+local gtimer = require('gears.timer')
+local cairo = require('lgi').cairo
+local awidget = require('awful.widget')
local capi = {
awesome = awesome,
+ client = client,
mouse = mouse,
}
-local window_elements = require("src.modules.window_switcher.window_elements")()
+--local window_elements = require("src.modules.window_switcher.window_elements")()
-return function(s)
+--[[ return function(s)
local window_switcher_list = wibox.widget {
window_elements,
@@ -33,9 +44,9 @@ return function(s)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
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
+ bg = beautiful.colorscheme.bg,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2)
}
window_switcher_container:setup {
@@ -51,4 +62,94 @@ return function(s)
end
end
)
+end ]]
+
+local client_preview = {}
+
+
+function client_preview:toggle()
+ self.visible = not self.visible
end
+
+return setmetatable(client_preview, {
+ __call = function(...)
+ local args = ...
+
+ local w = gobject {}
+
+ gtable.crush(w, client_preview, true)
+
+ --[[ local tl = awidget.tasklist {
+ screen = 1,
+ layout = wibox.layout.fixed.horizontal,
+ filter = awidget.tasklist.filter.alltags,
+ update_function = function(widget, _, _, _, clients)
+ widget:reset()
+
+ for _, c in ipairs(clients) do
+ local tw = wibox.widget {
+ {
+ {
+ {
+ {
+ widget = wibox.widget.imagebox,
+ resize = true,
+ id = c.instance,
+ },
+ widget = wibox.container.constraint,
+ height = dpi(256),
+ strategy = 'exact',
+ },
+ widget = wibox.container.place,
+ },
+ widget = wibox.container.margin,
+ margins = dpi(20),
+ },
+ widget = wibox.container.background,
+ bg = '#414141',
+ id = c.pid,
+ shape = gshape.rounded_rect,
+ }
+
+ gtimer {
+ timeout = 1 / 24,
+ autostart = true,
+ callback = function()
+ local content = gsurface(c.content)
+ local cr = cairo.Context(content)
+ local x, y, w, h = cr:clip_extents()
+ local img = cairo.ImageSurface.create(cairo.Format.ARGB32, w - x, h - y)
+ cr = cairo.Context(img)
+ cr:set_source_surface(content, 0, 0)
+ cr.operator = cairo.Operator.SOURCE
+ cr:paint()
+ local cont = tw:get_children_by_id('icon_role')[1]
+ if cont then
+ cont.image = gsurface.load(img)
+ return
+ end
+ end,
+ }
+
+ widget:add(tw)
+ end
+
+ return widget
+ end,
+ } ]]
+
+ w.popup = apopup {
+ widget = {},
+ ontop = true,
+ visible = true,
+ screen = args.screen,
+ placement = aplacement.centered,
+ bg = beautiful.colorscheme.bg,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ }
+
+
+ return w
+ end,
+})
diff --git a/awesome/src/modules/window_switcher/window_elements.lua b/awesome/src/modules/window_switcher/window_elements.lua
index 4b463fe..68381a9 100644
--- a/awesome/src/modules/window_switcher/window_elements.lua
+++ b/awesome/src/modules/window_switcher/window_elements.lua
@@ -4,6 +4,7 @@
-- Awesome Libs
local awful = require('awful')
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local gears = require('gears')
local wibox = require('wibox')
@@ -91,13 +92,11 @@ return function()
margins = dpi(20),
widget = wibox.container.margin,
},
- shape = function(cr, width, height)
- gears.shape.rounded_rect(cr, width, height, dpi(12))
- end,
- border_color = Theme_config.window_switcher.border_color,
- border_width = Theme_config.window_switcher.border_width,
- bg = Theme_config.window_switcher.bg,
- fg = Theme_config.window_switcher.element_fg,
+ shape = beautiful.shape[12],
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ bg = beautiful.colorscheme.bg,
+ fg = beautiful.colorscheme.bg_green,
widget = wibox.container.background,
}
@@ -119,7 +118,7 @@ return function()
local b_timed_bg = rubato.timed { duration = 0.5 }
-- starting color
- r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.bg)
+ r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg)
-- Foreground rubato init
@@ -128,7 +127,7 @@ return function()
local b_timed_fg = rubato.timed { duration = 0.5 }
-- starting color
- r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.element_fg)
+ r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_green)
-- Border rubato init
local r_timed_border = rubato.timed { duration = 0.5 }
@@ -136,7 +135,7 @@ return function()
local b_timed_border = rubato.timed { duration = 0.5 }
-- starting color
- r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(Theme_config.window_switcher
+ r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(beautiful.colorscheme
.border_color)
local function set_bg(newbg)
@@ -176,29 +175,26 @@ return function()
b_timed_border:subscribe(update_border)
if i == selected then
- r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.bg)
- r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.element_fg)
- r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(Theme_config.window_switcher
- .border_color)
- set_border(Theme_config.window_switcher.selected_border_color)
- set_fg(Theme_config.window_switcher.selected_fg)
- set_bg(Theme_config.window_switcher.selected_bg)
+ r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg)
+ r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_green)
+ r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(beautiful.colorscheme.border_color)
+ set_border(beautiful.colorscheme.bg_purple)
+ set_fg(beautiful.colorscheme.fg)
+ set_bg(beautiful.colorscheme.bg1)
elseif i == selected - 1 or (selected == 1 and i == #clients_sorted) then
- r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.selected_bg)
- r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.selected_fg)
- r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(Theme_config.window_switcher
- .selected_border_color)
- set_border(Theme_config.window_switcher.border_color)
- set_fg(Theme_config.window_switcher.element_fg)
- set_bg(Theme_config.window_switcher.bg)
+ r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg1)
+ r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.fg)
+ r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_purple)
+ set_border(beautiful.colorscheme.border_color)
+ set_fg(beautiful.colorscheme.bg_green)
+ set_bg(beautiful.colorscheme.bg)
else
- r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.bg)
- r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(Theme_config.window_switcher.element_fg)
- r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(Theme_config.window_switcher
- .border_color)
- set_border(Theme_config.window_switcher.border_color)
- set_fg(Theme_config.window_switcher.element_fg)
- set_bg(Theme_config.window_switcher.bg)
+ r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg)
+ r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_green)
+ r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(beautiful.colorscheme.border_color)
+ set_border(beautiful.colorscheme.border_color)
+ set_fg(beautiful.colorscheme.bg_green)
+ set_bg(beautiful.colorscheme.bg)
end
end
elseif fn == 'raise' then
diff --git a/awesome/src/theme/colors.lua b/awesome/src/theme/colors.lua
deleted file mode 100644
index 1d795fe..0000000
--- a/awesome/src/theme/colors.lua
+++ /dev/null
@@ -1,196 +0,0 @@
------------------------------------------------------
--- This is a table with almost all Material colors --
------------------------------------------------------
-
-return {
- ['White'] = '#ffffff',
- ['Black'] = '#000000',
- ['Grey50'] = '#fafafa',
- ['Grey100'] = '#f5f5f5',
- ['Grey200'] = '#eeeeee',
- ['Grey300'] = '#e0e0e0',
- ['Grey400'] = '#bdbdbd',
- ['Grey500'] = '#9e9e9e',
- ['Grey600'] = '#757575',
- ['Grey700'] = '#616161',
- ['Grey800'] = '#424242',
- ['Grey900'] = '#212121',
- ['Red50'] = '#ffebee',
- ['Red100'] = '#ffcdd2',
- ['Red200'] = '#ef9a9a',
- ['Red300'] = '#e57373',
- ['Red400'] = '#ef5350',
- ['Red500'] = '#f44336',
- ['Red600'] = '#e53935',
- ['Red700'] = '#d32f2f',
- ['Red800'] = '#c62828',
- ['Red900'] = '#b71c1c',
- ['RedA100'] = '#ff8a80',
- ['RedA200'] = '#ff5252',
- ['RedA400'] = '#ff1744',
- ['RedA700'] = '#d50000',
- ['Pink50'] = '#fce4ec',
- ['Pink100'] = '#f8bbd0',
- ['Pink200'] = '#f48fb1',
- ['Pink300'] = '#f06292',
- ['Pink400'] = '#ec407a',
- ['Pink500'] = '#e91e63',
- ['Pink600'] = '#d81b60',
- ['Pink700'] = '#c2185b',
- ['Pink800'] = '#ad1457',
- ['Pink900'] = '#880e4f',
- ['PinkA100'] = '#ff80ab',
- ['PinkA200'] = '#ff4081',
- ['PinkA400'] = '#f50057',
- ['PinkA700'] = '#c51162',
- ['Blue50'] = '#e3f2fd',
- ['Blue100'] = '#bbdefb',
- ['Blue200'] = '#90caf9',
- ['Blue300'] = '#64b5f6',
- ['Blue400'] = '#42a5f5',
- ['Blue500'] = '#2196f3',
- ['Blue600'] = '#1e88e5',
- ['Blue700'] = '#1976d2',
- ['Blue800'] = '#1565c0',
- ['Blue900'] = '#0d47a1',
- ['BlueA100'] = '#82b1ff',
- ['BlueA200'] = '#448aff',
- ['BlueA400'] = '#2979ff',
- ['BlueA700'] = '#2962ff',
- ['Yellow50'] = '#fffde7',
- ['Yellow100'] = '#fff9c4',
- ['Yellow200'] = '#fff59d',
- ['Yellow300'] = '#fff176',
- ['Yellow400'] = '#ffee58',
- ['Yellow500'] = '#ffeb3b',
- ['Yellow600'] = '#fdd835',
- ['Yellow700'] = '#fbc02d',
- ['Yellow800'] = '#f9a825',
- ['Yellow900'] = '#f57f17',
- ['YellowA100'] = '#ffff8d',
- ['YellowA200'] = '#ffff00',
- ['YellowA400'] = '#ffea00',
- ['YellowA700'] = '#ffd600',
- ['Teal50'] = '#e0f2f1',
- ['Teal100'] = '#b2dfdb',
- ['Teal200'] = '#80cbc4',
- ['Teal300'] = '#4db6ac',
- ['Teal400'] = '#26a69a',
- ['Teal500'] = '#009688',
- ['Teal600'] = '#00897b',
- ['Teal700'] = '#00796b',
- ['Teal800'] = '#00695c',
- ['Teal900'] = '#004d40',
- ['TealA100'] = '#a7ffeb',
- ['TealA200'] = '#64ffda',
- ['TealA400'] = '#1de9b6',
- ['TealA700'] = '#00bfa5',
- ['Green50'] = '#e8f5e9',
- ['Green100'] = '#c8e6c9',
- ['Green200'] = '#a5d6a7',
- ['Green300'] = '#81c784',
- ['Green400'] = '#66bb6a',
- ['Green500'] = '#4caf50',
- ['Green600'] = '#43a047',
- ['Green700'] = '#388e3c',
- ['Green800'] = '#2e7d32',
- ['Green900'] = '#1b5e20',
- ['GreenA100'] = '#b9f6ca',
- ['GreenA200'] = '#69f0ae',
- ['GreenA400'] = '#00e676',
- ['GreenA700'] = '#00c853',
- ['Orange50'] = '#fff3e0',
- ['Orange100'] = '#ffe0b2',
- ['Orange200'] = '#ffcc80',
- ['Orange300'] = '#ffb74d',
- ['Orange400'] = '#ffa726',
- ['Orange500'] = '#ff9800',
- ['Orange600'] = '#fb8c00',
- ['Orange700'] = '#f57c00',
- ['Orange800'] = '#ef6c00',
- ['Orange900'] = '#e65100',
- ['OrangeA100'] = '#ffd180',
- ['OrangeA200'] = '#ffab40',
- ['OrangeA400'] = '#ff9100',
- ['OrangeA700'] = '#ff6d00',
- ['DeepOrange50'] = '#fbe9e7',
- ['DeepOrange100'] = '#ffccbc',
- ['DeepOrange200'] = '#ffab91',
- ['DeepOrange300'] = '#ff8a65',
- ['DeepOrange400'] = '#ff7043',
- ['DeepOrange500'] = '#ff5722',
- ['DeepOrange600'] = '#f4511e',
- ['DeepOrange700'] = '#e64a19',
- ['DeepOrange800'] = '#d84315',
- ['DeepOrange900'] = '#bf360c',
- ['DeepOrangeA100'] = '#ff9e80',
- ['DeepOrangeA200'] = '#ff6e40',
- ['DeepOrangeA400'] = '#ff3d00',
- ['DeepOrangeA700'] = '#dd2c00',
- ['Purple50'] = '#F3E5F5',
- ['Purple100'] = '#E1BEE7',
- ['Purple200'] = '#CE93D8',
- ['Purple300'] = '#BA68C8',
- ['Purple400'] = '#AB47BC',
- ['Purple500'] = '#9C27B0',
- ['Purple600'] = '#8E24AA',
- ['Purple700'] = '#7B1FA2',
- ['Purple800'] = '#6A1B9A',
- ['Purple900'] = '#4A148C',
- ['PurpleA100'] = '#EA80FC',
- ['PurpleA200'] = '#E040FB',
- ['PurpleA500'] = '#D500F9',
- ['PurpleA700'] = '#AA00FF',
- ['DeepPurple50'] = '#EDE7F6',
- ['DeepPurple100'] = '#D1C4E9',
- ['DeepPurple200'] = '#B39DDB',
- ['DeepPurple300'] = '#9575CD',
- ['DeepPurple400'] = '#7E57C2',
- ['DeepPurple500'] = '#673AB7',
- ['DeepPurple600'] = '#5E35B1',
- ['DeepPurple700'] = '#512DA8',
- ['DeepPurple800'] = '#4527A0',
- ['DeepPurple900'] = '#311B92',
- ['DeepPurpleA100'] = '#B388FF',
- ['DeepPurpleA200'] = '#7C4DFF',
- ['DeepPurpleA400'] = '#651FFF',
- ['DeepPurpleA700'] = '#6200EA',
- ['LightBlue50'] = '#E1F5FE',
- ['LightBlue100'] = '#B3E5FC',
- ['LightBlue200'] = '#81D4FA',
- ['LightBlue300'] = '#4FC3F7',
- ['LightBlue400'] = '#29B6F6',
- ['LightBlue500'] = '#03A9F4',
- ['LightBlue600'] = '#039BE5',
- ['LightBlue700'] = '#0288D1',
- ['LightBlue800'] = '#0277BD',
- ['LightBlue900'] = '#01579B',
- ['LightBlueA100'] = '#80D8FF',
- ['LightBlueA200'] = '#40C4FF',
- ['LightBlueA400'] = '#00B0FF',
- ['LightBlueA700'] = '#0091EA',
- ['Cyan50'] = '#E0F7FA',
- ['Cyan100'] = '#B2EBF2',
- ['Cyan200'] = '#80DEEA',
- ['Cyan300'] = '#4DD0E1',
- ['Cyan400'] = '#26C6DA',
- ['Cyan500'] = '#00BCD4',
- ['Cyan600'] = '#00ACC1',
- ['Cyan700'] = '#0097A7',
- ['Cyan800'] = '#00838F',
- ['Cyan900'] = '#006064',
- ['CyanA100'] = '#84FFFF',
- ['CyanA200'] = '#18FFFF',
- ['CyanA400'] = '#00E5FF',
- ['CyanA700'] = '#00B8D4',
- ['BlueGrey50'] = '#ECEFF1',
- ['BlueGrey100'] = '#CFD8DC',
- ['BlueGrey200'] = '#B0BEC5',
- ['BlueGrey300'] = '#90A4AE',
- ['BlueGrey400'] = '#78909C',
- ['BlueGrey500'] = '#607D8B',
- ['BlueGrey600'] = '#546E7A',
- ['BlueGrey700'] = '#455A64',
- ['BlueGrey800'] = '#37474F',
- ['BlueGrey900'] = '#263238',
-}
diff --git a/awesome/src/theme/init.lua b/awesome/src/theme/init.lua
index 56fd438..8a1c628 100644
--- a/awesome/src/theme/init.lua
+++ b/awesome/src/theme/init.lua
@@ -6,55 +6,118 @@
-- ╚██████╗██║ ██║ ██║ ███████╗██║██║ ██║ --
-- ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝ --
--------------------------------------------------
+local awful = require('awful')
local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
+local gshape = require('gears.shape')
local gwallpaper = require('gears.wallpaper')
local gfilesystem = require('gears.filesystem')
+local config = require('src.tools.config')
local capi = {
awesome = awesome,
screen = screen,
}
-Theme_path = gfilesystem.get_configuration_dir() .. '/src/theme/'
-Theme = {}
+local function get_userconfig()
+ local data = config.read_json(gfilesystem.get_xdg_config_home() .. 'crylia_theme/crylia_theme.json')
+ if not data then
+ print('Warning: No crylia_theme.json found, using default config')
+
+ data = config.read_json('/etc/crylia_theme/crylia_theme.json')
+ end
+
+ assert(type(data) == 'table', 'Invalid config file (not a table)!')
+
+ return data
+end
+
+local function get_colorscheme()
+ local data = config.read_json(gfilesystem.get_xdg_config_home() .. 'crylia_theme/one_dark.json')
+ if not data then
+ print('Warning: No theme.json found, using default config')
+
+ data = config.read_json('/etc/crylia_theme/theme.json')
+ end
+
+ assert(type(data) == 'table', 'Invalid config file (not a table)!')
+
+ return data
+end
+
+local theme = {}
awesome.set_preferred_icon_size(128)
+theme.user_config = get_userconfig()
+theme.colorscheme = get_colorscheme()
+
+theme.shape = {}
+for i = 2, 30, 2 do
+ theme.shape[i] = function(w, h, cr)
+ gshape.rounded_rect(w, h, cr, dpi(i))
+ end
+end
+
-- Default font, change it in user_config, not here.
-Theme.font = User_config.font.bold
+theme.font = theme.user_config.font .. ' bold ' .. dpi(16)
--#region Client variables
-Theme.useless_gap = Theme_config.window.useless_gap
-Theme.border_width = Theme_config.window.border_width
-Theme.border_normal = Theme_config.window.border_normal
-Theme.border_marked = Theme_config.window.border_marked
+theme.useless_gap = dpi(5)
+theme.border_width = dpi(2)
+theme.border_normal = theme.colorscheme.bg_1
+theme.border_marked = theme.colorscheme.bg_red
--#endregion
--#region Tooltip variables
-Theme.tooltip_border_color = Theme_config.tooltip.border_color
-Theme.tooltip_bg = Theme_config.tooltip.bg
-Theme.tooltip_fg = Theme_config.tooltip.fg
-Theme.tooltip_border_width = Theme_config.tooltip.border_width
-Theme.tooltip_gaps = Theme_config.tooltip.gaps
-Theme.tooltip_shape = Theme_config.tooltip.shape
+theme.tooltip_border_color = theme.colorscheme.border_color
+theme.tooltip_bg = theme.colorscheme.bg
+theme.tooltip_fg = theme.colorscheme.bg_teal
+theme.tooltip_border_width = dpi(2)
+theme.tooltip_gaps = dpi(15)
--#endregion
--#region Hotkeys variables
-Theme.hotkeys_bg = Theme_config.hotkeys.bg
-Theme.hotkeys_fg = Theme_config.hotkeys.fg
-Theme.hotkeys_border_width = Theme_config.hotkeys.border_width
-Theme.hotkeys_border_color = Theme_config.hotkeys.border_color
-Theme.hotkeys_shape = Theme_config.hotkeys.shape
-Theme.hotkeys_modifiers_fg = Theme_config.hotkeys.modifiers_fg
-Theme.hotkeys_description_font = Theme_config.hotkeys.description_font
-Theme.hotkeys_font = Theme_config.hotkeys.font
-Theme.hotkeys_group_margin = Theme_config.hotkeys.group_margin
-Theme.hotkeys_label_bg = Theme_config.hotkeys.label_bg
-Theme.hotkeys_label_fg = Theme_config.hotkeys.label_fg
+theme.hotkeys_bg = theme.colorscheme.bg
+theme.hotkeys_fg = theme.colorscheme.fg
+theme.hotkeys_border_width = dpi(2)
+theme.hotkeys_border_color = theme.colorscheme.border_color
+theme.hotkeys_modifiers_fg = theme.colorscheme.bg_teal
+theme.hotkeys_description_font = theme.user_config.font
+theme.hotkeys_font = theme.user_config.font
+theme.hotkeys_group_margin = dpi(20)
+theme.hotkeys_label_bg = theme.colorscheme.bg_teal
+theme.hotkeys_label_fg = theme.colorscheme.bg
--#endregion
+--#region Layout icons
+local layout_path = gfilesystem.get_configuration_dir() .. 'src/assets/layout/'
+
+theme.layout_cornerne = layout_path .. 'cornerne.png'
+theme.layout_cornernw = layout_path .. 'cornernw.png'
+theme.layout_cornerse = layout_path .. 'cornerse.png'
+theme.layout_cornersw = layout_path .. 'cornersw.png'
+theme.layout_dwindle = layout_path .. 'dwindle.png'
+theme.layout_fairh = layout_path .. 'fairh.png'
+theme.layout_fairv = layout_path .. 'fairv.png'
+theme.layout_floating = layout_path .. 'floating.png'
+theme.layout_fullscreen = layout_path .. 'fullscreen.png'
+theme.layout_magnifier = layout_path .. 'magnifier.png'
+theme.layout_max = layout_path .. 'max.png'
+theme.layout_spiral = layout_path .. 'spiral.png'
+theme.layout_tile = layout_path .. 'tile.png'
+theme.layout_tilebottom = layout_path .. 'tilebottom.png'
+theme.layout_tileleft = layout_path .. 'tileleft.png'
+theme.layout_tiletop = layout_path .. 'tiletop.png'
+--#endregion
+
+theme.notification_spacing = dpi(20)
+-- Systray theme variables
+theme.bg_systray = theme.colorscheme.bg1
+theme.systray_icon_spacing = dpi(10)
+
-- Wallpaper
-beautiful.wallpaper = User_config.wallpaper
+beautiful.wallpaper = theme.user_config['wallpaper']
capi.screen.connect_signal('request::wallpaper', function(s)
if beautiful.wallpaper then
if type(beautiful.wallpaper) == 'string' then
@@ -65,7 +128,7 @@ capi.screen.connect_signal('request::wallpaper', function(s)
end
end)
-beautiful.init(Theme)
+beautiful.init(theme)
-- Load titlebar
-require('src.core.titlebar')()
+--require('src.core.titlebar')()
diff --git a/awesome/src/theme/theme_config.lua b/awesome/src/theme/theme_config.lua
deleted file mode 100644
index 28dda45..0000000
--- a/awesome/src/theme/theme_config.lua
+++ /dev/null
@@ -1,833 +0,0 @@
--- Awesome Libs
-local color = require('src.theme.colors')
-local dpi = require('beautiful.xresources').apply_dpi
-local gshape = require('gears.shape')
-
-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'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
-
-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'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
-
-Theme_config.cpu_freq = {
- bg = color['Blue200'],
- fg = color['Grey900'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
-
-Theme_config.cpu_temp = {
- fg = color['Grey900'],
- bg_low = color['Green200'],
- bg_mid = color['Orange200'],
- bg_high = color['Red200'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
-
-Theme_config.cpu_usage = {
- bg = color['Blue200'],
- fg = color['Grey900'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
-
-Theme_config.date = {
- bg = color['Teal200'],
- fg = color['Grey900'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
-
-Theme_config.dnd = {
- bg = color['Grey900'],
- disabled = color['Grey800'],
- border_disabled = color['Grey800'],
-}
-
-Theme_config.gpu_usage = {
- bg = color['Green200'],
- fg = color['Grey900'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
-
-Theme_config.gpu_temp = {
- fg = color['Grey900'],
- bg_low = color['Green200'],
- bg_mid = color['Orange200'],
- bg_high = color['Red200'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
-
-Theme_config.kblayout = {
- bg = color['Green200'],
- fg = color['Grey900'],
- bg_container = color['Grey900'],
- border_color = color['Grey800'],
- border_width = dpi(2),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
- item = {
- bg = color['Grey900'],
- border_color = color['Grey800'],
- border_width = dpi(2),
- fg_long = color['Red200'],
- fg_short = color['Purple200'],
- bg_selected = color['DeepPurple200'],
- fg_selected = color['Grey900'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- },
-}
-
-Theme_config.layout_list = {
- bg = color['LightBlue200'],
- fg = color['Grey900'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
-
-Theme_config.network = {
- bg = color['Red200'],
- fg = color['Grey900'],
- notify_icon_color = color['Grey100'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
-
-Theme_config.power_button = {
- bg = color['Red200'],
- fg = color['Grey900'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
-
-Theme_config.ram_info = {
- bg = color['Red200'],
- fg = color['Grey900'],
-}
-
-Theme_config.systray = {
- bg = '#3A475C',
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
-
-Theme_config.taglist = {
- bg = '#3A475C',
- fg = color['Grey100'],
- bg_urgent = color['RedA200'],
- fg_urgent = color['Grey900'],
- bg_focus = color['Grey100'],
- bg_focus_pressed = '#dddddd',
- bg_focus_hover = color['Grey100'],
- fg_focus = color['Grey900'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
-
-Theme_config.tasklist = {
- bg = '#3A475C',
- fg = color['Grey100'],
- bg_urgent = color['RedA200'],
- fg_urgent = color['Grey900'],
- bg_focus = color['Grey100'],
- bg_focus_pressed = '#dddddd',
- bg_focus_hover = color['Grey100'],
- fg_focus = color['Grey900'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
-}
--- #endregion
-
---[[
- =======================
- === Module Settings ===
- =======================
-
- Here you can customize the modules.
- For functional changes visit the user_config.lua
-
-]] --
-
--- #region Module Settings
-Theme_config.calendar = {
- bg = color['Grey900'],
- fg = color['Grey100'],
- border_color = color['Grey800'],
- border_width = dpi(2),
- shape = function(cr, w, h)
- gshape.rounded_rect(cr, w, h, dpi(8))
- end,
- day = {
- today_border_color = color['Blue200'],
- bg = color['Grey900'],
- bg_focus = color['Teal200'],
- bg_unfocus = color['Grey900'],
- fg = color['Grey100'],
- fg_focus = color['Grey900'],
- fg_unfocus = color['Grey600'],
- border_color = color['Grey800'],
- border_width = dpi(2),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- },
- task = {
- bg = color['Purple200'],
- bg_past = color['Grey600'],
- fg = color['Grey900'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- },
- weekdays = {
- bg = color['Grey900'],
- fg = color['Blue200'],
- },
- add_ical = {
- bg = color['Red200'],
- fg = color['Grey900'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- },
- add_task = {
- bg = color['LightBlue200'],
- fg = color['Grey900'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- },
- task_info = {
- icon_color = color['Blue200'],
- bg = color['Grey900'],
- fg = color['White'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(12))
- end,
- },
-}
-
-Theme_config.desktop = {
- context_menu = {
- icon_color = color['Purple200'],
- entry_bg = color['Grey900'],
- entry_fg = color['Pink200'],
- bg = color['Grey900'],
- fg = color['Pink200'],
- border_color = color['Grey800'],
- border_width = dpi(2),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(12))
- end,
- },
-}
-
-Theme_config.network_manager = {
- bg = color['Grey900'],
- border_color = color['Grey800'],
- border_width = dpi(2),
- wifi_icon_color = color['DeepOrange200'],
- wifi_bg = color['Grey800'],
- wifi_fg = color['Orange200'],
- ap_border_color = color['Grey800'],
- ap_border_width = dpi(2),
- airplane_icon_color = color['Orange200'],
- refresh_icon_color = color['Orange200'],
- power_icon_color = color['Orange200'],
- refresh_bg = color['Grey900'],
- power_bg = color['Grey900'],
- access_point = {
- icon_color = color['Red200'],
- button_color = color['Grey900'],
- icon_color2 = color['Grey900'],
- bg = color['Grey900'],
- fg = color['Red200'],
- border_color = color['Grey800'],
- border_width = dpi(2),
- device_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- },
- form = {
- bg = color['Grey900'],
- fg = color['Grey100'],
- close_bg = color['Red200'],
- icon_fg = color['Grey900'],
- border_color = color['Grey800'],
- border_width = dpi(2),
- button_bg = color['Blue200'],
- button_fg = color['Grey900'],
- checkbox_fg = color['Grey900'],
- checkbox_bg = color['DeepOrange200'],
- checkbox_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
- end,
- button_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- close_icon_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- },
-}
-
-Theme_config.notification = {
- border_color = color['Grey800'],
- border_width = dpi(4),
- bg = color['Grey900'],
- spacing = dpi(10),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(10))
- end,
- shape_inside = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- position = 'bottom_right',
- timeout = 3,
- corner_spacing = dpi(20),
- bg_urgent = color['Grey900'],
- fg_urgent_title = color['RedA200'],
- fg_urgent_message = color['Red200'],
- fg_urgent_app_name = color['RedA400'],
- fg_normal_title = color['Pink200'],
- fg_normal_message = '#ffffffaa',
- bg_normal = color['Blue200'],
- spotify_button_icon_color = color['Blue200'],
- action_bg = color['Grey800'],
- action_fg = color['Green200'],
- icon_color = color['Blue200'],
- fg_appname = color['Blue200'],
- fg_time = color['Blue200'],
- fg_close = color['Blue200'],
- bg_close = color['Grey900'],
- title_border_color = color['Grey800'],
- title_border_width = dpi(2),
-}
-
-Theme_config.notification_center = {
- bg = color['Grey900'],
- border_color = color['Grey800'],
- border_width = dpi(4),
- spacing_color = color['Grey800'],
- dnd_color = color['Purple200'],
- dnd_fg = color['Pink200'],
-
- -- Clear all button
- clear_all_button = {
- bg = color['Blue200'],
- fg = color['Grey900'],
- },
-
- -- Notification_list
- notification_list = {
- timer_fg = color['Teal200'],
- close_color = color['Teal200'],
- close_bg = color['Grey900'],
- icon = color['Teal200'],
- title_fg = color['Teal200'],
- title_border_color = color['Grey800'],
- title_border_width = dpi(2),
- notification_border_color = color['Grey800'],
- notification_bg = color['Grey900'],
- notification_border_width = dpi(4),
- notification_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, 8)
- end,
- },
-
- -- Profile widget
- profile = {
- username_icon_color = color['Blue200'],
- os_prefix_icon_color = color['Blue200'],
- kernel_icon_color = color['Blue200'],
- uptime_icon_color = color['Blue200'],
- fg = color['Green200'],
- border_color = color['Grey800'],
- border_width = dpi(4),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- },
-
- -- Song info widget
- song_info = {
- shuffle_disabled = color['Grey800'],
- shuffle_enabled = color['Green200'],
- repeat_disabled = color['Grey800'],
- repeat_single = color['Green200'],
- repeat_all = color['Green200'],
- prev_enabled = color['Teal200'],
- next_enabled = color['Teal200'],
- play_enabled = color['Teal200'],
- prev_hover = color['Teal300'],
- next_hover = color['Teal300'],
- play_hover = color['Teal300'],
- title_fg = color['Pink200'],
- artist_fg = color['Teal200'],
- duration_fg = color['Teal200'],
- progress_color = color['Purple200'],
- progress_background_color = color['Grey800'],
- border_color = color['Grey800'],
- border_width = dpi(4),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- },
- -- Spacing line widget
- spacing_line = {
- color = color['Grey800'],
- },
-
- -- Status bar widgets
- status_bar = {
- border_color = color['Grey800'],
- border_width = dpi(4),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(10))
- end,
- bar_bg_color = color['Grey800'],
- cpu_usage_color = color['Cyan200'],
- cpu_temp_color = color['Blue200'],
- ram_usage_color = color['Red200'],
- gpu_usage_color = color['Green200'],
- gpu_temp_color = color['Green200'],
- volume_color = color['Yellow200'],
- microphone_color = color['Blue200'],
- backlight_color = color['Pink200'],
- battery_color = color['Purple200'],
- },
-
- -- Time Date widget
- time_date = {},
-
- -- Weather widget
- weather = {
- description_fg = color['LightBlue200'],
- line_color = color['Grey800'],
- speed_icon_color = color['OrangeA200'],
- humidity_icon_color = color['OrangeA200'],
- border_color = color['Grey800'],
- border_width = dpi(4),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(12))
- end,
- },
-}
-
-Theme_config.bluetooth_controller = {
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- icon_color = color['Purple200'],
- icon_color_dark = color['Grey900'],
- icon_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- 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),
- device_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- con_device_border_color = color['Grey800'],
- con_device_border_width = dpi(2),
- con_device_shape = function(cr, width, height)
- gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
- end,
- connected_bg = color['Grey800'],
- connected_fg = color['Purple200'],
- connected_icon_color = color['Purple200'],
- connected_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- discovered_icon_color = color['LightBlue200'],
- discovered_bg = color['Grey800'],
- discovered_fg = color['LightBlue200'],
- discovered_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- container_border_color = color['Grey800'],
- container_border_width = dpi(4),
- container_bg = color['Grey900'],
- refresh_icon_color = color['Grey900'],
- refresh_bg = color['LightBlue200'],
- refresh_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- power_icon_color = color['Grey900'],
- power_bg = color['Blue200'],
-}
-
-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.center_bar = {
- bg = color['Grey900'],
-}
-
-Theme_config.dock = {
- bg = color['Grey900'],
- element = {
- bg = color['BlueGrey800'],
- border = color['BlueGrey800'],
- border_focus = color['Yellow200'],
- border_fullscreen = color['Green200'],
- border_maximized = color['Purple200'],
- border_minimized = color['Blue200'],
- border_urgent = color['Red200'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- hover_bg = color['BlueGrey400'],
- indicator = {
- bg = color['Grey100'],
- },
- },
- cm_icon = color['Yellow200'],
-}
-
-Theme_config.left_bar = {
- bg = color['Grey900'],
-}
-
-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'],
- profile_picture_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(30))
- end,
- button_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(10))
- end,
-}
-
-Theme_config.right_bar = {
- bg = color['Grey900'],
-}
-
-Theme_config.titlebar = {
- color = '#121212AA',
- button_size = dpi(18),
- size = dpi(38),
- title_margin = dpi(5),
- close = color['RedA200'],
- minimize = color['YellowA200'],
- maximize = color['GreenA200'],
- ontop = color['PinkA200'],
- floating = color['PinkA200'],
- sticky = color['PinkA200'],
-}
-
-Theme_config.volume_controller = {
- bg = color['Grey900'],
- border_color = color['Grey800'],
- border_width = dpi(4),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(12))
- end,
- device_bg = color['Grey900'],
- device_border_color = color['Grey800'],
- device_border_width = dpi(2),
- device_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- device_headphones_fg = color['Purple200'],
- device_microphone_fg = color['Blue200'],
- device_headphones_selected_bg = color['Purple200'],
- device_headphones_selected_fg = color['Grey900'],
- device_microphone_selected_bg = color['Blue200'],
- device_microphone_selected_fg = color['Grey900'],
- device_headphones_selected_border_color = color['Purple200'],
- device_microphone_selected_border_color = color['Blue200'],
- device_headphones_selected_icon_color = color['Purple200'],
- device_microphone_selected_icon_color = color['Blue200'],
- device_icon_color = color['Grey900'],
- list_border_color = color['Grey800'],
- list_border_width = dpi(2),
- list_shape = function(cr, width, height)
- gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
- end,
- list_bg = color['Grey800'],
- list_headphones_fg = color['Purple200'],
- list_microphone_fg = color['Blue200'],
- selector_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- volume_fg = color['Purple200'],
- microphone_fg = color['Blue200'],
-}
-
-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'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(10))
- end,
-}
-
-Theme_config.window_switcher = {
- element_bg = color['Grey800'],
- element_fg = color['Green200'],
- border_color = color['Grey800'],
- border_width = dpi(4),
- bg = color['Grey900'],
- selected_fg = color['CyanA200'],
- selected_border_color = color['Purple200'],
- selected_bg = '#313131',
-}
-
-Theme_config.application_launcher = {
- bg = color['Grey900'],
- border_color = color['Grey800'],
- border_width = dpi(4),
- application = {
- border_color = color['Grey800'],
- border_color_active = color['Purple200'],
- border_width = dpi(2),
- bg = '#313131',
- fg = color['Grey100'],
- hover_bg = color['Grey700'],
- cm_icon_color = color['Pink200'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- },
- searchbar = {
- bg = color['Grey900'],
- fg = color['Grey100'],
- fg_hint = color['Grey700'],
- fg_cursor = color['Grey900'],
- bg_cursor = color['Grey100'],
- border_color = color['Grey800'],
- border_width = dpi(2),
- icon_color = color['Grey900'],
- icon_background = color['LightBlue200'],
- hover_bg = color['Grey800'],
- hover_fg = color['Purple200'],
- hover_border = color['Grey700'],
- border_active = color['LightBlue200'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- },
-}
-
-Theme_config.context_menu = {
- bg = color['Grey900'],
- border_color = color['Grey800'],
- border_width = dpi(4),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- fg = color['Grey100'],
- entry = {
- bg = color['Grey900'],
- fg = color['Grey100'],
- border_color = color['Grey800'],
- border_width = dpi(2),
- hover_fg = color['Teal200'],
- hover_border = color['Teal200'],
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- icon_color = color['Grey100'],
- icon_color_hover = color['Teal200'],
- },
-}
-
-Theme_config.setup = {
- bg = color['Grey900'],
- border_color = color['Grey800'],
- border_width = dpi(4),
- wallpaper = {
- bg = color['Grey900'],
- fg = color['Grey100'],
- clip_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(12))
- end,
- button_bg = color['Yellow200'],
- button_fg = color['Grey900'],
- button_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(12))
- end,
- close_fg = color['Red200'],
- path_bg = color['Grey800'],
- path_fg = color['Grey100'],
- path_border_color = color['Grey700'],
- path_border_width = dpi(2),
- path_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(12))
- end,
- },
- bar = {
- shape = gshape.circle,
- color = color['Green200'],
- padding = dpi(4),
- border_width = dpi(2),
- border_color = color['Grey800'],
- widget_bg = color['Grey800'],
- widget_fg = color['Grey100'],
- widget_border_color = color['Grey700'],
- widget_border_width = dpi(2),
- widget_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- widget_toggle_color = color['Blue200'],
- bar_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- bar_image_shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- },
- notification = {
- separator_color = color['Grey800'],
- checkbox_color = color['Purple200'],
- checkbox_paddings = dpi(4),
- checkbox_shape = gshape.circle,
- border_color = color['Grey800'],
- border_width = dpi(2),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(4))
- end,
- },
- layout = {
- bg = color['Orange200'],
- border_color = color['Grey800'],
- border_width = dpi(2),
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(8))
- end,
- border_color_selected = color['DeepOrange200'],
- },
- titlebar = {
- checkbox_shape = gshape.circle,
- checkbox_color = color['Cyan200'],
- checkbox_padding = dpi(4),
- seperator_color = color['Grey800'],
- },
-}
--- #endregion
-
---[[
- ========================
- === General Settings ===
- ========================
-
- Here are some general settings for borders, tooltips etc
-
-]] --
-
--- #region General Settings
-
-Theme_config.window = {
- border_width = dpi(2),
- border_normal = color['Grey800'],
- border_marked = color['Red200'],
- useless_gap = dpi(5),
-}
-
-Theme_config.tooltip = {
- bg = color['Grey900'],
- fg = color['CyanA200'],
- border_color = color['Grey800'],
- border_width = dpi(4),
- gaps = dpi(15),
- shape = function(cr, width, heigth)
- gshape.rounded_rect(cr, width, heigth, dpi(4))
- end,
-}
-
-Theme_config.hotkeys = {
- bg = color['Grey900'],
- fg = color['Grey100'],
- border_color = color['Grey800'],
- border_width = dpi(4),
- shape = function(cr, width, heigth)
- gshape.rounded_rect(cr, width, heigth, dpi(12))
- end,
- modifiers_fg = color['Cyan200'],
- description_font = User_config.font.bold,
- font = User_config.font.bold,
- group_margin = dpi(20),
- label_bg = color['Cyan200'],
- label_fg = color['Grey900'],
-}
-
--- #endregion
diff --git a/awesome/src/theme/user_config.lua b/awesome/src/theme/user_config.lua
deleted file mode 100644
index 2712e48..0000000
--- a/awesome/src/theme/user_config.lua
+++ /dev/null
@@ -1,354 +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_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 = {
- 'nm-applet',
- 'protonvpn-cli ks --off',
- 'picom',
- '/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1',
- 'setxkbmap -option caps:swapescape',
- '/home/crylia/.screenlayout/double.sh',
- 'gnome-keyring-daemon --start --components=secrets',
- },
-
- --[[
- 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,
-
- --[[
- The brightness increase/decrease step in percent.
- Example:
- brightness_step = 5
- Will increase the brightness by 5% at a time
- ]]
- brightness_step = 2,
-
- clock_mode = 'average',
-
- --[[
- 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(48)
- ]] --
- dock_icon_size = dpi(64),
-
- --[[
- 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 +
- ]] --
- file_manager = 'nemo',
-
- --[[
- 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, ' .. dpi(16),
- bold = 'JetBrainsMono Nerd Font, bold ' .. dpi(16),
- extrabold = 'JetBrainsMono Nerd Font, ExtraBold ' .. dpi(16),
- specify = 'JetBrainsMono Nerd Font',
- },
-
- gtk_settings = 'lxappearance',
-
- --[[
- 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.fair,
- awful.layout.suit.floating,
- },
-
- --[[
- The modkey is ( or ) 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',
-
- music_player = 'spotify',
-
- --[[
- 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',
- },
-
- screen_settings = 'arandr',
-
- --[[
- 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',
- },
-
- --[[
- If true the taskbar will shot the client name instead of the class name.
- Default: false
- ]] --
- taskbar_use_name = true,
-
- --[[
- This is the default terminal, Alacritty is the default.
- ]] --
- terminal = 'kitty',
-
- text_editor = 'code',
-
- --[[
- 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 = {
- 'protonvpn',
- },
-
- --[[
- The titlebar position can be "left" (default) or "top"
- Example:
- titlebar_position = "top"
- ]] --
- titlebar_position = 'left',
-
- titlebar_items = {
- left_and_bottom = { 'icon' },
- --middle = "title",
- right_and_top = { 'close', 'maximize', 'minimize' },
- },
-
- --[[
- This is the path to your wallpaper.
- home is $HOME, you can also use an absolute path.
- ]] --
- wallpaper = home .. '/Bilder/Hintergründe/784194.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',
- },
-
- web_browser = 'firefox',
-
- --[[
- 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!
- ]]
- crylia_bar = {
- [1] = {
- left_bar = {
- 'Tiling Layout',
- 'Systray',
- 'Taglist',
- },
- center_bar = {
- 'Tasklist',
- },
- right_bar = {
- 'Bluetooth',
- 'Network',
- 'Cpu Frequency',
- 'Cpu Usage',
- 'Cpu Temperature',
- 'Audio',
- 'Keyboard Layout',
- 'Date',
- 'Clock',
- 'Power Button',
- },
- },
- [2] = {
- left_bar = {
- 'Tiling Layout',
- 'Taglist',
- },
- center_bar = {
- 'Tasklist',
- },
- right_bar = {
- 'Gpu Temperature',
- 'Gpu Usage',
- 'Ram Usage',
- 'Audio',
- 'Date',
- 'Clock',
- },
- },
- },
-
- crylia_wibox = {
- [1] = {
- left_bar = {
- 'Tiling Layout',
- 'Taglist',
- },
- center_bar = {
- 'Tasklist',
- },
- right_bar = {
- 'Systray',
- 'Battery',
- 'Bluetooth',
- 'Audio',
- 'Network',
- 'Keyboard Layout',
- 'Date',
- 'Clock',
- },
- },
- },
-}
diff --git a/awesome/src/tools/auto_starter.lua b/awesome/src/tools/auto_starter.lua
index 06edd62..0a90e5b 100644
--- a/awesome/src/tools/auto_starter.lua
+++ b/awesome/src/tools/auto_starter.lua
@@ -1,5 +1,9 @@
+local ipairs = ipairs
+local io = io
+
local Gio = require('lgi').Gio
local aspawn = require('awful.spawn')
+local beautiful = require('beautiful')
local gfilesystem = require('gears.filesystem')
local capi = {
@@ -14,21 +18,26 @@ local function is_restart()
return restart_detected
end
-return function(table)
+local instance = nil
+if not instance then
+ instance = setmetatable({}, {
+ __call = function()
+ if is_restart() then return end
- if is_restart() then return end
+ for _, t in ipairs(beautiful.user_config.autostart) do
+ aspawn(t);
+ end
+ local path = gfilesystem.get_xdg_config_home() .. 'autostart/'
+ local handler = io.popen('ls ' .. path)
+ if not handler then return end
- for _, t in ipairs(table) do
- aspawn(t);
- end
- local path = gfilesystem.get_xdg_config_home() .. 'autostart/'
- local handler = io.popen('ls ' .. path)
- if not handler then return end
-
- for file in handler:lines() do
- local app = Gio.DesktopAppInfo.new_from_filename(path .. file)
- if app then
- Gio.AppInfo.launch_uris_async(Gio.AppInfo.create_from_commandline(Gio.DesktopAppInfo.get_string(app, 'Exec'), nil, 0))
- end
- end
+ for file in handler:lines() do
+ local app = Gio.DesktopAppInfo.new_from_filename(path .. file)
+ if app then
+ Gio.AppInfo.launch_uris_async(Gio.AppInfo.create_from_commandline(Gio.DesktopAppInfo.get_string(app, 'Exec'), nil, 0))
+ end
+ end
+ end,
+ })
end
+return instance
diff --git a/awesome/src/tools/config.lua b/awesome/src/tools/config.lua
index e5674d3..7458d8e 100644
--- a/awesome/src/tools/config.lua
+++ b/awesome/src/tools/config.lua
@@ -1,17 +1,19 @@
-local lgi = require('lgi')
-local GLib = lgi.GLib
-local Gio = lgi.Gio
+local assert = assert
+local error = error
+local io = io
+local pairs = pairs
+
+-- Awesome libs
+local aspawn = require('awful.spawn')
+local gfilesystem = require('gears.filesystem')
local gobject = require('gears.object')
local gtable = require('gears.table')
-local gfilesystem = require('gears.filesystem')
-local aspawn = require('awful.spawn')
+-- Third party libs
local json = require('src.lib.json-lua.json-lua')
local config = {}
-local instance
-
---Takes a file path and puts the content into the callback
---@param path string file path, caller has to make sure it exists
---@return string|nil file_content
@@ -58,30 +60,31 @@ config.write_json = function(path, content)
handler:close()
end
-local function new()
- local ret = gobject {}
-
- gtable.crush(ret, config, true)
-
- -- Create config files if they don't exist
- for _, file in pairs { 'floating.json', 'dock.json', 'desktop.json', 'applications.json' } do
- if not gfilesystem.file_readable(gfilesystem.get_configuration_dir() .. 'src/config/' .. file) then
- aspawn('touch ' .. gfilesystem.get_configuration_dir() .. 'src/config/' .. file)
- end
- end
-
- -- Create config directories if they don't exist
- for _, dir in pairs { 'files/desktop/icons' } do
- if not gfilesystem.dir_readable(gfilesystem.get_configuration_dir() .. 'src/config/' .. dir) then
- gfilesystem.make_directories(gfilesystem.get_configuration_dir() .. 'src/config/' .. dir)
- end
- end
-
- return ret
-end
-
+local instance = nil
if not instance then
- instance = new()
+ instance = setmetatable(config, {
+ __call = function()
+ local ret = gobject {}
+
+ gtable.crush(ret, config, true)
+
+ -- Create config files if they don't exist
+ for _, file in pairs { 'floating.json', 'dock.json', 'desktop.json', 'applications.json' } do
+ if not gfilesystem.file_readable(gfilesystem.get_configuration_dir() .. 'src/config/' .. file) then
+ aspawn('touch ' .. gfilesystem.get_configuration_dir() .. 'src/config/' .. file)
+ end
+ end
+
+ -- Create config directories if they don't exist
+ for _, dir in pairs { 'files/desktop/icons' } do
+ if not gfilesystem.dir_readable(gfilesystem.get_configuration_dir() .. 'src/config/' .. dir) then
+ gfilesystem.make_directories(gfilesystem.get_configuration_dir() .. 'src/config/' .. dir)
+ end
+ end
+
+ return ret
+ end,
+ })
end
return instance
diff --git a/awesome/src/tools/gio_icon_lookup.lua b/awesome/src/tools/gio_icon_lookup.lua
index cbf046b..5dbb61f 100644
--- a/awesome/src/tools/gio_icon_lookup.lua
+++ b/awesome/src/tools/gio_icon_lookup.lua
@@ -1,23 +1,31 @@
+local setmetatable = setmetatable
+
-- Libraries
local lgi = require('lgi')
local Gtk = lgi.require('Gtk', '3.0')
--- Init a new Gtk theme from the users string
-local gtk_theme = Gtk.IconTheme.get_default()
+local icon_lookup = {}
----Gets the icon path from an AppInfo gicon.
----@param app Gio.AppInfo|nil
----@param icon_string string|nil
----@return string|nil path
-function Get_gicon_path(app, icon_string)
+function icon_lookup:get_gicon_path(app, icon_string)
if (not app) and (not icon_string) then return end
if icon_string then
- return gtk_theme:lookup_icon(icon_string, 64, 0):get_filename() or ''
+ return self.gtk_theme:lookup_icon(icon_string, 64, 0):get_filename() or ''
end
- local icon_info = gtk_theme:lookup_by_gicon(app, 64, 0)
+ local icon_info = self.gtk_theme:lookup_by_gicon(app, 64, 0)
if icon_info then
return icon_info:get_filename()
end
return nil
end
+
+local instance = nil
+if not instance then
+ instance = setmetatable(icon_lookup, {
+ __call = function(self, ...)
+ self.gtk_theme = Gtk.IconTheme.get_default()
+ return self
+ end,
+ })
+end
+return instance
diff --git a/awesome/src/tools/helpers/backlight.lua b/awesome/src/tools/helpers/backlight.lua
index cb2d28c..efa0144 100644
--- a/awesome/src/tools/helpers/backlight.lua
+++ b/awesome/src/tools/helpers/backlight.lua
@@ -13,12 +13,12 @@ function backlight.brightness_get_async(callback)
end
function backlight:brightness_increase()
- aspawn('brightnessctl set +2%')
+ aspawn('brightnessctl set 2+%')
self:emit_signal('brightness_changed')
end
function backlight:brightness_decrease()
- aspawn('brightnessctl set -2%')
+ aspawn('brightnessctl set 2-%')
self:emit_signal('brightness_changed')
end
diff --git a/awesome/src/tools/helpers/cpu_freq.lua b/awesome/src/tools/helpers/cpu_freq.lua
index eba8e0b..f28d35b 100644
--- a/awesome/src/tools/helpers/cpu_freq.lua
+++ b/awesome/src/tools/helpers/cpu_freq.lua
@@ -1,5 +1,6 @@
local gobject = require('gears.object')
local watch = require('awful.widget.watch')
+local beautiful = require('beautiful')
local instance = nil
@@ -14,14 +15,14 @@ local function new()
end
local average = 0
- if User_config.clock_mode == 'average' then
+ if beautiful.user_config.clock_mode == 'average' then
for i = 1, #cpu_freq do
average = average + cpu_freq[i]
end
average = math.floor((average / #cpu_freq) + 0.5)
self:emit_signal('update::cpu_freq_average', average)
- elseif User_config.clock_mode then
- self:emit_signal('update::cpu_freq_core', cpu_freq[User_config.clock_mode])
+ elseif beautiful.user_config.clock_mode then
+ self:emit_signal('update::cpu_freq_core', cpu_freq[beautiful.user_config.clock_mode])
end
end)
diff --git a/awesome/src/tools/helpers/kb_helper.lua b/awesome/src/tools/helpers/kb_helper.lua
index 81481ae..c8b1ec4 100644
--- a/awesome/src/tools/helpers/kb_helper.lua
+++ b/awesome/src/tools/helpers/kb_helper.lua
@@ -2,6 +2,7 @@
local gobject = require('gears.object')
local gtable = require('gears.table')
local aspawn = require('awful.spawn')
+local beautiful = require('beautiful')
local instance = nil
local kb_helper = {}
@@ -37,7 +38,7 @@ local function new()
gtable.crush(self, kb_helper, true)
- self.layout_list = User_config.kblayout
+ self.layout_list = beautiful.user_config.kblayout
return self
end
diff --git a/awesome/src/tools/helpers/playerctl.lua b/awesome/src/tools/helpers/playerctl.lua
index 466a28d..0226b35 100644
--- a/awesome/src/tools/helpers/playerctl.lua
+++ b/awesome/src/tools/helpers/playerctl.lua
@@ -7,6 +7,7 @@ local gfilesystem = require('gears.filesystem')
local gtimer = require('gears.timer')
local gcolor = require('gears.color')
local gtable = require('gears.table')
+local beautiful = require('beautiful')
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/notifications/'
@@ -157,13 +158,13 @@ local function start_manage(self, w, name)
local function on_loop_status(_, status)
if status == 'TRACK' then
w:get_children_by_id('repeat')[1].image = gcolor.recolor_image(icondir .. 'repeat-once.svg',
- Theme_config.notification_center.song_info.repeat_all)
+ beautiful.colorscheme.bg_green)
elseif status == 'PLAYLIST' then
w:get_children_by_id('repeat')[1].image = gcolor.recolor_image(icondir .. 'repeat.svg',
- Theme_config.notification_center.song_info.repeat_all)
+ beautiful.colorscheme.bg_green)
else
w:get_children_by_id('repeat')[1].image = gcolor.recolor_image(icondir .. 'repeat.svg',
- Theme_config.notification_center.song_info.repeat_disabled)
+ beautiful.colorscheme.bg1)
end
end
@@ -173,10 +174,10 @@ local function start_manage(self, w, name)
local function on_shuffle(_, status)
if status then
w:get_children_by_id('shuffle')[1].image = gcolor.recolor_image(icondir .. 'shuffle.svg',
- Theme_config.notification_center.song_info.shuffle_enabled)
+ beautiful.colorscheme.bg_green)
else
w:get_children_by_id('shuffle')[1].image = gcolor.recolor_image(icondir .. 'shuffle.svg',
- Theme_config.notification_center.song_info.shuffle_disabled)
+ beautiful.colorscheme.bg1)
end
end
diff --git a/awesome/src/tools/hex_to_rgba.lua b/awesome/src/tools/hex_to_rgba.lua
deleted file mode 100644
index 99699a9..0000000
--- a/awesome/src/tools/hex_to_rgba.lua
+++ /dev/null
@@ -1,8 +0,0 @@
-function RGB_to_hex(r, g, b)
- r = r or 0
- g = g or 0
- b = b or 0
-
- return string.format("#%02X%02X%02X", math.floor((r * 255) + 0.5), math.floor((g * 255) + 0.5),
- math.floor((b * 255) + 0.5))
-end
diff --git a/awesome/src/tools/hover.lua b/awesome/src/tools/hover.lua
index 6327bbb..734a261 100644
--- a/awesome/src/tools/hover.lua
+++ b/awesome/src/tools/hover.lua
@@ -30,7 +30,7 @@ local function overlay_color(col, overlay, opacity)
end
local function bg_hover(args)
- --[[ args = args or {}
+ args = args or {}
local old_cursor, old_wibox
local _, r, g, b, a = args.widget.bg:get_rgba()
@@ -117,7 +117,7 @@ local function bg_hover(args)
args.widget:connect_signal('property::bg', function(_, newbg)
r, g, b, a = hex_to_rgba(newbg)
- end) ]]
+ end)
end
--[[ local function fg_hover(args)
diff --git a/awesome/src/tools/ical_parser.lua b/awesome/src/tools/ical_parser.lua
index dfe042b..c75f5af 100644
--- a/awesome/src/tools/ical_parser.lua
+++ b/awesome/src/tools/ical_parser.lua
@@ -1,11 +1,9 @@
-local gfilesystem = require("gears.filesystem")
-local gobject = require("gears.object")
-local gtable = require("gears.table")
-local naughty = require("naughty")
+local gfilesystem = require('gears.filesystem')
+local gobject = require('gears.object')
+local gtable = require('gears.table')
+local naughty = require('naughty')
-local color = require("src.theme.colors")
-
-local json = require("src.lib.json-lua.json-lua")
+local json = require('src.lib.json-lua.json-lua')
local ical = { mt = {} }
ical.VCALENDAR = {}
@@ -75,25 +73,25 @@ ical._private.parser = {}
function ical._private.add_to_cache(file, vcal)
-- Copy file to src/config/files/calendar/
- local path = gfilesystem.get_configuration_dir() .. "src/config/"
- local file_name = file:match(".*/(.*)")
+ local path = gfilesystem.get_configuration_dir() .. 'src/config/'
+ local file_name = file:match('.*/(.*)')
if not
- os.execute("cp " ..
- file .. " " .. gfilesystem.get_configuration_dir() .. "src/config/files/calendar/" .. file_name) then
- naughty.notification({
- app_name = "Systemnotification",
- title = "Error",
- text = "Could not copy file to config/files/calendar/",
+ os.execute('cp ' ..
+ file .. ' ' .. gfilesystem.get_configuration_dir() .. 'src/config/files/calendar/' .. file_name) then
+ naughty.notification {
+ app_name = 'Systemnotification',
+ title = 'Error',
+ text = 'Could not copy file to config/files/calendar/',
timeout = 0,
- urgency = "critical",
- })
+ urgency = 'critical',
+ }
return
end
- local handler = io.open(path .. "calendar.json", "r")
+ local handler = io.open(path .. 'calendar.json', 'r')
if not handler then return end
- local json_data = json:decode(handler:read("a"))
+ local json_data = json:decode(handler:read('a'))
handler:close()
- if not (type(json_data) == "table") then return end
+ if not (type(json_data) == 'table') then return end
table.insert(json_data, {
file = file_name,
VCALENDAR = vcal,
@@ -101,19 +99,19 @@ function ical._private.add_to_cache(file, vcal)
json_data = json:encode(json_data)
- handler = io.open(path .. "calendar.json", "w")
+ handler = io.open(path .. 'calendar.json', 'w')
if not handler then return end
handler:write(json_data)
handler:close()
end
function ical:add_calendar(file)
- local handler = io.open(file, "r")
+ local handler = io.open(file, 'r')
if not handler then return end
-- Check if the line is a BEGIN:VCALENDAR
- local v, k = handler:read("l"):match("([A-Z]+):([A-Z]+)")
+ local v, k = handler:read('l'):match('([A-Z]+):([A-Z]+)')
local vcal = {}
- if v:match("BEGIN") and k:match("VCALENDAR") then
+ if v:match('BEGIN') and k:match('VCALENDAR') then
vcal = self._private.parser:VCALENDAR(handler)
table.insert(self.VCALENDAR, vcal)
self._private.add_to_cache(file, vcal)
@@ -124,12 +122,12 @@ function ical.new(args)
args = args or {}
local ret = gobject { enable_properties = true, enable_auto_signals = true }
gtable.crush(ret, ical, true)
- local path = gfilesystem.get_configuration_dir() .. "src/config/calendar.json"
- local handler = io.open(path, "r")
+ local path = gfilesystem.get_configuration_dir() .. 'src/config/calendar.json'
+ local handler = io.open(path, 'r')
if not handler then return ret end
- local json_data = json:decode(handler:read("a"))
+ local json_data = json:decode(handler:read('a'))
handler:close()
- if not (type(json_data) == "table") then return end
+ if not (type(json_data) == 'table') then return end
--Load into the cache
for _, v in ipairs(json_data) do
ret._private.cache[v.file] = v.VCALENDAR
@@ -138,21 +136,7 @@ function ical.new(args)
local function get_random_color()
local colors = {
- color["Blue200"],
- color["Red200"],
- color["Green200"],
- color["Yellow200"],
- color["Purple200"],
- color["Orange200"],
- color["Pink200"],
- color["Cyan200"],
- color["Lime200"],
- color["Teal200"],
- color["Indigo200"],
- color["LightBlue200"],
- color["BlueGrey200"],
- color["DeepOrange200"],
- color["DeepPurple200"],
+ '#FF0000',
}
return colors[math.random(1, 15)]
@@ -167,63 +151,63 @@ function ical._private.parser:VEVENT(handler)
local VEVENT = {}
while true do
- local line = handler:read("l")
+ local line = handler:read('l')
- if not line or line:match("END:VEVENT") then
+ if not line or line:match('END:VEVENT') then
break
end
- local v, k = line:match("(.*):(.*)")
- if v:match("CREATED") then
+ local v, k = line:match('(.*):(.*)')
+ if v:match('CREATED') then
VEVENT.CREATED = self.to_datetime(k)
- elseif v:match("LAST-MODIFIED") then
+ elseif v:match('LAST-MODIFIED') then
VEVENT.LAST_MODIFIED = self.to_datetime(k)
- elseif v:match("DTSTAMP") then
+ elseif v:match('DTSTAMP') then
VEVENT.DTSTAMP = self.to_datetime(k)
- elseif v:match("UID") then
+ elseif v:match('UID') then
VEVENT.UID = k
- elseif v:match("SUMMARY") then
+ elseif v:match('SUMMARY') then
VEVENT.SUMMARY = k
- elseif v:match("STATUS") then
+ elseif v:match('STATUS') then
VEVENT.STATUS = k
- elseif v:match("RRULE") then
+ elseif v:match('RRULE') then
VEVENT.RRULE = {
- FREQ = k:match("FREQ=([A-Z]+)"),
- UNTIL = self.to_datetime(k:match("UNTIL=([TZ0-9]+)")),
- WKST = k:match("WKST=([A-Z]+)"),
- COUNT = k:match("COUNT=([0-9]+)"),
- INTERVAL = k:match("INTERVAL=([0-9]+)")
+ FREQ = k:match('FREQ=([A-Z]+)'),
+ UNTIL = self.to_datetime(k:match('UNTIL=([TZ0-9]+)')),
+ WKST = k:match('WKST=([A-Z]+)'),
+ COUNT = k:match('COUNT=([0-9]+)'),
+ INTERVAL = k:match('INTERVAL=([0-9]+)'),
}
- elseif v:match("DTSTART") then
+ elseif v:match('DTSTART') then
VEVENT.DTSTART = {
DTSTART = self.to_datetime(k),
- TZID = v:match("TZID=([a-zA-Z-\\/]+)"),
- VALUE = v:match("VALUE=([A-Z]+)")
+ TZID = v:match('TZID=([a-zA-Z-\\/]+)'),
+ VALUE = v:match('VALUE=([A-Z]+)'),
}
- elseif v:match("DTEND") then
+ elseif v:match('DTEND') then
VEVENT.DTEND = {
DTEND = self.to_datetime(k),
- TZID = v:match("TZID=([a-zA-Z-\\/]+)"),
- VALUE = v:match("VALUE=([A-Z]+)")
+ TZID = v:match('TZID=([a-zA-Z-\\/]+)'),
+ VALUE = v:match('VALUE=([A-Z]+)'),
}
- elseif v:match("TRANSP") then
+ elseif v:match('TRANSP') then
VEVENT.TRANSP = k
- elseif v:match("LOCATION") then
+ elseif v:match('LOCATION') then
VEVENT.LOCATION = k
- elseif v:match("SEQUENCE") then
+ elseif v:match('SEQUENCE') then
VEVENT.SEQUENCE = k
- elseif v:match("DESCRIPTION") then
+ elseif v:match('DESCRIPTION') then
VEVENT.DESCRIPTION = k
- elseif v:match("URL") then
+ elseif v:match('URL') then
VEVENT.URL = {
URL = k,
- VALUE = v:match("VALUE=([A-Z]+)")
+ VALUE = v:match('VALUE=([A-Z]+)'),
}
- elseif v:match("BEGIN") then
- if k:match("VALARM") then
+ elseif v:match('BEGIN') then
+ if k:match('VALARM') then
VEVENT.VALARM = self:VALARM(handler)
end
- elseif v:match("UID") then
+ elseif v:match('UID') then
VEVENT.UID = k
end
end
@@ -235,8 +219,8 @@ end
function ical._private.parser.alarm_to_time(alarm)
if not alarm then return end
--Parse alarm into a time depending on its value. The value will be -PT15M where - mean before and with no leading - it means after. PT can be ignored and 15 is the time M then the unit where M is minute, H is out etc
- local time = alarm:match("([-]?[0-9]+)[A-Z]")
- local unit = alarm:match("[-]?[A-Z][A-Z][0-9]+([A-Z]*)")
+ local time = alarm:match('([-]?[0-9]+)[A-Z]')
+ local unit = alarm:match('[-]?[A-Z][A-Z][0-9]+([A-Z]*)')
return time .. unit
end
@@ -245,21 +229,21 @@ function ical._private.parser:VALARM(handler)
local VALARM = {}
while true do
- local line = handler:read("l")
+ local line = handler:read('l')
- if not line or line:match("END:VALARM") then
+ if not line or line:match('END:VALARM') then
break
end
- local v, k = line:match("(.*):(.*)")
- if v:match("ACTION") then
+ local v, k = line:match('(.*):(.*)')
+ if v:match('ACTION') then
VALARM.ACTION = k
- elseif v:match("TRIGGER;VALUE=DURATION") then
+ elseif v:match('TRIGGER;VALUE=DURATION') then
VALARM.TRIGGER = {
- VALUE = v:match("VALUE=(.*):"),
- TRIGGER = self._private.parser.alarm_to_time(k)
+ VALUE = v:match('VALUE=(.*):'),
+ TRIGGER = self._private.parser.alarm_to_time(k),
}
- elseif v:match("DESCRIPTION") then
+ elseif v:match('DESCRIPTION') then
VALARM.DESCRIPTION = k
end
end
@@ -273,22 +257,22 @@ function ical._private.parser:VCALENDAR(handler)
VCALENDAR.VTIMEZONE = {}
while true do
- local line = handler:read("l")
+ local line = handler:read('l')
- if not line or line:match("END:VCALENDAR") then
+ if not line or line:match('END:VCALENDAR') then
break
end
- local v, k = line:match("(.*):(.*)")
+ local v, k = line:match('(.*):(.*)')
if v and k then
- if v:match("PRODID") then
+ if v:match('PRODID') then
VCALENDAR.PRODID = k
- elseif v:match("VERSION") then
+ elseif v:match('VERSION') then
VCALENDAR.VERSION = k
- elseif v:match("BEGIN") then
- if k:match("VTIMEZONE") then
+ elseif v:match('BEGIN') then
+ if k:match('VTIMEZONE') then
VCALENDAR.VTIMEZONE = self:VTIMEZONE(handler)
- elseif k:match("VEVENT") then
+ elseif k:match('VEVENT') then
table.insert(VCALENDAR.VEVENT, self:VEVENT(handler))
end
end
@@ -303,20 +287,20 @@ function ical._private.parser:VTIMEZONE(handler)
local VTIMEZONE = {}
while true do
- local line = handler:read("l")
+ local line = handler:read('l')
- if not line or line:match("END:VTIMEZONE") then
+ if not line or line:match('END:VTIMEZONE') then
break
end
- local v, k = line:match("(.*):(.*)")
- if v:match("TZID") then
+ local v, k = line:match('(.*):(.*)')
+ if v:match('TZID') then
VTIMEZONE.TZID = k
end
- if v:match("BEGIN") then
- if k:match("DAYLIGHT") then
+ if v:match('BEGIN') then
+ if k:match('DAYLIGHT') then
VTIMEZONE.DAYLIGHT = self:DAYLIGHT(handler)
- elseif k:match("STANDARD") then
+ elseif k:match('STANDARD') then
VTIMEZONE.STANDARD = self:STANDARD(handler)
end
end
@@ -329,26 +313,26 @@ function ical._private.parser:DAYLIGHT(handler)
local DAYLIGHT = {}
while true do
- local line = handler:read("l")
+ local line = handler:read('l')
- if not line or line:match("END:DAYLIGHT") then
+ if not line or line:match('END:DAYLIGHT') then
break
end
- local v, k = line:match("(.*):(.*)")
- if v:match("TZOFFSETFROM") then
+ local v, k = line:match('(.*):(.*)')
+ if v:match('TZOFFSETFROM') then
DAYLIGHT.TZOFFSETFROM = self.offset(k)
- elseif v:match("TZOFFSETTO") then
+ elseif v:match('TZOFFSETTO') then
DAYLIGHT.TZOFFSETTO = self.offset(k)
- elseif v:match("TZNAME") then
+ elseif v:match('TZNAME') then
DAYLIGHT.TZNAME = k
- elseif v:match("DTSTART") then
+ elseif v:match('DTSTART') then
DAYLIGHT.DTSTART = self.to_datetime(k)
- elseif v:match("RRULE") then
+ elseif v:match('RRULE') then
DAYLIGHT.RRULE = {
- FREQ = k:match("FREQ=([A-Z]+)"),
- BYDAY = k:match("BYDAY=([%+%-0-9A-Z,]+)"),
- BYMONTH = k:match("BYMONTH=([0-9]+)")
+ FREQ = k:match('FREQ=([A-Z]+)'),
+ BYDAY = k:match('BYDAY=([%+%-0-9A-Z,]+)'),
+ BYMONTH = k:match('BYMONTH=([0-9]+)'),
}
end
end
@@ -364,27 +348,27 @@ function ical._private.parser:STANDARD(handler)
-- Read each line until END:STANDARD is read
while true do
- local line = handler:read("l")
+ local line = handler:read('l')
- if not line or line:match("END:STANDARD") then
+ if not line or line:match('END:STANDARD') then
break
end
-- Break down each line into the property:value
- local v, k = line:match("(.*):(.*)")
- if v:match("TZOFFSETFROM") then
+ local v, k = line:match('(.*):(.*)')
+ if v:match('TZOFFSETFROM') then
STANDARD.TZOFFSETFROM = self.offset(k)
- elseif v:match("TZOFFSETTO") then
+ elseif v:match('TZOFFSETTO') then
STANDARD.TZOFFSETTO = self.offset(k)
- elseif v:match("TZNAME") then
+ elseif v:match('TZNAME') then
STANDARD.TZNAME = k
- elseif v:match("DTSTART") then
+ elseif v:match('DTSTART') then
STANDARD.DTSTART = self.to_datetime(k)
- elseif v:match("RRULE") then
+ elseif v:match('RRULE') then
STANDARD.RRULE = {
- FREQ = k:match("FREQ=([A-Z]+)"),
- BYDAY = k:match("BYDAY=([%+%-0-9A-Z,]+)"),
- BYMONTH = k:match("BYMONTH=([0-9]+)")
+ FREQ = k:match('FREQ=([A-Z]+)'),
+ BYDAY = k:match('BYDAY=([%+%-0-9A-Z,]+)'),
+ BYMONTH = k:match('BYMONTH=([0-9]+)'),
}
end
end
@@ -400,8 +384,8 @@ function ical._private.parser.to_datetime(datetime)
if not datetime then return end
local dt, utc = {}, nil
- dt.year, dt.month, dt.day = datetime:match("^(%d%d%d%d)(%d%d)(%d%d)")
- dt.hour, dt.min, dt.sec, utc = datetime:match("T(%d%d)(%d%d)(%d%d)(Z?)")
+ dt.year, dt.month, dt.day = datetime:match('^(%d%d%d%d)(%d%d)(%d%d)')
+ dt.hour, dt.min, dt.sec, utc = datetime:match('T(%d%d)(%d%d)(%d%d)(Z?)')
if (dt.hour == nil) or (dt.min == nil) or (dt.sec == nil) then
dt.hour, dt.min, dt.sec, utc = 0, 0, 0, nil
@@ -412,8 +396,8 @@ function ical._private.parser.to_datetime(datetime)
end
function ical._private.parser.offset(offset)
- local s, h, m = offset:match("([+-])(%d%d)(%d%d)")
- if s == "+" then s = 1 else s = -1 end
+ local s, h, m = offset:match('([+-])(%d%d)(%d%d)')
+ if s == '+' then s = 1 else s = -1 end
return s * (tonumber(h) * 3600 + tonumber(m) * 60)
end
diff --git a/awesome/src/tools/parse_ical.lua b/awesome/src/tools/parse_ical.lua
new file mode 100644
index 0000000..259cd08
--- /dev/null
+++ b/awesome/src/tools/parse_ical.lua
@@ -0,0 +1,108 @@
+local gfilesystem = require('gears.filesystem')
+
+local config = require('src.tools.config')
+
+local ical_cache_path = gfilesystem.get_configuration_dir() .. 'src/config/ical_cache.json'
+local ical_calendar_cache = {}
+
+local date_time = {}
+
+setmetatable(date_time, {
+ __call = function(args)
+ local dt = table.copy(date_time)
+
+ dt.day = args.day or 1
+ dt.month = args.month or 1
+ dt.year = args.year or 1970
+
+ dt.hour = args.hour or 0
+ dt.minute = args.minute or 0
+ dt.second = args.second or 0
+
+ return dt
+ end,
+ __newindex = function(self, ...)
+ if ... == 'weeknum' then
+ if not self.weeknum then
+ self.weeknum = 1 --TODO: calculate weeknum
+ end
+ return self.weeknum
+ end
+ end,
+ __add = function(a, b)
+ local dt = table.copy(date_time)
+ if type(a) == 'table' and type(b) == 'table' then
+
+ elseif type(a) == 'table' and type(b) == 'number' then
+
+ else
+ error('Cannot add number with date')
+ end
+ end,
+ __sub = function(a, b)
+
+ end,
+ __mul = function(a, b)
+
+ end,
+ __div = function(a, b)
+
+ end,
+});
+
+local parser = {}
+
+local instance = nil
+
+function parser:VEVENT()
+
+end
+
+---Start parsing a new calendar
+---@param path string path to .ical file
+function parser.parse(path)
+
+ local ical_name = path
+
+ -- Check if the calendar has been parsed previously
+ if ical_calendar_cache[ical_name] then
+ return ical_calendar_cache[ical_name]
+ else
+ -- If not create a new one in the cache
+ ical_calendar_cache[ical_name] = {}
+ end
+
+ return ical_calendar_cache[ical_name]
+end
+
+function parser.new(path)
+
+ -- Get the file from the path
+ local ical_name = path
+
+ -- Check if the calendar has been parsed previously
+ if ical_calendar_cache[ical_name] then
+ return ical_calendar_cache[ical_name]
+ end
+
+ -- If not create a new one in the cache
+ ical_calendar_cache[ical_name] = { mt = {} }
+
+ return ical_calendar_cache[ical_name]
+end
+
+if not instance then
+ instance = setmetatable(parser, {
+ -- If this module is called load all cached calendars from the cache
+ __call = function(self)
+ local cache_t = config.read_json(ical_cache_path)
+
+ -- Read all the calendars from the cache
+ for k, v in pairs(cache_t) do
+ self[k] = v
+ end
+ end,
+ })
+end
+
+return instance
diff --git a/awesome/src/widgets/audio.lua b/awesome/src/widgets/audio.lua
index c14c29c..2d31dcc 100644
--- a/awesome/src/widgets/audio.lua
+++ b/awesome/src/widgets/audio.lua
@@ -1,13 +1,15 @@
-------------------------------
--- This is the audio widget --
-------------------------------
+local setmetatable = setmetatable
+local tonumber = tonumber
+
-- Awesome Libs
local abutton = require('awful.button')
local apopup = require('awful.popup')
-local dpi = require('beautiful').xresources.apply_dpi
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table')
+local gtimer = require('gears.timer')
local wibox = require('wibox')
-- Local libs
@@ -25,13 +27,17 @@ return setmetatable({}, { __call = function(_, screen)
local ac_popup = apopup {
widget = audio_controller,
ontop = true,
- visible = false,
+ visible = true,
screen = screen,
- 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,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ bg = beautiful.colorscheme.bg,
}
+ gtimer.delayed_call(function()
+ ac_popup.visible = false
+ end)
+
local w = wibox.widget {
{
{
@@ -63,14 +69,14 @@ return setmetatable({}, { __call = function(_, screen)
right = dpi(8),
widget = wibox.container.margin,
},
- bg = Theme_config.audio.bg,
- fg = Theme_config.audio.fg,
- shape = Theme_config.audio.shape,
+ bg = beautiful.colorscheme.bg_yellow,
+ fg = beautiful.colorscheme.fg_dark,
+ shape = beautiful.shape[6],
widget = wibox.container.background,
buttons = { gtable.join(
abutton({}, 1, function()
local geo = capi.mouse.coords()
- ac_popup.y = dpi(65)
+ ac_popup.y = dpi(70)
ac_popup.x = geo.x - ac_popup.width / 2
ac_popup.visible = not ac_popup.visible
end)
@@ -84,7 +90,6 @@ return setmetatable({}, { __call = function(_, screen)
local audio_spacing = w:get_children_by_id('audio_layout')[1]
audio_helper:connect_signal('sink::get', function(_, muted, volume)
volume = tonumber(volume)
- assert(type(volume) == 'number' and type(muted) == 'boolean', 'Invalid arguments')
if w.volume == volume and w.muted == muted then return end
w.volume = volume
@@ -92,7 +97,7 @@ return setmetatable({}, { __call = function(_, screen)
if muted then
audio_label.visible = false
- audio_icon:set_image(gcolor.recolor_image(icondir .. 'volume-mute' .. '.svg', Theme_config.audio.fg))
+ audio_icon:set_image(gcolor.recolor_image(icondir .. 'volume-mute' .. '.svg', beautiful.colorscheme.fg_dark))
else
if not volume then return end
w.container:set_right(10)
@@ -111,7 +116,7 @@ return setmetatable({}, { __call = function(_, screen)
icon = icon .. '-high'
end
audio_label:set_text(volume .. '%')
- audio_icon:set_image(gcolor.recolor_image(icon .. '.svg', Theme_config.audio.fg))
+ audio_icon:set_image(gcolor.recolor_image(icon .. '.svg', beautiful.colorscheme.fg_dark))
end
end)
diff --git a/awesome/src/widgets/battery.lua b/awesome/src/widgets/battery.lua
index ae619af..f81825c 100644
--- a/awesome/src/widgets/battery.lua
+++ b/awesome/src/widgets/battery.lua
@@ -1,13 +1,18 @@
---------------------------------
--- This is the battery widget --
---------------------------------
+local ipairs = ipairs
+local mfloor = math.floor
+local setmetatable = setmetatable
-- Awesome Libs
-local awful = require('awful')
-local dpi = require('beautiful').xresources.apply_dpi
-local gears = require('gears')
+local aspawn = require('awful.spawn')
+local atooltip = require('awful.tooltip')
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
+local gcolor = require('gears.color')
+local gfilesystem = require('gears.filesystem')
+local gsurface = require('gears.surface')
+local gtimer = require('gears.timer')
local lgi = require('lgi')
-local naughty = require('naughty')
+local nnotification = require('naughty.notification')
local upower_glib = lgi.require('UPowerGlib')
local wibox = require('wibox')
@@ -19,228 +24,205 @@ local capi = {
}
-- Icon directory path
-local icondir = gears.filesystem.get_configuration_dir() .. 'src/assets/icons/battery/'
+local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/battery/'
----Returns the battery widget
----@return wibox.widget
-return function(battery_kind)
-
- -- Battery wibox.widget
- local battery_widget = wibox.widget {
- {
- {
+local instance = nil
+if not instance then
+ instance = setmetatable({}, {
+ __call = function(_, battery_kind)
+ local battery_widget = wibox.widget {
{
{
{
- id = 'icon',
- 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',
+ image = gcolor.recolor_image(icondir .. 'battery-unknown.svg', beautiful.colorscheme.fg_dark),
+ widget = wibox.widget.imagebox,
+ valign = 'center',
+ halign = 'center',
+ resize = false,
+ },
+ id = 'icon_layout',
+ widget = wibox.container.place,
+ },
+ id = 'icon_margin',
+ top = dpi(2),
+ widget = wibox.container.margin,
},
- id = 'icon_layout',
- widget = wibox.container.place,
+ spacing = dpi(10),
+ {
+ visible = false,
+ align = 'center',
+ valign = 'center',
+ id = 'label',
+ widget = wibox.widget.textbox,
+ },
+ id = 'battery_layout',
+ layout = wibox.layout.fixed.horizontal,
},
- id = 'icon_margin',
- top = dpi(2),
+ id = 'container',
+ left = dpi(8),
+ right = dpi(8),
widget = wibox.container.margin,
},
- spacing = dpi(10),
- {
- visible = false,
- align = 'center',
- valign = 'center',
- id = 'label',
- widget = wibox.widget.textbox,
- },
- id = 'battery_layout',
- layout = wibox.layout.fixed.horizontal,
- },
- id = 'container',
- left = dpi(8),
- right = dpi(8),
- widget = wibox.container.margin,
- },
- bg = Theme_config.battery.bg,
- fg = Theme_config.battery.fg,
- shape = function(cr, width, height)
- gears.shape.rounded_rect(cr, width, height, dpi(6))
+ bg = beautiful.colorscheme.bg_purple,
+ fg = beautiful.colorscheme.fg_dark,
+ shape = beautiful.shape[6],
+ widget = wibox.container.background,
+ }
+
+ hover.bg_hover { widget = battery_widget }
+
+ battery_widget:connect_signal('button::press', function()
+ aspawn(beautiful.user_config.energy_manager)
+ end)
+
+ local function get_device_path()
+ local paths = upower_glib.Client():get_devices()
+ local path_table = {}
+ for _, path in ipairs(paths) do
+ table.insert(path_table, path:get_object_path())
+ end
+ return path_table
+ end
+
+ local function get_device_from_path(path)
+ local devices = upower_glib.Client():get_devices()
+
+ for _, device in ipairs(devices) do
+ if device:get_object_path() == path then
+ return device
+ end
+ end
+ return nil
+ end
+
+ local tooltip = atooltip {
+ objects = { battery_widget },
+ mode = 'inside',
+ preferred_alignments = 'middle',
+ margins = dpi(10),
+ }
+
+ ---Sets the battery information for the widget
+ ---@param device UPowerGlib.Device battery
+ local function set_battery(device)
+ local battery_percentage = mfloor(device.percentage + 0.5)
+ local battery_status = upower_glib.DeviceState[device.state]:lower()
+ local battery_temp = device.temperature
+
+ local battery_time = 1
+
+ if device.time_to_empty ~= 0 then
+ battery_time = device.time_to_empty
+ else
+ battery_time = device.time_to_full
+ end
+
+ local battery_string = mfloor(battery_time / 3600) .. 'h, ' .. mfloor((battery_time / 60) % 60) .. 'm'
+
+ if battery_temp == 0.0 then
+ battery_temp = 'NaN'
+ else
+ battery_temp = mfloor(battery_temp + 0.5) .. '°C'
+ end
+
+ if not battery_percentage then
+ return
+ end
+
+ battery_widget:get_children_by_id('battery_layout')[1].spacing = dpi(5)
+ battery_widget:get_children_by_id('label')[1].visible = true
+ battery_widget:get_children_by_id('label')[1].text = battery_percentage .. '%'
+
+ tooltip.markup = "Battery Status: "
+ .. battery_status .. "\nRemaining time: "
+ .. battery_string .. "\nTemperature: "
+ .. battery_temp .. ''
+
+ local icon = 'battery'
+
+ if battery_status == 'fully-charged' or battery_status == 'charging' and battery_percentage == 100 then
+ icon = icon .. '-' .. 'charging.svg'
+ nnotification {
+ title = 'Battery notification',
+ message = 'Battery is fully charged',
+ icon = icondir .. icon,
+ timeout = 5,
+ }
+ battery_widget:get_children_by_id('icon')[1].image = gsurface.load_uncached(gcolor.recolor_image(icondir
+ .. icon, beautiful.colorscheme.fg_dark))
+ return
+ elseif battery_percentage > 0 and battery_percentage < 10 and battery_status == 'discharging' then
+ icon = icon .. '-' .. 'alert.svg'
+ nnotification {
+ title = 'Battery warning',
+ message = 'Battery is running low!\n' .. battery_percentage .. '% left',
+ urgency = 'critical',
+ icon = icondir .. icon,
+ timeout = 60,
+ }
+ battery_widget:get_children_by_id('icon')[1].image = gsurface.load_uncached(gcolor.recolor_image(icondir
+ .. icon, beautiful.colorscheme.fg_dark))
+ return
+ end
+
+ if battery_percentage > 0 and battery_percentage < 10 then
+ icon = icon .. '-' .. battery_status .. '-' .. 'outline'
+ elseif battery_percentage >= 10 and battery_percentage < 20 then
+ icon = icon .. '-' .. battery_status .. '-' .. '10'
+ elseif battery_percentage >= 20 and battery_percentage < 30 then
+ icon = icon .. '-' .. battery_status .. '-' .. '20'
+ elseif battery_percentage >= 30 and battery_percentage < 40 then
+ icon = icon .. '-' .. battery_status .. '-' .. '30'
+ elseif battery_percentage >= 40 and battery_percentage < 50 then
+ icon = icon .. '-' .. battery_status .. '-' .. '40'
+ elseif battery_percentage >= 50 and battery_percentage < 60 then
+ icon = icon .. '-' .. battery_status .. '-' .. '50'
+ elseif battery_percentage >= 60 and battery_percentage < 70 then
+ icon = icon .. '-' .. battery_status .. '-' .. '60'
+ elseif battery_percentage >= 70 and battery_percentage < 80 then
+ icon = icon .. '-' .. battery_status .. '-' .. '70'
+ elseif battery_percentage >= 80 and battery_percentage < 90 then
+ icon = icon .. '-' .. battery_status .. '-' .. '80'
+ elseif battery_percentage >= 90 and battery_percentage < 100 then
+ icon = icon .. '-' .. battery_status .. '-' .. '90'
+ end
+
+ battery_widget:get_children_by_id('icon')[1].image = gsurface.load_uncached(gcolor.recolor_image(icondir ..
+ icon .. '.svg', beautiful.colorscheme.fg_dark))
+ capi.awesome.emit_signal('update::battery_widget', battery_percentage, icondir .. icon .. '.svg')
+ end
+
+ local function attach_to_device(path)
+ local device_path = beautiful.user_config.battery_path or path or ''
+
+ battery_widget.device = get_device_from_path(device_path) or upower_glib.Client():get_display_device()
+
+ battery_widget.device.on_notify = function(device)
+ battery_widget:emit_signal('upower::update', device)
+ end
+
+ if upower_glib.DeviceKind[battery_widget.device.kind] == battery_kind then
+ set_battery(battery_widget.device)
+ end
+
+ gtimer.delayed_call(battery_widget.emit_signal, battery_widget, 'upower::update', battery_widget.device)
+ end
+
+ for _, device in ipairs(get_device_path()) do
+ attach_to_device(device)
+ end
+
+ battery_widget:connect_signal('upower::update', function(_, device)
+ if upower_glib.DeviceKind[battery_widget.device.kind] == battery_kind then
+ set_battery(device)
+ end
+ end)
+
+ return battery_widget
end,
- widget = wibox.container.background,
- }
-
- -- Color change on mouse over
- hover.bg_hover { widget = battery_widget }
-
- -- Open an energy manager on click
- battery_widget:connect_signal(
- 'button::press',
- function()
- awful.spawn(User_config.energy_manager)
- end
- )
-
- ---Gets every enery device path
- ---@return table string battery device paths
- local function get_device_path()
- local paths = upower_glib.Client():get_devices()
- local path_table = {}
- for _, path in ipairs(paths) do
- table.insert(path_table, path:get_object_path())
- end
- return path_table
- end
-
- ---Takes a path and returns the glib object
- ---@param path string battery device path
- ---@return UPowerGlib.Device | nil battery battery device object
- local function get_device_from_path(path)
- local devices = upower_glib.Client():get_devices()
-
- for _, device in ipairs(devices) do
- if device:get_object_path() == path then
- return device
- end
- end
- return nil
- end
-
- local tooltip = awful.tooltip {
- objects = { battery_widget },
- mode = 'inside',
- preferred_alignments = 'middle',
- margins = dpi(10),
- }
-
- ---Sets the battery information for the widget
- ---@param device UPowerGlib.Device battery
- local function set_battery(device)
- local battery_percentage = math.floor(device.percentage + 0.5)
- local battery_status = upower_glib.DeviceState[device.state]:lower()
- local battery_temp = device.temperature
-
- local battery_time = 1
-
- if device.time_to_empty ~= 0 then
- battery_time = device.time_to_empty
- else
- battery_time = device.time_to_full
- end
-
- local battery_string = math.floor(battery_time / 3600) .. 'h, ' .. math.floor((battery_time / 60) % 60) .. 'm'
-
- if battery_temp == 0.0 then
- battery_temp = 'NaN'
- else
- battery_temp = math.floor(battery_temp + 0.5) .. '°C'
- end
-
- if not battery_percentage then
- return
- end
-
- battery_widget:get_children_by_id('battery_layout')[1].spacing = dpi(5)
- battery_widget:get_children_by_id('label')[1].visible = true
- battery_widget:get_children_by_id('label')[1].text = battery_percentage .. '%'
-
- tooltip.markup = "Battery Status: "
- .. battery_status .. "\nRemaining time: "
- .. battery_string .. "\nTemperature: "
- .. battery_temp .. ''
-
- local icon = 'battery'
-
- if battery_status == 'fully-charged' or battery_status == 'charging' and battery_percentage == 100 then
- icon = icon .. '-' .. 'charging.svg'
- naughty.notification {
- title = 'Battery notification',
- message = 'Battery is fully charged',
- icon = icondir .. icon,
- timeout = 5,
- }
- 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'
- naughty.notification {
- title = 'Battery warning',
- message = 'Battery is running low!\n' .. battery_percentage .. '% left',
- urgency = 'critical',
- icon = icondir .. icon,
- timeout = 60,
- }
- 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
-
- if battery_percentage > 0 and battery_percentage < 10 then
- icon = icon .. '-' .. battery_status .. '-' .. 'outline'
- elseif battery_percentage >= 10 and battery_percentage < 20 then
- icon = icon .. '-' .. battery_status .. '-' .. '10'
- elseif battery_percentage >= 20 and battery_percentage < 30 then
- icon = icon .. '-' .. battery_status .. '-' .. '20'
- elseif battery_percentage >= 30 and battery_percentage < 40 then
- icon = icon .. '-' .. battery_status .. '-' .. '30'
- elseif battery_percentage >= 40 and battery_percentage < 50 then
- icon = icon .. '-' .. battery_status .. '-' .. '40'
- elseif battery_percentage >= 50 and battery_percentage < 60 then
- icon = icon .. '-' .. battery_status .. '-' .. '50'
- elseif battery_percentage >= 60 and battery_percentage < 70 then
- icon = icon .. '-' .. battery_status .. '-' .. '60'
- elseif battery_percentage >= 70 and battery_percentage < 80 then
- icon = icon .. '-' .. battery_status .. '-' .. '70'
- elseif battery_percentage >= 80 and battery_percentage < 90 then
- icon = icon .. '-' .. battery_status .. '-' .. '80'
- elseif battery_percentage >= 90 and battery_percentage < 100 then
- 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', Theme_config.battery.fg))
- capi.awesome.emit_signal('update::battery_widget', battery_percentage, icondir .. icon .. '.svg')
-
- end
-
- ---This function attaches a device path to the dbus interface
- ---It will only display on a widget if the user specified a device kind
- ---This device will then be filtered out and sent information to the widget itself
- ---The rest will only report in the background to other widgets e.g. Bluetooth devices
- ---Will report to the bluetooth widget.
- ---@param path string device path /org/freedesktop/...
- local function attach_to_device(path)
- 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()
-
- battery_widget.device.on_notify = function(device)
- battery_widget:emit_signal('upower::update', device)
- end
-
- -- Check which device kind the user wants to display
- -- If there are multiple then the first is used
- if upower_glib.DeviceKind[battery_widget.device.kind] == battery_kind then
- set_battery(battery_widget.device)
- end
-
- -- The delayed call will fire every time awesome finishes its main event loop
- gears.timer.delayed_call(battery_widget.emit_signal, battery_widget, 'upower::update', battery_widget.device)
- end
-
- for _, device in ipairs(get_device_path()) do
- attach_to_device(device)
- end
-
- battery_widget:connect_signal(
- 'upower::update',
- function(_, device)
- if upower_glib.DeviceKind[battery_widget.device.kind] == battery_kind then
- set_battery(device)
- end
- end
- )
-
- return battery_widget
+ })
end
+return instance
diff --git a/awesome/src/widgets/bluetooth.lua b/awesome/src/widgets/bluetooth.lua
index cca5a4c..a8848a3 100644
--- a/awesome/src/widgets/bluetooth.lua
+++ b/awesome/src/widgets/bluetooth.lua
@@ -1,15 +1,16 @@
-----------------------------------
--- This is the bluetooth widget --
-----------------------------------
+local setmetatable = setmetatable
-- Awesome libs
-local awful = require('awful')
-local dpi = require('beautiful').xresources.apply_dpi
-local gears = require('gears')
+local apopup = require('awful.popup')
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
+local gcolor = require('gears.color')
+local gfilesystem = require('gears.filesystem')
+local gtimer = require('gears.timer')
local wibox = require('wibox')
-- Own libs
-local bt_module = require('src.modules.bluetooth.init')
+local bt_module = require('src.modules.bluetooth')
local hover = require('src.tools.hover')
local capi = {
@@ -18,78 +19,75 @@ local capi = {
}
-- Icon directory path
-local icondir = gears.filesystem.get_configuration_dir() .. 'src/assets/icons/bluetooth/'
+local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/bluetooth/'
-- Returns the bluetooth widget
-return function(s)
-
- -- Get the bluetooth module
- local bt_widget = bt_module { screen = s }
- -- Create the bluetooth widget
- local bluetooth_widget = wibox.widget {
- {
+return setmetatable({}, {
+ __call = function(_, s)
+ -- Get the bluetooth module
+ local bt_widget = bt_module { screen = s }
+ -- Create the bluetooth widget
+ local bluetooth_widget = wibox.widget {
{
{
- id = 'icon',
- 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',
+ image = gcolor.recolor_image(icondir .. 'bluetooth-off.svg', beautiful.colorscheme.bg),
+ widget = wibox.widget.imagebox,
+ valign = 'center',
+ halign = 'center',
+ resize = false,
+ },
+ id = 'icon_layout',
+ widget = wibox.container.place,
},
- id = 'icon_layout',
- widget = wibox.container.place,
+ id = 'icon_margin',
+ left = dpi(8),
+ right = dpi(8),
+ widget = wibox.container.margin,
},
- id = 'icon_margin',
- left = dpi(8),
- right = dpi(8),
- widget = wibox.container.margin,
- },
- bg = Theme_config.bluetooth.bg,
- fg = Theme_config.bluetooth.fg,
- shape = function(cr, width, height)
- gears.shape.rounded_rect(cr, width, height, dpi(6))
- end,
- widget = wibox.container.background,
- }
+ bg = beautiful.colorscheme.bg_blue,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[6],
+ widget = wibox.container.background,
+ }
- hover.bg_hover { widget = bluetooth_widget }
+ hover.bg_hover { widget = bluetooth_widget }
+
+ -- Create the awful.popup container for the module
+ local bluetooth_container = apopup {
+ widget = bt_widget,
+ ontop = true,
+ stretch = false,
+ visible = true,
+ screen = s,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
+ bg = beautiful.colorscheme.bg,
+ }
+
+ gtimer.delayed_call(function()
+ bluetooth_container.visible = false
+ end)
+
+ -- When the status changes update the icon
+ bt_widget:connect_signal('bluetooth::status', function(status)
+ bluetooth_widget:get_children_by_id('icon')[1].image = gcolor.recolor_image(status._private.Adapter1.Powered and
+ icondir .. 'bluetooth-on.svg' or icondir .. 'bluetooth-off.svg', beautiful.colorscheme.bg)
+ end)
+
+ -- On left click toggle the bluetooth container else toggle the bluetooth on/off
+ bluetooth_widget:connect_signal('button::press', function(_, _, _, key)
+ if key == 1 then
+ local geo = capi.mouse.current_wibox:geometry()
+ bluetooth_container.x = capi.mouse.coords().x - (bluetooth_container:geometry().width / 2)
+ bluetooth_container.y = dpi(70)
+ bluetooth_container.visible = not bluetooth_container.visible
+ else
+ capi.awesome.emit_signal('toggle_bluetooth')
+ end
+ end)
- -- If bt_widget is nil then there is no bluetooth adapter and there shouldn't be done
- -- anything besides returning the widget without any logic behind
- if not bt_widget then
return bluetooth_widget
- end
-
- -- Create the awful.popup container for the module
- local bluetooth_container = awful.popup {
- widget = bt_widget,
- ontop = true,
- stretch = false,
- visible = false,
- screen = s,
- 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,
- }
-
- -- When the status changes update the icon
- bt_widget:connect_signal('bluetooth::status', function(status)
- bluetooth_widget:get_children_by_id('icon')[1].image = gears.color.recolor_image(status._private.Adapter1.Powered and
- icondir .. 'bluetooth-on.svg' or icondir .. 'bluetooth-off.svg', Theme_config.bluetooth.fg)
- end)
-
- -- On left click toggle the bluetooth container else toggle the bluetooth on/off
- bluetooth_widget:connect_signal('button::press', function(_, _, _, key)
- if key == 1 then
- local geo = capi.mouse.current_wibox:geometry()
- bluetooth_container.x = geo.x
- bluetooth_container.y = geo.y + dpi(55)
- bluetooth_container.visible = not bluetooth_container.visible
- else
- capi.awesome.emit_signal('toggle_bluetooth')
- end
- end)
-
- return bluetooth_widget
-end
+ end,
+})
diff --git a/awesome/src/widgets/clock.lua b/awesome/src/widgets/clock.lua
index ba76987..ffad94d 100644
--- a/awesome/src/widgets/clock.lua
+++ b/awesome/src/widgets/clock.lua
@@ -1,9 +1,8 @@
-------------------------------
--- This is the clock widget --
-------------------------------
+local setmetatable = setmetatable
-- Awesome Libs
-local dpi = require('beautiful').xresources.apply_dpi
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
local wibox = require('wibox')
@@ -15,43 +14,47 @@ local hover = require('src.tools.hover')
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/clock/'
-- Returns the clock widget
-return setmetatable({}, { __call = function()
- local clock_widget = wibox.widget {
- {
+local instance = nil
+if not instance then
+ instance = setmetatable({}, { __call = function()
+ local clock_widget = wibox.widget {
{
{
{
- image = gcolor.recolor_image(icondir .. 'clock.svg', Theme_config.clock.fg),
- widget = wibox.widget.imagebox,
- valign = 'center',
- halign = 'center',
- resize = true,
+ {
+ image = gcolor.recolor_image(icondir .. 'clock.svg', beautiful.colorscheme.bg),
+ widget = wibox.widget.imagebox,
+ valign = 'center',
+ halign = 'center',
+ resize = true,
+ },
+ widget = wibox.container.constraint,
+ width = dpi(25),
+ height = dpi(25),
+ strategy = 'exact',
},
- widget = wibox.container.constraint,
- width = dpi(25),
- height = dpi(25),
- strategy = 'exact',
+ {
+ halign = 'center',
+ valign = 'center',
+ format = '%H:%M',
+ widget = wibox.widget.textclock,
+ },
+ spacing = dpi(10),
+ layout = wibox.layout.fixed.horizontal,
},
- {
- halign = 'center',
- valign = 'center',
- format = '%H:%M',
- widget = wibox.widget.textclock,
- },
- spacing = dpi(10),
- layout = wibox.layout.fixed.horizontal,
+ left = dpi(8),
+ right = dpi(8),
+ widget = wibox.container.margin,
},
- left = dpi(8),
- right = dpi(8),
- widget = wibox.container.margin,
- },
- bg = Theme_config.clock.bg,
- fg = Theme_config.clock.fg,
- shape = Theme_config.clock.shape,
- widget = wibox.container.background,
- }
+ bg = beautiful.colorscheme.bg_yellow,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[6],
+ widget = wibox.container.background,
+ }
- hover.bg_hover { widget = clock_widget }
+ hover.bg_hover { widget = clock_widget }
- return clock_widget
-end, })
+ return clock_widget
+ end, })
+end
+return instance
diff --git a/awesome/src/widgets/cpu_info.lua b/awesome/src/widgets/cpu_info.lua
index 3111610..4bd9c8b 100644
--- a/awesome/src/widgets/cpu_info.lua
+++ b/awesome/src/widgets/cpu_info.lua
@@ -1,236 +1,211 @@
----------------------------------
--- This is the CPU Info widget --
----------------------------------
+local mfloor = math.floor
+local setmetatable = setmetatable
-- Awesome Libs
local base = require('wibox.widget.base')
-local dpi = require('beautiful').xresources.apply_dpi
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
-local gtable = require('gears.table')
local wibox = require('wibox')
-- Third Party Libs
local color = require('src.lib.color')
-local rubato = require('src.lib.rubato')
local hover = require('src.tools.hover')
+local rubato = require('src.lib.rubato')
local icon_dir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/cpu/'
-local cpu_info = {}
+local instance = nil
+if not instance then
+ instance = setmetatable({}, { __call = function(_, widget)
+ if widget == 'temp' then
+ local cpu_temp_helper = require('src.tools.helpers.cpu_temp')
-local function cpu_temp_new()
- local cpu_temp_helper = require('src.tools.helpers.cpu_temp')
-
- local w = base.make_widget_from_value(wibox.widget {
- {
- {
+ local w = base.make_widget_from_value(wibox.widget {
{
{
{
- id = 'icon_role',
- widget = wibox.widget.imagebox,
- valign = 'center',
- halign = 'center',
- image = gcolor.recolor_image(icon_dir .. 'thermometer.svg', Theme_config.cpu_temp.fg),
- resize = true,
+ {
+ {
+ id = 'icon_role',
+ widget = wibox.widget.imagebox,
+ valign = 'center',
+ halign = 'center',
+ image = gcolor.recolor_image(icon_dir .. 'thermometer.svg', beautiful.colorscheme.bg),
+ resize = true,
+ },
+ widget = wibox.container.constraint,
+ width = dpi(25),
+ height = dpi(25),
+ strategy = 'exact',
+ },
+ {
+ id = 'text_role',
+ halign = 'center',
+ valign = 'center',
+ widget = wibox.widget.textbox,
+ },
+ spacing = dpi(5),
+ layout = wibox.layout.fixed.horizontal,
},
- widget = wibox.container.constraint,
- width = dpi(25),
- height = dpi(25),
- strategy = 'exact',
+ widget = wibox.container.place,
},
- {
- id = 'text_role',
- halign = 'center',
- valign = 'center',
- widget = wibox.widget.textbox,
- },
- spacing = dpi(5),
- layout = wibox.layout.fixed.horizontal,
+ left = dpi(5),
+ right = dpi(5),
+ widget = wibox.container.margin,
},
- widget = wibox.container.place,
- },
- left = dpi(5),
- right = dpi(5),
- widget = wibox.container.margin,
- },
- bg = Theme_config.cpu_temp.bg,
- fg = Theme_config.cpu_temp.fg,
- shape = Theme_config.cpu_temp.shape,
- widget = wibox.container.background,
- })
+ bg = beautiful.colorscheme.bg_green,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[6],
+ widget = wibox.container.background,
+ })
- assert(w, 'Failed to create widget')
+ local r = rubato.timed { duration = 2.5 }
+ local g = rubato.timed { duration = 2.5 }
+ local b = rubato.timed { duration = 2.5 }
- gtable.crush(w, cpu_info, true)
+ r.pos, g.pos, b.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_green)
- local r = rubato.timed { duration = 2.5 }
- local g = rubato.timed { duration = 2.5 }
- local b = rubato.timed { duration = 2.5 }
+ -- Subscribable function to have rubato set the bg/fg color
+ local function update_bg()
+ w:set_bg('#' .. color.utils.rgba_to_hex { r.pos, g.pos, b.pos })
+ end
- r.pos, g.pos, b.pos = color.utils.hex_to_rgba(Theme_config.cpu_temp.bg_low)
+ r:subscribe(update_bg)
+ g:subscribe(update_bg)
+ b:subscribe(update_bg)
- -- Subscribable function to have rubato set the bg/fg color
- local function update_bg()
- w:set_bg('#' .. color.utils.rgba_to_hex { r.pos, g.pos, b.pos })
- end
+ -- Both functions to set a color, if called they take a new color
+ local function set_bg(newbg)
+ r.target, g.target, b.target = color.utils.hex_to_rgba(newbg)
+ end
- r:subscribe(update_bg)
- g:subscribe(update_bg)
- b:subscribe(update_bg)
+ cpu_temp_helper:connect_signal('update::cpu_temp', function(_, temp)
+ local temp_icon
+ local temp_color
- -- Both functions to set a color, if called they take a new color
- local function set_bg(newbg)
- r.target, g.target, b.target = color.utils.hex_to_rgba(newbg)
- end
+ if temp < 50 then
+ temp_color = beautiful.colorscheme.bg_green
+ temp_icon = icon_dir .. 'thermometer-low.svg'
+ elseif temp >= 50 and temp < 80 then
+ temp_color = beautiful.colorscheme.bg_yellow
+ temp_icon = icon_dir .. 'thermometer.svg'
+ elseif temp >= 80 then
+ temp_color = beautiful.colorscheme.bg_red
+ temp_icon = icon_dir .. 'thermometer-high.svg'
+ end
+ w:get_children_by_id('icon_role')[1].image = temp_icon
+ set_bg(temp_color)
+ w:get_children_by_id('text_role')[1].text = mfloor(temp) .. '°C'
+ end)
- cpu_temp_helper:connect_signal('update::cpu_temp', function(_, temp)
- local temp_icon
- local temp_color
+ return w
+ elseif widget == 'usage' then
+ local cpu_usage_helper = require('src.tools.helpers.cpu_usage')
- if temp < 50 then
- temp_color = Theme_config.cpu_temp.bg_low
- temp_icon = icon_dir .. 'thermometer-low.svg'
- elseif temp >= 50 and temp < 80 then
- temp_color = Theme_config.cpu_temp.bg_mid
- temp_icon = icon_dir .. 'thermometer.svg'
- elseif temp >= 80 then
- temp_color = Theme_config.cpu_temp.bg_high
- temp_icon = icon_dir .. 'thermometer-high.svg'
+ local w = base.make_widget_from_value(wibox.widget {
+ {
+ {
+ {
+ {
+ {
+ id = 'icon_role',
+ widget = wibox.widget.imagebox,
+ valign = 'center',
+ halign = 'center',
+ image = gcolor.recolor_image(icon_dir .. 'cpu.svg', beautiful.colorscheme.bg),
+ resize = true,
+ },
+ widget = wibox.container.constraint,
+ width = dpi(25),
+ height = dpi(25),
+ strategy = 'exact',
+ },
+ {
+ id = 'text_role',
+ text = '0%',
+ halign = 'center',
+ valign = 'center',
+ widget = wibox.widget.textbox,
+ },
+ spacing = dpi(5),
+ layout = wibox.layout.fixed.horizontal,
+ },
+ widget = wibox.container.place,
+ },
+ left = dpi(5),
+ right = dpi(5),
+ widget = wibox.container.margin,
+ },
+ bg = beautiful.colorscheme.bg_blue,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[6],
+ widget = wibox.container.background,
+ })
+
+ hover.bg_hover { widget = w }
+
+ cpu_usage_helper:connect_signal('update::cpu_usage', function(_, usage)
+ w:get_children_by_id('text_role')[1].text = usage .. '%'
+ end)
+
+ return w
+ elseif widget == 'freq' then
+ local cpu_freq_helper = require('src.tools.helpers.cpu_freq')
+
+ local w = base.make_widget_from_value(wibox.widget {
+ {
+ {
+ {
+ {
+ {
+ id = 'icon_role',
+ widget = wibox.widget.imagebox,
+ valign = 'center',
+ halign = 'center',
+ image = gcolor.recolor_image(icon_dir .. 'cpu.svg', beautiful.colorscheme.bg),
+ resize = true,
+ },
+ widget = wibox.container.constraint,
+ width = dpi(25),
+ height = dpi(25),
+ strategy = 'exact',
+ },
+ {
+ id = 'text_role',
+ text = '0Mhz',
+ halign = 'center',
+ valign = 'center',
+ widget = wibox.widget.textbox,
+ },
+ spacing = dpi(5),
+ layout = wibox.layout.fixed.horizontal,
+ },
+ widget = wibox.container.place,
+ },
+ left = dpi(5),
+ right = dpi(5),
+ widget = wibox.container.margin,
+ },
+ bg = beautiful.colorscheme.bg_blue,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[6],
+ widget = wibox.container.background,
+ })
+
+ hover.bg_hover { widget = w }
+
+ cpu_freq_helper:connect_signal('update::cpu_freq_average', function(_, average)
+ w:get_children_by_id('text_role')[1].text = average .. 'Mhz'
+ end)
+
+ cpu_freq_helper:connect_signal('update::cpu_freq_core', function(_, freq)
+ w:get_children_by_id('text_role')[1].text = freq .. 'Mhz'
+ end)
+
+ return w
end
- w:get_children_by_id('icon_role')[1].image = temp_icon
- set_bg(temp_color)
- w:get_children_by_id('text_role')[1].text = math.floor(temp) .. '°C'
- end)
-
- return w
+ end, })
end
-
-local function cpu_usage_new()
- local cpu_usage_helper = require('src.tools.helpers.cpu_usage')
-
- local w = base.make_widget_from_value(wibox.widget {
- {
- {
- {
- {
- {
- id = 'icon_role',
- widget = wibox.widget.imagebox,
- valign = 'center',
- halign = 'center',
- image = gcolor.recolor_image(icon_dir .. 'cpu.svg', Theme_config.cpu_usage.fg),
- resize = true,
- },
- widget = wibox.container.constraint,
- width = dpi(25),
- height = dpi(25),
- strategy = 'exact',
- },
- {
- id = 'text_role',
- text = '0%',
- halign = 'center',
- valign = 'center',
- widget = wibox.widget.textbox,
- },
- spacing = dpi(5),
- layout = wibox.layout.fixed.horizontal,
- },
- widget = wibox.container.place,
- },
- left = dpi(5),
- right = dpi(5),
- widget = wibox.container.margin,
- },
- bg = Theme_config.cpu_usage.bg,
- fg = Theme_config.cpu_usage.fg,
- shape = Theme_config.cpu_usage.shape,
- widget = wibox.container.background,
- })
-
- assert(w, 'failed to create widget')
-
- hover.bg_hover { widget = w }
-
- gtable.crush(w, cpu_info, true)
-
- cpu_usage_helper:connect_signal('update::cpu_usage', function(_, usage)
- w:get_children_by_id('text_role')[1].text = usage .. '%'
- end)
-
- return w
-end
-
-local function cpu_freq_new()
- local cpu_freq_helper = require('src.tools.helpers.cpu_freq')
-
- local w = base.make_widget_from_value(wibox.widget {
- {
- {
- {
- {
- {
- id = 'icon_role',
- widget = wibox.widget.imagebox,
- valign = 'center',
- halign = 'center',
- image = gcolor.recolor_image(icon_dir .. 'cpu.svg', Theme_config.cpu_freq.fg),
- resize = true,
- },
- widget = wibox.container.constraint,
- width = dpi(25),
- height = dpi(25),
- strategy = 'exact',
- },
- {
- id = 'text_role',
- text = '0Mhz',
- halign = 'center',
- valign = 'center',
- widget = wibox.widget.textbox,
- },
- spacing = dpi(5),
- layout = wibox.layout.fixed.horizontal,
- },
- widget = wibox.container.place,
- },
- left = dpi(5),
- right = dpi(5),
- widget = wibox.container.margin,
- },
- bg = Theme_config.cpu_freq.bg,
- fg = Theme_config.cpu_freq.fg,
- shape = Theme_config.cpu_freq.shape,
- widget = wibox.container.background,
- })
-
- assert(w, 'failed to create widget')
-
- hover.bg_hover { widget = w }
-
- gtable.crush(w, cpu_info, true)
-
- cpu_freq_helper:connect_signal('update::cpu_freq_average', function(_, average)
- w:get_children_by_id('text_role')[1].text = average .. 'Mhz'
- end)
-
- cpu_freq_helper:connect_signal('update::cpu_freq_core', function(_, freq)
- w:get_children_by_id('text_role')[1].text = freq .. 'Mhz'
- end)
-
- return w
-end
-
-return setmetatable(cpu_info, { __call = function(_, widget)
- if widget == 'temp' then
- return cpu_temp_new()
- elseif widget == 'usage' then
- return cpu_usage_new()
- elseif widget == 'freq' then
- return cpu_freq_new()
- else
- return nil
- end
-end, })
+return instance
diff --git a/awesome/src/widgets/date.lua b/awesome/src/widgets/date.lua
index cac37f1..9c4c2fe 100644
--- a/awesome/src/widgets/date.lua
+++ b/awesome/src/widgets/date.lua
@@ -1,15 +1,15 @@
------------------------------
--- This is the date widget --
------------------------------
+local setmetatable = setmetatable
-- Awesome Libs
-local apopup = require('awful.popup')
-local dpi = require('beautiful').xresources.apply_dpi
-local wibox = require('wibox')
local abutton = require('awful.button')
+local apopup = require('awful.popup')
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
+local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table')
-local gcolor = require('gears.color')
+local gtimer = require('gears.timer')
+local wibox = require('wibox')
-- Local libs
local cal = require('src.modules.calendar.init') {}
@@ -27,7 +27,7 @@ return setmetatable({}, { __call = function(_, screen)
{
{
{
- image = gcolor.recolor_image(icondir .. 'calendar.svg', Theme_config.date.fg),
+ image = gcolor.recolor_image(icondir .. 'calendar.svg', beautiful.colorscheme.bg),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
@@ -51,9 +51,9 @@ return setmetatable({}, { __call = function(_, screen)
right = dpi(8),
widget = wibox.container.margin,
},
- bg = Theme_config.date.bg,
- fg = Theme_config.date.fg,
- shape = Theme_config.date.shape,
+ bg = beautiful.colorscheme.bg_teal,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[6],
widget = wibox.container.background,
}
@@ -61,15 +61,20 @@ return setmetatable({}, { __call = function(_, screen)
widget = cal:get_widget(),
screen = screen,
ontop = true,
- visible = false,
+ visible = true,
}
+ -- Delayed call so the popup can eval its dimensions
+ gtimer.delayed_call(function()
+ calendar_popup.visible = false
+ end)
+
hover.bg_hover { widget = date_widget }
date_widget:buttons { gtable.join(
abutton({}, 1, function()
local geo = capi.mouse.coords()
- calendar_popup.y = dpi(65)
+ calendar_popup.y = dpi(70)
if geo.x + (calendar_popup.width / 2) > capi.mouse.screen.geometry.width then
calendar_popup.x = capi.mouse.screen.geometry.x + capi.mouse.screen.geometry.width - calendar_popup.width
else
diff --git a/awesome/src/widgets/gpu_info.lua b/awesome/src/widgets/gpu_info.lua
index 45ded53..4f4c0d5 100644
--- a/awesome/src/widgets/gpu_info.lua
+++ b/awesome/src/widgets/gpu_info.lua
@@ -1,175 +1,169 @@
----------------------------------
--- This is the gpu Info widget --
----------------------------------
+local mmax = math.max
+local setmetatable = setmetatable
+local tonumber = tonumber
+local tostring = tostring
-- Awesome Libs
local base = require('wibox.widget.base')
-local dpi = require('beautiful').xresources.apply_dpi
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
local wibox = require('wibox')
-- Third Party Libs
local color = require('src.lib.color')
-local rubato = require('src.lib.rubato')
local hover = require('src.tools.hover')
+local rubato = require('src.lib.rubato')
local icon_dir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/cpu/'
local gpu_info = {}
-local function gpu_temp_new()
- local gpu_temp_helper = require('src.tools.helpers.gpu_temp')
+local instance = nil
+if not instance then
+ instance = setmetatable(gpu_info, { __call = function(_, widget)
+ if widget == 'temp' then
+ local gpu_temp_helper = require('src.tools.helpers.gpu_temp')
- local w = base.make_widget_from_value(wibox.widget {
- {
- {
+ local w = base.make_widget_from_value(wibox.widget {
{
{
{
- id = 'icon_role',
- widget = wibox.widget.imagebox,
- valign = 'center',
- halign = 'center',
- image = gcolor.recolor_image(icon_dir .. 'gpu.svg', Theme_config.gpu_temp.fg),
- resize = true,
+ {
+ {
+ id = 'icon_role',
+ widget = wibox.widget.imagebox,
+ valign = 'center',
+ halign = 'center',
+ image = gcolor.recolor_image(icon_dir .. 'gpu.svg', beautiful.colorscheme.bg),
+ resize = true,
+ },
+ widget = wibox.container.constraint,
+ width = dpi(25),
+ height = dpi(25),
+ strategy = 'exact',
+ },
+ {
+ id = 'text_role',
+ text = '0°C',
+ halign = 'center',
+ valign = 'center',
+ widget = wibox.widget.textbox,
+ },
+ spacing = dpi(5),
+ layout = wibox.layout.fixed.horizontal,
},
- widget = wibox.container.constraint,
- width = dpi(25),
- height = dpi(25),
- strategy = 'exact',
+ widget = wibox.container.place,
},
- {
- id = 'text_role',
- text = '0°C',
- halign = 'center',
- valign = 'center',
- widget = wibox.widget.textbox,
- },
- spacing = dpi(5),
- layout = wibox.layout.fixed.horizontal,
+ left = dpi(5),
+ right = dpi(5),
+ widget = wibox.container.margin,
},
- widget = wibox.container.place,
- },
- left = dpi(5),
- right = dpi(5),
- widget = wibox.container.margin,
- },
- bg = Theme_config.gpu_temp.bg,
- fg = Theme_config.gpu_temp.fg,
- shape = Theme_config.gpu_temp.shape,
- widget = wibox.container.background,
- })
+ bg = beautiful.colorscheme.bg_green,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[6],
+ widget = wibox.container.background,
+ })
- assert(w, 'Widget not created')
+ local r = rubato.timed { duration = 2.5 }
+ local g = rubato.timed { duration = 2.5 }
+ local b = rubato.timed { duration = 2.5 }
- local r = rubato.timed { duration = 2.5 }
- local g = rubato.timed { duration = 2.5 }
- local b = rubato.timed { duration = 2.5 }
+ r.pos, g.pos, b.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_green)
- r.pos, g.pos, b.pos = color.utils.hex_to_rgba(Theme_config.cpu_temp.bg_low)
-
- -- Subscribable function to have rubato set the bg/fg color
- local function update_bg()
- w:set_bg('#' .. color.utils.rgba_to_hex { math.max(0, r.pos), math.max(0, g.pos),
- math.max(0, b.pos), })
- end
-
- r:subscribe(update_bg)
- g:subscribe(update_bg)
- b:subscribe(update_bg)
-
- -- Both functions to set a color, if called they take a new color
- local function set_bg(newbg)
- r.target, g.target, b.target = color.utils.hex_to_rgba(newbg)
- end
-
- -- GPU Temperature
- gpu_temp_helper:connect_signal('update::gpu_temp', function(_, stdout)
- local temp_icon
- local temp_color
- local temp_num = tonumber(stdout) or 0
- if temp_num then
- if temp_num < 50 then
- temp_color = Theme_config.gpu_temp.bg_low
- temp_icon = icon_dir .. 'thermometer-low.svg'
- elseif temp_num >= 50 and temp_num < 80 then
- temp_color = Theme_config.gpu_temp.bg_mid
- temp_icon = icon_dir .. 'thermometer.svg'
- elseif temp_num >= 80 then
- temp_color = Theme_config.gpu_temp.bg_high
- temp_icon = icon_dir .. 'thermometer-high.svg'
+ -- Subscribable function to have rubato set the bg/fg color
+ local function update_bg()
+ w:set_bg('#' .. color.utils.rgba_to_hex { mmax(0, r.pos), mmax(0, g.pos),
+ mmax(0, b.pos), })
end
- else
- temp_color = Theme_config.gpu_temp.bg_low
- temp_icon = icon_dir .. 'thermometer-low.svg'
- end
- w:get_children_by_id('icon_role')[1]:set_image(temp_icon)
- set_bg(temp_color)
- w:get_children_by_id('text_role')[1].text = tostring(temp_num) .. '°C'
- end)
- return w
-end
+ r:subscribe(update_bg)
+ g:subscribe(update_bg)
+ b:subscribe(update_bg)
-local function gpu_usage_new()
- local gpu_usage_helper = require('src.tools.helpers.gpu_usage')
+ -- Both functions to set a color, if called they take a new color
+ local function set_bg(newbg)
+ r.target, g.target, b.target = color.utils.hex_to_rgba(newbg)
+ end
- local w = base.make_widget_from_value(wibox.widget {
- {
- {
+ -- GPU Temperature
+ gpu_temp_helper:connect_signal('update::gpu_temp', function(_, stdout)
+ local temp_icon
+ local temp_color
+ local temp_num = tonumber(stdout) or 0
+ if temp_num then
+ if temp_num < 50 then
+ temp_color = beautiful.colorscheme.bg_green
+ temp_icon = icon_dir .. 'thermometer-low.svg'
+ elseif temp_num >= 50 and temp_num < 80 then
+ temp_color = beautiful.colorscheme.bg_yellow
+ temp_icon = icon_dir .. 'thermometer.svg'
+ elseif temp_num >= 80 then
+ temp_color = beautiful.colorscheme.bg_red
+ temp_icon = icon_dir .. 'thermometer-high.svg'
+ end
+ else
+ temp_color = beautiful.colorscheme.bg_green
+ temp_icon = icon_dir .. 'thermometer-low.svg'
+ end
+ w:get_children_by_id('icon_role')[1]:set_image(temp_icon)
+ set_bg(temp_color)
+ w:get_children_by_id('text_role')[1].text = tostring(temp_num) .. '°C'
+ end)
+
+ return w
+ elseif widget == 'usage' then
+ local gpu_usage_helper = require('src.tools.helpers.gpu_usage')
+
+ local w = base.make_widget_from_value(wibox.widget {
{
{
{
- id = 'icon_role',
- widget = wibox.widget.imagebox,
- valign = 'center',
- halign = 'center',
- image = gcolor.recolor_image(icon_dir .. 'gpu.svg', Theme_config.gpu_usage.fg),
- resize = true,
+ {
+ {
+ id = 'icon_role',
+ widget = wibox.widget.imagebox,
+ valign = 'center',
+ halign = 'center',
+ image = gcolor.recolor_image(icon_dir .. 'gpu.svg', beautiful.colorscheme.bg),
+ resize = true,
+ },
+ widget = wibox.container.constraint,
+ width = dpi(25),
+ height = dpi(25),
+ strategy = 'exact',
+ },
+ {
+ id = 'text_role',
+ text = '0%',
+ halign = 'center',
+ valign = 'center',
+ widget = wibox.widget.textbox,
+ },
+ spacing = dpi(5),
+ layout = wibox.layout.fixed.horizontal,
},
- widget = wibox.container.constraint,
- width = dpi(25),
- height = dpi(25),
- strategy = 'exact',
+ widget = wibox.container.place,
},
- {
- id = 'text_role',
- text = '0%',
- halign = 'center',
- valign = 'center',
- widget = wibox.widget.textbox,
- },
- spacing = dpi(5),
- layout = wibox.layout.fixed.horizontal,
+ left = dpi(5),
+ right = dpi(5),
+ widget = wibox.container.margin,
},
- widget = wibox.container.place,
- },
- left = dpi(5),
- right = dpi(5),
- widget = wibox.container.margin,
- },
- bg = Theme_config.gpu_usage.bg,
- fg = Theme_config.gpu_usage.fg,
- shape = Theme_config.gpu_usage.shape,
- widget = wibox.container.background,
- })
+ bg = beautiful.colorscheme.bg_green,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[6],
+ widget = wibox.container.background,
+ })
- assert(w, 'Widget not created')
+ hover.bg_hover { widget = w }
- hover.bg_hover { widget = w }
+ gpu_usage_helper:connect_signal('update::gpu_usage', function(_, stdout)
+ w:get_children_by_id('text_role')[1].text = stdout:gsub('\n', '') .. '%'
+ end)
- gpu_usage_helper:connect_signal('update::gpu_usage', function(_, stdout)
- w:get_children_by_id('text_role')[1].text = stdout:gsub('\n', '') .. '%'
- end)
-
- return w
+ return w
+ end
+ end, })
end
-
-return setmetatable(gpu_info, { __call = function(_, widget)
- if widget == 'usage' then
- return gpu_usage_new()
- elseif widget == 'temp' then
- return gpu_temp_new()
- end
-end, })
+return instance
diff --git a/awesome/src/widgets/kblayout.lua b/awesome/src/widgets/kblayout.lua
index c39db25..b9f2652 100644
--- a/awesome/src/widgets/kblayout.lua
+++ b/awesome/src/widgets/kblayout.lua
@@ -1,19 +1,21 @@
-------------------------------
--- This is the audio widget --
-------------------------------
+local pairs = pairs
+local setmetatable = setmetatable
+local tunpack = table.unpack
-- Awesome Libs
-local dpi = require('beautiful').xresources.apply_dpi
-local wibox = require('wibox')
+local abutton = require('awful.button')
+local apopup = require('awful.popup')
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table')
-local abutton = require('awful.button')
-local apopup = require('awful.popup')
+local gtimer = require('gears.timer')
+local wibox = require('wibox')
-- Local libs
-local kb_helper = require('src.tools.helpers.kb_helper')
local hover = require('src.tools.hover')
+local kb_helper = require('src.tools.helpers.kb_helper')
local capi = {
mouse = mouse,
@@ -36,11 +38,11 @@ local function create_kb_layout_list()
margins = dpi(10),
},
widget = wibox.container.background,
- bg = Theme_config.kblayout.bg_container,
+ bg = beautiful.colorscheme.bg,
}
local list = widget:get_children_by_id('list')[1]
- for _, keymap in pairs(User_config.kblayout) do
+ for _, keymap in pairs(beautiful.user_config.kblayout) do
-- TODO: Add more, too lazy rn
local xkeyboard_country_code = {
['af'] = { 'أفغانيش(Afghanistan)', 'AFG' }, -- Afghanistan
@@ -136,23 +138,23 @@ local function create_kb_layout_list()
['za'] = { '', 'ZAF' }, -- South Africa
}
- local longname, shortname = table.unpack(xkeyboard_country_code[keymap])
+ local longname, shortname = tunpack(xkeyboard_country_code[keymap])
local kb_layout_item = wibox.widget {
{
{
{
id = 'shortname',
- markup = '' .. shortname .. '',
+ markup = '' .. shortname .. '',
widget = wibox.widget.textbox,
valign = 'center',
halign = 'center',
},
{
id = 'longname',
- markup = '' .. longname .. '',
+ markup = '' .. longname .. '',
widget = wibox.widget.textbox,
- font = User_config.font.bold,
+ font = beautiful.user_config.font.bold,
},
spacing = dpi(15),
layout = wibox.layout.fixed.horizontal,
@@ -161,38 +163,38 @@ local function create_kb_layout_list()
widget = wibox.container.margin,
},
id = 'hover',
- shape = Theme_config.kblayout.item.shape,
- border_width = Theme_config.kblayout.item.border_width,
- border_color = Theme_config.kblayout.item.border_color,
- bg = Theme_config.kblayout.item.bg,
+ shape = beautiful.shape[6],
+ border_width = dpi(2),
+ border_color = beautiful.colorscheme.border_color,
+ bg = beautiful.colorscheme.bg,
widget = wibox.container.background,
}
kb_helper:connect_signal('KB::layout_changed', function(_, k)
if keymap == k then
- kb_layout_item.bg = Theme_config.kblayout.item.bg_selected
- kb_layout_item.border_color = Theme_config.kblayout.item.bg_selected
- kb_layout_item:get_children_by_id('shortname')[1].markup = '' .. shortname .. ''
- kb_layout_item:get_children_by_id('longname')[1].markup = '' .. longname .. ''
+ kb_layout_item.bg = beautiful.colorscheme.bg_purple
+ kb_layout_item.border_color = beautiful.colorscheme.bg_purple
+ kb_layout_item:get_children_by_id('shortname')[1].markup = '' .. shortname .. ''
+ kb_layout_item:get_children_by_id('longname')[1].markup = '' .. longname .. ''
else
- kb_layout_item.bg = Theme_config.kblayout.item.bg
- kb_layout_item.border_color = Theme_config.kblayout.item.border_color
- kb_layout_item:get_children_by_id('shortname')[1].markup = '' .. shortname .. ''
- kb_layout_item:get_children_by_id('longname')[1].markup = '' .. longname .. ''
+ kb_layout_item.bg = beautiful.colorscheme.bg
+ kb_layout_item.border_color = beautiful.colorscheme.border_color
+ kb_layout_item:get_children_by_id('shortname')[1].markup = '' .. shortname .. ''
+ kb_layout_item:get_children_by_id('longname')[1].markup = '' .. longname .. ''
end
end)
kb_helper:get_layout_async(function(k)
if keymap == k then
- kb_layout_item.bg = Theme_config.kblayout.item.bg_selected
- kb_layout_item.border_color = Theme_config.kblayout.item.bg_selected
- kb_layout_item:get_children_by_id('shortname')[1].markup = '' .. shortname .. ''
- kb_layout_item:get_children_by_id('longname')[1].markup = '' .. longname .. ''
+ kb_layout_item.bg = beautiful.colorscheme.bg_purple
+ kb_layout_item.border_color = beautiful.colorscheme.bg_purple
+ kb_layout_item:get_children_by_id('shortname')[1].markup = '' .. shortname .. ''
+ kb_layout_item:get_children_by_id('longname')[1].markup = '' .. longname .. ''
else
- kb_layout_item.bg = Theme_config.kblayout.item.bg
- kb_layout_item.border_color = Theme_config.kblayout.item.border_color
- kb_layout_item:get_children_by_id('shortname')[1].markup = '' .. shortname .. ''
- kb_layout_item:get_children_by_id('longname')[1].markup = '' .. longname .. ''
+ kb_layout_item.bg = beautiful.colorscheme.bg
+ kb_layout_item.border_color = beautiful.colorscheme.border_color
+ kb_layout_item:get_children_by_id('shortname')[1].markup = '' .. shortname .. ''
+ kb_layout_item:get_children_by_id('longname')[1].markup = '' .. longname .. ''
end
end)
@@ -201,7 +203,6 @@ local function create_kb_layout_list()
kb_layout_item:buttons { gtable.join(
abutton({}, 1, function()
kb_helper:set_layout(keymap)
- --kb_layout_popup.visible = not kb_layout_popup.visible
end)
), }
@@ -221,7 +222,7 @@ return setmetatable({}, { __call = function(_, screen)
resize = true,
valign = 'center',
halign = 'center',
- image = gcolor.recolor_image(icondir .. 'keyboard.svg', Theme_config.kblayout.fg),
+ image = gcolor.recolor_image(icondir .. 'keyboard.svg', beautiful.colorscheme.bg),
},
widget = wibox.container.constraint,
width = dpi(24),
@@ -241,9 +242,9 @@ return setmetatable({}, { __call = function(_, screen)
right = dpi(8),
widget = wibox.container.margin,
},
- bg = Theme_config.kblayout.bg,
- fg = Theme_config.kblayout.fg,
- shape = Theme_config.kblayout.shape,
+ bg = beautiful.colorscheme.bg_green,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[6],
widget = wibox.container.background,
}
@@ -259,18 +260,24 @@ return setmetatable({}, { __call = function(_, screen)
kb_layout_popup = apopup {
widget = create_kb_layout_list(),
- border_color = Theme_config.kblayout.border_color,
- border_width = Theme_config.kblayout.border_width,
+ border_color = beautiful.colorscheme.border_color,
+ border_width = dpi(2),
screen = screen,
ontop = true,
- visible = false,
- bg = Theme_config.kblayout.bg_container,
+ visible = true,
+ bg = beautiful.colorscheme.bg,
}
+ -- Delayed call to make the popup invisible,
+ -- needed to give it time to evaluate its dimensions
+ gtimer.delayed_call(function()
+ kb_layout_popup.visible = false
+ end)
+
kblayout_widget:buttons { gtable.join(
abutton({}, 1, function()
local geo = capi.mouse.coords()
- kb_layout_popup.y = dpi(65)
+ kb_layout_popup.y = dpi(70)
kb_layout_popup.x = geo.x - kb_layout_popup.width / 2
kb_layout_popup.visible = not kb_layout_popup.visible
end)
diff --git a/awesome/src/widgets/layout_list.lua b/awesome/src/widgets/layout_list.lua
index 9b7183c..589a118 100644
--- a/awesome/src/widgets/layout_list.lua
+++ b/awesome/src/widgets/layout_list.lua
@@ -1,77 +1,56 @@
-----------------------------------
--- This is the layoutbox widget --
-----------------------------------
+local setmetatable = setmetatable
-- Awesome Libs
local abutton = require('awful.button')
local alayout = require('awful.layout')
local awidget = require('awful.widget')
-local dpi = require('beautiful').xresources.apply_dpi
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
local gtable = require('gears.table')
local wibox = require('wibox')
-- Local libs
local hover = require('src.tools.hover')
---#region Layout icons
-local layout_path = Theme_path .. '../assets/layout/'
-
-Theme.layout_cornerne = layout_path .. 'cornerne.png'
-Theme.layout_cornernw = layout_path .. 'cornernw.png'
-Theme.layout_cornerse = layout_path .. 'cornerse.png'
-Theme.layout_cornersw = layout_path .. 'cornersw.png'
-Theme.layout_dwindle = layout_path .. 'dwindle.png'
-Theme.layout_fairh = layout_path .. 'fairh.png'
-Theme.layout_fairv = layout_path .. 'fairv.png'
-Theme.layout_floating = layout_path .. 'floating.png'
-Theme.layout_fullscreen = layout_path .. 'fullscreen.png'
-Theme.layout_magnifier = layout_path .. 'magnifier.png'
-Theme.layout_max = layout_path .. 'max.png'
-Theme.layout_spiral = layout_path .. 'spiral.png'
-Theme.layout_tile = layout_path .. 'tile.png'
-Theme.layout_tilebottom = layout_path .. 'tilebottom.png'
-Theme.layout_tileleft = layout_path .. 'tileleft.png'
-Theme.layout_tiletop = layout_path .. 'tiletop.png'
---#endregion
-
--- Returns the layoutbox widget
-return function()
- local layout = wibox.widget {
- {
+return setmetatable({}, {
+ __call = function(_, screen)
+ local layout = wibox.widget {
{
{
- awidget.layoutbox(),
- widget = wibox.container.place,
+ {
+ awidget.layoutbox(),
+ widget = wibox.container.place,
+ },
+ left = dpi(5),
+ right = dpi(5),
+ widget = wibox.container.margin,
},
- left = dpi(5),
- right = dpi(5),
- widget = wibox.container.margin,
+ widget = wibox.container.constraint,
+ strategy = 'exact',
+ width = dpi(40),
},
- widget = wibox.container.constraint,
- strategy = 'exact',
- width = dpi(40),
- },
- bg = Theme_config.layout_list.bg,
- shape = Theme_config.layout_list.shape,
- widget = wibox.container.background,
- }
+ bg = beautiful.colorscheme.bg_blue,
+ shape = beautiful.shape[6],
+ widget = wibox.container.background,
+ }
- hover.bg_hover { widget = layout }
+ hover.bg_hover { widget = layout }
- layout:buttons(gtable.join(
- abutton({}, 1, function()
- alayout.inc(1)
- end),
- abutton({}, 3, function()
- alayout.inc(-1)
- end),
- abutton({}, 4, function()
- alayout.inc(1)
- end),
- abutton({}, 5, function()
- alayout.inc(-1)
- end)
- ))
+ layout:buttons(gtable.join(
+ abutton({}, 1, function()
+ alayout.inc(1, screen)
+ end),
+ abutton({}, 3, function()
+ alayout.inc(-1, screen)
+ end),
+ abutton({}, 4, function()
+ alayout.inc(1, screen)
+ end),
+ abutton({}, 5, function()
+ alayout.inc(-1, screen)
+ end)
+ ))
- return layout
-end
+ return layout
+ end,
+})
diff --git a/awesome/src/widgets/network.lua b/awesome/src/widgets/network.lua
index 0416836..a0f1262 100644
--- a/awesome/src/widgets/network.lua
+++ b/awesome/src/widgets/network.lua
@@ -1,119 +1,114 @@
---------------------------------
--- This is the network widget --
---------------------------------
+local setmetatable = setmetatable
+local mfloor = math.floor
-- Awesome Libs
local abutton = require('awful.button')
local apopup = require('awful.popup')
local atooltip = require('awful.tooltip')
local base = require('wibox.widget.base')
-local dpi = require('beautiful').xresources.apply_dpi
-local gears = require('gears')
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
+local gcolor = require('gears.color')
+local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table')
+local gtimer = require('gears.timer')
local wibox = require('wibox')
+-- Local Libs
+local hover = require('src.tools.hover')
+local nm_widget = require('src.modules.network_controller')
+
local capi = {
awesome = awesome,
mouse = mouse,
}
-- Icon directory path
-local icondir = gears.filesystem.get_configuration_dir() .. 'src/assets/icons/network/'
+local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/network/'
-local nm_widget = require('src.modules.network_controller.init')
-local hover = require('src.tools.hover')
-
-local network = { mt = {} }
-
-function network.new(args)
- args = args or {}
-
- local w = base.make_widget_from_value {
- {
+return setmetatable({}, {
+ __call = function(_, screen)
+ local w = base.make_widget_from_value {
{
{
{
- id = 'wifi_icon',
- image = gears.color.recolor_image(icondir .. 'no-internet.svg', Theme_config.network.fg),
- widget = wibox.widget.imagebox,
- resize = false,
+ {
+ id = 'wifi_icon',
+ image = gcolor.recolor_image(icondir .. 'no-internet.svg', beautiful.colorscheme.bg),
+ widget = wibox.widget.imagebox,
+ resize = false,
+ },
+ {
+ id = 'wifi_strength',
+ visible = true,
+ widget = wibox.widget.textbox,
+ },
+ spacing = dpi(10),
+ layout = wibox.layout.fixed.horizontal,
},
- {
- id = 'wifi_strength',
- visible = true,
- widget = wibox.widget.textbox,
- },
- spacing = dpi(10),
- layout = wibox.layout.fixed.horizontal,
+ left = dpi(8),
+ right = dpi(8),
+ widget = wibox.container.margin,
},
- left = dpi(8),
- right = dpi(8),
- widget = wibox.container.margin,
+ widget = wibox.container.place,
+ halign = 'center',
+ valign = 'center',
},
- widget = wibox.container.place,
- halign = 'center',
- valign = 'center',
- },
- bg = Theme_config.network.bg,
- fg = Theme_config.network.fg,
- shape = Theme_config.network.shape,
- widget = wibox.container.background,
- }
-
- assert(w, 'Failed to create widget')
-
- hover.bg_hover { widget = w }
-
- gtable.crush(w, network, true)
-
- capi.awesome.connect_signal('NM::AccessPointStrength', function(strength)
- strength = math.floor(strength)
- w:get_children_by_id('wifi_strength')[1].text = strength .. '%'
- w:get_children_by_id('wifi_icon')[1].image = gears.color.recolor_image(icondir ..
- 'wifi-strength-' .. math.floor(strength / 25) + 1 .. '.svg', Theme_config.network.fg)
- end)
-
- capi.awesome.connect_signal('NM::EthernetStatus', function(connected, speed)
- local tt = atooltip {
- objects = { w },
- mode = 'outside',
- preferred_alignments = 'middle',
- margins = dpi(10),
+ bg = beautiful.colorscheme.bg_red,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[6],
+ widget = wibox.container.background,
}
- if connected then
- w:get_children_by_id('wifi_icon')[1].image = gears.color.recolor_image(icondir .. 'ethernet.svg',
- Theme_config.network.fg)
- tt.text = 'Connected via Ethernet at ' .. math.floor(speed or 0) .. '/Mbps'
- else
- w:get_children_by_id('wifi_icon')[1].image = gears.color.recolor_image(icondir .. 'no-internet.svg',
- Theme_config.network.fg)
- tt.text = 'No connection found'
- end
- end)
- local nm = nm_widget { screen = args.screen }
+ hover.bg_hover { widget = w }
- local network_controler_popup = apopup {
- widget = nm,
- visible = false,
- ontop = true,
- screen = args.screen,
- }
-
- w:buttons(gtable.join(
- abutton({}, 1, function()
- --This gets the wrong wibox, get all wiboxed and find the correct widget
- network_controler_popup.x = capi.mouse.coords().x - (network_controler_popup:geometry().width / 2)
- network_controler_popup.y = dpi(65)
- network_controler_popup.visible = not network_controler_popup.visible
+ capi.awesome.connect_signal('NM::AccessPointStrength', function(strength)
+ strength = mfloor(strength)
+ w:get_children_by_id('wifi_strength')[1].text = strength .. '%'
+ w:get_children_by_id('wifi_icon')[1].image = gcolor.recolor_image(icondir ..
+ 'wifi-strength-' .. mfloor(strength / 25) + 1 .. '.svg', beautiful.colorscheme.bg)
end)
- ))
- return w
-end
+ capi.awesome.connect_signal('NM::EthernetStatus', function(connected, speed)
+ local tt = atooltip {
+ objects = { w },
+ mode = 'outside',
+ preferred_alignments = 'middle',
+ margins = dpi(10),
+ }
+ if connected then
+ w:get_children_by_id('wifi_icon')[1].image = gcolor.recolor_image(icondir .. 'ethernet.svg',
+ beautiful.colorscheme.bg)
+ tt.text = 'Connected via Ethernet at ' .. mfloor(speed or 0) .. '/Mbps'
+ else
+ w:get_children_by_id('wifi_icon')[1].image = gcolor.recolor_image(icondir .. 'no-internet.svg',
+ beautiful.colorscheme.bg)
+ tt.text = 'No connection found'
+ end
+ end)
-function network.mt:__call(...)
- return network.new(...)
-end
+ local nm = nm_widget { screen = screen }
-return setmetatable(network, network.mt)
+ local network_controler_popup = apopup {
+ widget = nm,
+ visible = true,
+ ontop = true,
+ screen = screen,
+ }
+
+ gtimer.delayed_call(function()
+ network_controler_popup.visible = false
+ end)
+
+ w:buttons(gtable.join(
+ abutton({}, 1, function()
+ --This gets the wrong wibox, get all wiboxed and find the correct widget
+ network_controler_popup.x = capi.mouse.coords().x - (network_controler_popup:geometry().width / 2)
+ network_controler_popup.y = dpi(70)
+ network_controler_popup.visible = not network_controler_popup.visible
+ end)
+ ))
+
+ return w
+ end,
+})
diff --git a/awesome/src/widgets/power.lua b/awesome/src/widgets/power.lua
index 29fc9fe..35cc795 100644
--- a/awesome/src/widgets/power.lua
+++ b/awesome/src/widgets/power.lua
@@ -1,51 +1,54 @@
---------------------------------
--- This is the power widget --
---------------------------------
+local setmetatable = setmetatable
-- Awesome Libs
local abutton = require('awful.button')
-local gtable = require('gears.table')
-local dpi = require('beautiful').xresources.apply_dpi
-local wibox = require('wibox')
-local gfilesystem = require('gears.filesystem')
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
local gcolor = require('gears.color')
+local gfilesystem = require('gears.filesystem')
+local gtable = require('gears.table')
+local wibox = require('wibox')
-- Local libs
-local powermenu = require('src.modules.powermenu.init')
local hover = require('src.tools.hover')
+local powermenu = require('src.modules.powermenu')
-- Icon directory path
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/power/'
-return setmetatable({}, { __call = function()
+local instance = nil
+if not instance then
+ instance = setmetatable({}, { __call = function()
- local power_widget = wibox.widget {
- {
+ local power_widget = wibox.widget {
{
- image = gcolor.recolor_image(icondir .. 'power.svg', Theme_config.power_button.fg),
- widget = wibox.widget.imagebox,
- valign = 'center',
- halign = 'center',
- resize = false,
+ {
+ image = gcolor.recolor_image(icondir .. 'power.svg', beautiful.colorscheme.bg),
+ widget = wibox.widget.imagebox,
+ valign = 'center',
+ halign = 'center',
+ resize = false,
+ },
+ left = dpi(8),
+ right = dpi(8),
+ widget = wibox.container.margin,
},
- left = dpi(8),
- right = dpi(8),
- widget = wibox.container.margin,
- },
- bg = Theme_config.power_button.bg,
- fg = Theme_config.power_button.fg,
- shape = Theme_config.power_button.shape,
- widget = wibox.container.background,
- }
+ bg = beautiful.colorscheme.bg_red,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[6],
+ widget = wibox.container.background,
+ }
- -- Signals
- hover.bg_hover { widget = power_widget }
+ -- Signals
+ hover.bg_hover { widget = power_widget }
- power_widget:buttons { gtable.join(
- abutton({}, 1, function()
- powermenu:toggle()
- end)
- ), }
+ power_widget:buttons { gtable.join(
+ abutton({}, 1, function()
+ powermenu:toggle()
+ end)
+ ), }
- return power_widget
-end, })
+ return power_widget
+ end, })
+end
+return instance
diff --git a/awesome/src/widgets/ram_info.lua b/awesome/src/widgets/ram_info.lua
index 34a5ee3..08e07c1 100644
--- a/awesome/src/widgets/ram_info.lua
+++ b/awesome/src/widgets/ram_info.lua
@@ -1,70 +1,75 @@
----------------------------------
--- This is the RAM Info widget --
----------------------------------
+local setmetatable = setmetatable
+local string = string
+local tostring = tostring
-- Awesome Libs
-local dpi = require('beautiful').xresources.apply_dpi
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
-local gshape = require('gears.shape')
local wibox = require('wibox')
-local ram_helper = require('src.tools.helpers.ram')
+-- Local Libs
local hover = require('src.tools.hover')
+local ram_helper = require('src.tools.helpers.ram')
local icon_dir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/cpu/'
-return function()
- local ram_widget = wibox.widget {
- {
- {
+local instance = nil
+if not instance then
+ instance = setmetatable({}, {
+ __call = function()
+ local ram_widget = wibox.widget {
{
{
{
- id = 'icon',
- widget = wibox.widget.imagebox,
- valign = 'center',
- halign = 'center',
- image = gcolor.recolor_image(icon_dir .. 'ram.svg', Theme_config.ram_info.fg),
- resize = false,
+ {
+ {
+ id = 'icon',
+ widget = wibox.widget.imagebox,
+ valign = 'center',
+ halign = 'center',
+ image = gcolor.recolor_image(icon_dir .. 'ram.svg', beautiful.colorscheme.fg),
+ resize = false,
+ },
+ id = 'icon_layout',
+ widget = wibox.container.place,
+ },
+ top = dpi(2),
+ widget = wibox.container.margin,
+ id = 'icon_margin',
},
- id = 'icon_layout',
- widget = wibox.container.place,
+ spacing = dpi(10),
+ {
+ id = 'label',
+ align = 'center',
+ valign = 'center',
+ widget = wibox.widget.textbox,
+ },
+ id = 'ram_layout',
+ layout = wibox.layout.fixed.horizontal,
},
- top = dpi(2),
+ id = 'container',
+ left = dpi(8),
+ right = dpi(8),
widget = wibox.container.margin,
- id = 'icon_margin',
},
- spacing = dpi(10),
- {
- id = 'label',
- align = 'center',
- valign = 'center',
- widget = wibox.widget.textbox,
- },
- id = 'ram_layout',
- layout = wibox.layout.fixed.horizontal,
- },
- id = 'container',
- left = dpi(8),
- right = dpi(8),
- widget = wibox.container.margin,
- },
- bg = Theme_config.ram_info.bg,
- fg = Theme_config.ram_info.fg,
- shape = function(cr, width, height)
- gshape.rounded_rect(cr, width, height, dpi(6))
+ bg = beautiful.colorscheme.bg_red,
+ fg = beautiful.colorscheme.bg,
+ shape = beautiful.shape[6],
+ widget = wibox.container.background,
+ }
+
+ hover.bg_hover { widget = ram_widget }
+
+ ram_helper:connect_signal('update::ram_widget', function(_, MemTotal, _, MemAvailable)
+ 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
+ end)
+
+ return ram_widget
end,
- widget = wibox.container.background,
- }
-
- hover.bg_hover { widget = ram_widget }
-
- ram_helper:connect_signal('update::ram_widget', function(_, MemTotal, MemFree, MemAvailable)
- 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
- end)
-
- return ram_widget
+ })
end
+return instance
diff --git a/awesome/src/widgets/systray.lua b/awesome/src/widgets/systray.lua
index 63358df..154f02c 100644
--- a/awesome/src/widgets/systray.lua
+++ b/awesome/src/widgets/systray.lua
@@ -3,48 +3,72 @@
--------------------------------
-- Awesome Libs
+local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox')
+local abutton = require('awful.button')
+local gfilesystem = require('gears.filesystem')
-local capi = { awesome = awesome }
+local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/systray/'
--- Systray theme variables
-Theme.bg_systray = Theme_config.systray.bg
-Theme.systray_icon_spacing = dpi(10)
+local instance = nil
+if not instance then
+ instance = setmetatable({}, {
+ __call = function()
+ local systray = wibox.widget {
+ {
+ {
+ {
+ widget = wibox.widget.imagebox,
+ resize = true,
+ halign = 'center',
+ valign = 'center',
+ image = icondir .. 'chevron-right.svg',
+ },
+ height = dpi(28),
+ width = dpi(28),
+ widget = wibox.container.constraint,
+ strategy = 'exact',
+ },
+ {
+ {
+ {
+ wibox.widget.systray(),
+ id = 'systray_margin',
+ margins = dpi(6),
+ widget = wibox.container.margin,
+ },
+ strategy = 'exact',
+ widget = wibox.container.constraint,
+ },
+ widget = wibox.container.place,
+ },
+ id = 'lay',
+ layout = wibox.layout.fixed.horizontal,
+ },
+ widget = wibox.container.background,
+ shape = beautiful.shape[6],
+ bg = beautiful.colorscheme.bg1,
+ }
-return function()
- local systray = wibox.widget {
- {
- {
- wibox.widget.systray(),
- id = 'systray_margin',
- widget = wibox.container.margin,
- },
- strategy = 'exact',
- widget = wibox.container.constraint,
- },
- widget = wibox.container.background,
- shape = Theme_config.systray.shape,
- bg = Theme_config.systray.bg
- }
+ systray:buttons {
+ abutton({}, 1, function()
+ local c = systray:get_children_by_id('lay')[1].children[2]
+ c.visible = not c.visible
- local systray_margin = systray:get_children_by_id('systray_margin')[1]
+ if not c.visible then
+ systray:get_children_by_id('lay')[1].children[1].children[1].image = icondir .. 'chevron-left.svg'
+ else
+ systray:get_children_by_id('lay')[1].children[1].children[1].image = icondir .. 'chevron-right.svg'
+ end
+ end),
+ }
- -- Wait for an systray update
- capi.awesome.connect_signal('systray::update', function()
- -- Get the number of entries in the systray
- local num_entries = capi.awesome.systray()
+ -- Set the icon size
+ systray:get_children_by_id('systray_margin')[1].widget:set_base_size(dpi(24))
- -- If its 0 remove the margins to hide the widget
- if num_entries == 0 then
- systray_margin:set_margins(0)
- else
- systray_margin:set_margins(dpi(6))
- end
- end)
-
- -- Set the icon size
- systray_margin.widget:set_base_size(dpi(24))
-
- return systray
+ return systray
+ end,
+ })
end
+return instance
diff --git a/awesome/src/widgets/taglist.lua b/awesome/src/widgets/taglist.lua
index 88bf781..9163cc1 100644
--- a/awesome/src/widgets/taglist.lua
+++ b/awesome/src/widgets/taglist.lua
@@ -1,13 +1,13 @@
---------------------------------
--- This is the taglist widget --
---------------------------------
+local ipairs = ipairs
+local setmetatable = setmetatable
-- Awesome Libs
local abutton = require('awful.button')
local ascreen = require('awful.screen')
local atag = require('awful.tag')
local awidget = require('awful.widget')
-local dpi = require('beautiful').xresources.apply_dpi
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
local gtable = require('gears.table')
local wibox = require('wibox')
@@ -16,7 +16,7 @@ local hover = require('src.tools.hover')
local capi = { client = client }
-local modkey = User_config.modkey
+local modkey = beautiful.user_config.modkey
local tag_text = {
[1] = '一',
@@ -40,7 +40,6 @@ return setmetatable({}, { __call = function(_, screen)
widget:reset()
-- Create a tag widget for each tag
for _, tag in ipairs(tags) do
-
local tag_widget = wibox.widget {
{
{
@@ -59,9 +58,9 @@ return setmetatable({}, { __call = function(_, screen)
right = dpi(10),
widget = wibox.container.margin,
},
- fg = Theme_config.taglist.fg,
- bg = Theme_config.taglist.bg,
- shape = Theme_config.taglist.shape,
+ fg = beautiful.colorscheme.fg,
+ bg = beautiful.colorscheme.bg1,
+ shape = beautiful.shape[6],
widget = wibox.container.background,
}
@@ -100,14 +99,14 @@ return setmetatable({}, { __call = function(_, screen)
-- Change the taglist colors depending on the state of the tag
if tag == ascreen.focused().selected_tag then
- tag_widget:set_bg(Theme_config.taglist.bg_focus)
- tag_widget:set_fg(Theme_config.taglist.fg_focus)
+ tag_widget:set_bg(beautiful.colorscheme.fg)
+ tag_widget:set_fg(beautiful.colorscheme.bg)
elseif tag.urgent == true then
- tag_widget:set_bg(Theme_config.taglist.bg_urgent)
- tag_widget:set_fg(Theme_config.taglist.fg_urgent)
+ tag_widget:set_bg(beautiful.colorscheme.bg_red)
+ tag_widget:set_fg(beautiful.colorscheme.bg)
else
- tag_widget:set_bg(Theme_config.taglist.bg)
- tag_widget:set_fg(Theme_config.taglist.fg)
+ tag_widget:set_bg(beautiful.colorscheme.bg1)
+ tag_widget:set_fg(beautiful.colorscheme.fg)
end
-- Add the client icons to the tag widget
diff --git a/awesome/src/widgets/tasklist.lua b/awesome/src/widgets/tasklist.lua
index ba1e86a..bf0d407 100644
--- a/awesome/src/widgets/tasklist.lua
+++ b/awesome/src/widgets/tasklist.lua
@@ -1,12 +1,12 @@
----------------------------------
--- This is the tasklist widget --
----------------------------------
+local ipairs = ipairs
+local setmetatable = setmetatable
-- Awesome Libs
local abutton = require('awful.button')
local atooltip = require('awful.tooltip')
local awidget = require('awful.widget')
-local dpi = require('beautiful').xresources.apply_dpi
+local beautiful = require('beautiful')
+local dpi = beautiful.xresources.apply_dpi
local gtable = require('gears.table')
local wibox = require('wibox')
@@ -54,9 +54,9 @@ return setmetatable({}, { __call = function(_, screen)
left = dpi(10),
widget = wibox.container.margin,
},
- fg = Theme_config.tasklist.fg,
- bg = Theme_config.tasklist.bg,
- shape = Theme_config.tasklist.shape,
+ fg = beautiful.colorscheme.fg,
+ bg = beautiful.colorscheme.bg1,
+ shape = beautiful.shape[6],
widget = wibox.container.background,
}
@@ -79,7 +79,7 @@ return setmetatable({}, { __call = function(_, screen)
end)
), }
- local label = User_config.taskbar_use_name and client.name or client.class or ''
+ local label = beautiful.user_config.taskbar_use_name and client.name or client.class or ''
-- If the client is focused, show the tooltip and add a label
if client == capi.client.focus then
@@ -93,10 +93,10 @@ return setmetatable({}, { __call = function(_, screen)
delay_show = 1,
}
task_widget:get_children_by_id('text_role')[1].text = label:sub(1, 20)
- task_widget.bg = Theme_config.tasklist.bg_focus
- task_widget.fg = Theme_config.tasklist.fg_focus
+ task_widget.bg = beautiful.colorscheme.fg
+ task_widget.fg = beautiful.colorscheme.bg
else
- task_widget.bg = Theme_config.tasklist.bg
+ task_widget.bg = beautiful.colorscheme.bg1
task_widget:get_children_by_id('text_role')[1].text = ''
end
diff --git a/awesome/wibox/widget/inputbox.lua b/awesome/wibox/widget/inputbox.lua
index 5c4af4b..4f96029 100644
--- a/awesome/wibox/widget/inputbox.lua
+++ b/awesome/wibox/widget/inputbox.lua
@@ -8,17 +8,17 @@
-- @supermodule wibox.widget.textbox
---------------------------------------------------------------------------
-local base = require("wibox.widget.base")
-local gdebug = require("gears.debug")
-local gfs = require("gears.filesystem")
-local gobject = require("gears.object")
-local gstring = require("gears.string")
-local beautiful = require("beautiful")
-local keygrabber = require("awful.keygrabber")
-local lgi = require("lgi")
-local gtable = require("gears.table")
-local wibox = require("wibox")
-local abutton = require("awful.button")
+local base = require('wibox.widget.base')
+local gdebug = require('gears.debug')
+local gfs = require('gears.filesystem')
+local gobject = require('gears.object')
+local gstring = require('gears.string')
+local beautiful = require('beautiful')
+local keygrabber = require('awful.keygrabber')
+local lgi = require('lgi')
+local gtable = require('gears.table')
+local wibox = require('wibox')
+local abutton = require('awful.button')
local setmetatable = setmetatable
local capi =
@@ -33,30 +33,30 @@ local inputbox = { mt = {} }
local function text_with_cursor(text, cursor_pos, self)
local char, spacer, text_start, text_end
- local cursor_fg = beautiful.inputbox_cursor_fg or "#313131"
- local cursor_bg = beautiful.inputbox_cursor_bg or "#0dccfc"
- local text_color = beautiful.inputbox_fg or "#ffffff"
- local placeholder_text = beautiful.inputbox_placeholder_text or "Type here..."
- local placeholder_fg = beautiful.inputbox_placeholder_fg or "#777777"
- local highlight_bg = beautiful.inputbox_highlight_bg or "#35ffe4"
- local highlight_fg = beautiful.inputbox_highlight_fg or "#000000"
+ local cursor_fg = beautiful.inputbox_cursor_fg or beautiful.colorscheme.bg1
+ local cursor_bg = beautiful.inputbox_cursor_bg or beautiful.colorscheme.bg_blue
+ local text_color = beautiful.inputbox_fg or beautiful.colorscheme.fg
+ local placeholder_text = beautiful.inputbox_placeholder_text or 'Type here...'
+ local placeholder_fg = beautiful.inputbox_placeholder_fg or beautiful.colorscheme.bg2
+ local highlight_bg = beautiful.inputbox_highlight_bg or beautiful.fg
+ local highlight_fg = beautiful.inputbox_highlight_fg or beautiful.bg
- if text == "" then
- return "" .. placeholder_text .. ""
+ if text == '' then
+ return "" .. placeholder_text .. ''
end
if #text < cursor_pos then
- char = " "
- spacer = ""
+ char = ' '
+ spacer = ''
text_start = gstring.xml_escape(text)
- text_end = ""
+ text_end = ''
else
local offset = 0
if #text:sub(cursor_pos, cursor_pos) == -1 then
offset = 1
end
char = gstring.xml_escape(text:sub(cursor_pos, cursor_pos + offset))
- spacer = " "
+ spacer = ' '
text_start = gstring.xml_escape(text:sub(1, cursor_pos - 1))
text_end = gstring.xml_escape(text:sub(cursor_pos + offset + 1))
end
@@ -68,34 +68,34 @@ local function text_with_cursor(text, cursor_pos, self)
self._private.highlight.cur_pos_end))
local text_end_highlight = gstring.xml_escape(text:sub(self._private.highlight.cur_pos_end + 1))
- return "" .. text_start_highlight .. "" ..
+ return "" .. text_start_highlight .. '' ..
"" ..
text_highlighted ..
- "" .. "" .. text_end_highlight .. ""
+ '' .. "" .. text_end_highlight .. ''
else
- return "" .. text_start .. "" ..
+ return "" .. text_start .. '' ..
"" ..
- char .. "" .. "" .. text_end .. spacer .. ""
+ char .. '' .. "" .. text_end .. spacer .. ''
end
end
--- Clears the current text
function inputbox:clear()
- self:set_text("")
+ self:set_text('')
end
function inputbox:get_text()
- return self._private.text or ""
+ return self._private.text or ''
end
function inputbox:set_text(text)
self._private.text = text
- self:emit_signal("property::text", text)
+ self:emit_signal('property::text', text)
end
--- Stop the keygrabber and mousegrabber
function inputbox:stop()
- self:emit_signal("stopped")
+ self:emit_signal('stopped')
keygrabber.stop()
capi.mousegrabber.stop()
end
@@ -119,38 +119,38 @@ function inputbox:focus()
end, "left_ptr"
) ]]
- self:connect_signal("button::press", function()
+ self:connect_signal('button::press', function()
if capi.mouse.current_widget ~= self then
- self:emit_signal("keygrabber::stop", "")
+ self:emit_signal('keygrabber::stop', '')
end
end)
end
function inputbox:run()
- if not self._private.text then self._private.text = "" end
+ if not self._private.text then self._private.text = '' end
-- Init the cursor position, but causes on refocus the cursor to move to the left
local cursor_pos = #self:get_text() + 1
- self:emit_signal("started")
+ self:emit_signal('started')
-- Init and reset(when refocused) the highlight
self._private.highlight = {}
-- Emitted when the keygrabber is stopped
- self:connect_signal("cancel", function()
+ self:connect_signal('cancel', function()
self:stop()
- self:emit_signal("stopped")
+ self:emit_signal('stopped')
end)
-- Emitted when the keygrabber should submit the text
- self:connect_signal("submit", function(text)
+ self:connect_signal('submit', function(text)
self:stop()
- self:emit_signal("stopped", text)
+ self:emit_signal('stopped', text)
end)
- self:emit_signal("key_pressed", "B", "A")
+ self:emit_signal('key_pressed', 'B', 'A')
keygrabber.run(function(mod, key, event)
@@ -159,19 +159,19 @@ function inputbox:run()
mod_keys[v] = true
end
- if not (event == "press") then return end
+ if not (event == 'press') then return end
--Escape cases
-- Just quit and leave the text as is
- if (not mod_keys.Control) and (key == "Escape") then
- self:emit_signal("cancel")
- elseif (not mod_keys.Control and key == "KP_Enter") or (not mod_keys.Control and key == "Return") then
- self:emit_signal("submit", self:get_text())
- self:set_text("")
+ if (not mod_keys.Control) and (key == 'Escape') then
+ self:emit_signal('cancel')
+ elseif (not mod_keys.Control and key == 'KP_Enter') or (not mod_keys.Control and key == 'Return') then
+ self:emit_signal('submit', self:get_text())
+ self:set_text('')
end
-- All shift, control or key cases
if mod_keys.Shift then
- if key == "Left" then
+ if key == 'Left' then
if cursor_pos > 1 then
if not self._private.highlight.cur_pos_start then
self._private.highlight.cur_pos_start = cursor_pos - 1
@@ -188,7 +188,7 @@ function inputbox:run()
cursor_pos = cursor_pos - 1
end
- elseif key == "Right" then
+ elseif key == 'Right' then
if #self._private.text >= cursor_pos then
if not self._private.highlight.cur_pos_end then
self._private.highlight.cur_pos_end = cursor_pos - 1
@@ -215,18 +215,18 @@ function inputbox:run()
end
end
elseif mod_keys.Control then
- if key == "a" then
+ if key == 'a' then
-- Mark the entire text
self._private.highlight = {
cur_pos_start = 1,
- cur_pos_end = #self._private.text
+ cur_pos_end = #self._private.text,
}
- elseif key == "c" then
+ elseif key == 'c' then
-- TODO: Copy the highlighted text when the selection setter gets implemented
- elseif key == "v" then
+ elseif key == 'v' then
local sel = capi.selection()
if sel then
- sel = sel:gsub("\n", "")
+ sel = sel:gsub('\n', '')
if self._private.highlight and self._private.highlight.cur_pos_start and
self._private.highlight.cur_pos_end then
-- insert the text into the selected part
@@ -241,18 +241,18 @@ function inputbox:run()
cursor_pos = cursor_pos + #sel
end
end
- elseif key == "x" then
+ elseif key == 'x' then
--TODO: "cut". Copy selected then clear text, this requires to add the c function first.
self._private.highlight = {}
- elseif key == "Left" then
+ elseif key == 'Left' then
-- Find all spaces
local spaces = {}
local t, i = self._private.text, 0
- while t:find("%s") do
- i = t:find("%s")
+ while t:find('%s') do
+ i = t:find('%s')
table.insert(spaces, i)
- t = t:sub(1, i - 1) .. "-" .. t:sub(i + 1)
+ t = t:sub(1, i - 1) .. '-' .. t:sub(i + 1)
end
local cp = 1
@@ -262,8 +262,8 @@ function inputbox:run()
end
end
cursor_pos = cp
- elseif key == "Right" then
- local next_space = self._private.text:sub(cursor_pos):find("%s")
+ elseif key == 'Right' then
+ local next_space = self._private.text:sub(cursor_pos):find('%s')
if next_space then
cursor_pos = cursor_pos + next_space
else
@@ -271,7 +271,7 @@ function inputbox:run()
end
end
else
- if key == "BackSpace" then
+ if key == 'BackSpace' then
-- If text is highlighted delete that, else just delete the character to the left
if self._private.highlight and self._private.highlight.cur_pos_start and
self._private.highlight.cur_pos_end then
@@ -287,7 +287,7 @@ function inputbox:run()
cursor_pos = cursor_pos - 1
end
end
- elseif key == "Delete" then
+ elseif key == 'Delete' then
-- If text is highlighted delete that, else just delete the character to the right
if self._private.highlight and self._private.highlight.cur_pos_start and
self._private.highlight.cur_pos_end then
@@ -302,13 +302,13 @@ function inputbox:run()
self._private.text:sub(cursor_pos + 1))
end
end
- elseif key == "Left" then
+ elseif key == 'Left' then
-- Move cursor ro the left
if cursor_pos > 1 then
cursor_pos = cursor_pos - 1
end
self._private.highlight = {}
- elseif key == "Right" then
+ elseif key == 'Right' then
-- Move cursor to the right
if cursor_pos <= #self._private.text then
cursor_pos = cursor_pos + 1
@@ -335,14 +335,14 @@ function inputbox:run()
self.text = text_with_cursor(self:get_text(), cursor_pos, self)
-- using self:emit_signal... results in nil tables beeing send
- awesome.emit_signal("inputbox::key_pressed", mod_keys, key)
+ awesome.emit_signal('inputbox::key_pressed', mod_keys, key)
end)
end
function inputbox.new(args)
args = args or {}
- local w = wibox.widget.textbox(args.text or "")
+ local w = wibox.widget.textbox(args.text or '')
gtable.crush(w, inputbox, true)
@@ -354,33 +354,33 @@ function inputbox.new(args)
abutton({}, 3, function()
-- TODO: Figure out how to paste with highlighted support
-- Maybe with a signal?
- end)
+ end),
}
)
-- Change the cursor to "xterm" on hover over
local old_cursor, old_wibox
w:connect_signal(
- "mouse::enter",
+ 'mouse::enter',
function()
local wid = capi.mouse.current_wibox
if wid then
old_cursor, old_wibox = wid.cursor, wid
- wid.cursor = "xterm"
+ wid.cursor = 'xterm'
end
end
)
-- Change the cursor back once leaving the widget
w:connect_signal(
- "mouse::leave",
+ 'mouse::leave',
function()
old_wibox.cursor = old_cursor
old_wibox = nil
end
)
- w.text = text_with_cursor("", 1, w)
+ w.text = text_with_cursor('', 1, w)
return w