Big rewrite part 1

This commit is contained in:
Rene Kievits
2023-04-20 01:04:06 +02:00
parent 61930bf561
commit 3a85753a74
78 changed files with 3364 additions and 4090 deletions

View File

@@ -1,6 +1,7 @@
local base = require('wibox.widget.base') local base = require('wibox.widget.base')
local gtable = require('gears.table') local gtable = require('gears.table')
local gcolor = require('gears.color') local gcolor = require('gears.color')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox') local wibox = require('wibox')
local gshape = require('gears.shape') local gshape = require('gears.shape')
@@ -38,21 +39,21 @@ end
function toggle_widget:set_disabled() function toggle_widget:set_disabled()
self.active = not self.active self.active = not self.active
self.toggle_button.border_color = Theme_config.dnd.border_disabled self.toggle_button.border_color = beautiful.colorscheme.bg1
self.newcolor = Theme_config.dnd.disabled self.newcolor = beautiful.colorscheme.bg1
self.rubato_timed.target = 5 self.rubato_timed.target = 5
end end
function toggle_widget:toggle_animation(pos, color) function toggle_widget:toggle_animation(pos, color)
if pos > 39 then return end if pos > 39 then return end
return function(_, _, cr, width, height) return function(_, _, cr, width, height)
cr:set_source(gcolor(Theme_config.dnd.bg)) cr:set_source(gcolor(beautiful.colorscheme.bg))
cr:paint() cr:paint()
cr:set_source(gcolor(color)) cr:set_source(gcolor(color))
cr:move_to(pos, 0) cr:move_to(pos, 0)
local x = pos local x = pos
local y = 5 local y = 5
local newwidth = width / 2 - 6 local newwidth = dpi(width / 2 - 6)
local newheight = height - 10 local newheight = height - 10
local radius = height / 6.0 local radius = height / 6.0
@@ -77,7 +78,7 @@ function toggle_widget.new(args)
gtable.crush(ret, toggle_widget, true) gtable.crush(ret, toggle_widget, true)
ret.newcolor = Theme_config.dnd.disabled ret.newcolor = beautiful.colorscheme.bg1
ret.color = args.color ret.color = args.color
ret.toggle_button = wibox.widget { ret.toggle_button = wibox.widget {
@@ -92,14 +93,12 @@ function toggle_widget.new(args)
}, },
active = false, active = false,
widget = wibox.container.background, widget = wibox.container.background,
bg = Theme_config.dnd.bg, bg = beautiful.colorscheme.bg,
border_color = Theme_config.dnd.border_disabled, border_color = beautiful.colorscheme.border_color,
border_width = dpi(2), border_width = dpi(2),
forced_height = args.size, forced_height = args.size,
forced_width = args.size * 2, forced_width = args.size * 2,
shape = function(cr, width, height) shape = beautiful.shape[10],
gshape.rounded_rect(cr, width, height, dpi(10))
end,
} }
ret.rubato_timed = rubato.timed { ret.rubato_timed = rubato.timed {
@@ -128,9 +127,7 @@ function toggle_widget.new(args)
}, },
id = 'background4', id = 'background4',
fg = args.fg, fg = args.fg,
shape = function(cr, width, height) shape = beautiful.shape[12],
gshape.rounded_rect(cr, width, height, dpi(12))
end,
widget = wibox.container.background, widget = wibox.container.background,
}, },
id = 'place', id = 'place',

View File

@@ -35,32 +35,15 @@ io.stderr:write([[
]] .. '\27[0m\n') ]] .. '\27[0m\n')
--#endregion --#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.core.error_handling')
require('src.theme.user_config') require('src.theme')
require('src.theme.theme_config')
require('src.tools.gio_icon_lookup')
require('src.theme.init')
require('src.tools.hex_to_rgba')
require('src.core.signals') require('src.core.signals')
require('src.core.notifications') require('src.core.notifications')
require('src.core.rules') require('src.core.rules')
require('src.bindings.global_buttons') require('src.bindings.global_buttons')
require('src.bindings.bind_to_tags') require('src.bindings.bind_to_tags')
require('src.modules.init') require('src.modules')()
--require('src.tools.auto_starter')(User_config.autostart) require('src.tools.auto_starter') {}
--require('src.core.setup')() --require('src.core.setup')()

422
awesome/schema.json Normal file
View File

@@ -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"
]
}
]
}

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="#f5f5f5" d="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z" />
</svg>

After

Width:  |  Height:  |  Size: 160 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="#f5f5f5" d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" />
</svg>

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 KiB

After

Width:  |  Height:  |  Size: 310 KiB

View File

@@ -2,16 +2,17 @@
local akey = require('awful.key') local akey = require('awful.key')
local ascreen = require('awful.screen') local ascreen = require('awful.screen')
local atag = require('awful.tag') local atag = require('awful.tag')
local beautiful = require('beautiful')
local gtable = require('gears.table') local gtable = require('gears.table')
-- Local libs -- Local libs
local globalkeys = require('src.bindings.global_keys') local globalkeys = require('src.bindings.global_keys')
local modkey = User_config.modkey local modkey = beautiful.user_config['modkey']
local capi = { local capi = {
client = client, client = client,
root = root root = root,
} }
for i = 1, 9 do for i = 1, 9 do

View File

@@ -2,8 +2,10 @@
local abutton = require('awful.button') local abutton = require('awful.button')
local gtable = require('gears.table') local gtable = require('gears.table')
local amouse = require('awful.mouse') local amouse = require('awful.mouse')
local beautiful = require('beautiful')
local modkey = User_config.modkey
local modkey = beautiful.user_config['modkey']
return gtable.join { return gtable.join {
abutton({}, 1, function(c) abutton({}, 1, function(c)

View File

@@ -2,9 +2,11 @@
local aclient = require('awful.client') local aclient = require('awful.client')
local akey = require('awful.key') local akey = require('awful.key')
local ascreen = require('awful.screen') local ascreen = require('awful.screen')
local beautiful = require('beautiful')
local gtable = require('gears.table') local gtable = require('gears.table')
local modkey = User_config.modkey local modkey = beautiful.user_config['modkey']
return gtable.join( return gtable.join(
--#region Basic interactions --#region Basic interactions

View File

@@ -14,7 +14,8 @@ local ruled = require('ruled')
local config = require('src.tools.config') local config = require('src.tools.config')
local audio_helper = require('src.tools.helpers.audio') local audio_helper = require('src.tools.helpers.audio')
local backlight_helper = require('src.tools.helpers.backlight') 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 kb_helper = require('src.tools.helpers.kb_helper')
local capi = { local capi = {
@@ -23,7 +24,7 @@ local capi = {
mouse = mouse, mouse = mouse,
} }
local modkey = User_config.modkey local modkey = beautiful.user_config['modkey']
akeygrabber { akeygrabber {
keybindings = { keybindings = {
@@ -138,7 +139,7 @@ return gtable.join(
{ modkey }, { modkey },
'#36', '#36',
function() function()
aspawn(User_config.terminal) aspawn(beautiful.user_config.terminal)
end, end,
{ description = 'Open terminal', group = 'Applications' } { description = 'Open terminal', group = 'Applications' }
), ),
@@ -208,7 +209,7 @@ return gtable.join(
{ modkey }, { modkey },
'#26', '#26',
function() function()
aspawn(User_config.file_manager) aspawn(beautiful.user_config.file_manager)
end, end,
{ descripton = 'Open file manager', group = 'System' } { descripton = 'Open file manager', group = 'System' }
), ),
@@ -224,7 +225,7 @@ return gtable.join(
{}, {},
'#107', '#107',
function() function()
aspawn(User_config.screenshot_program) aspawn(beautiful.user_config.screenshot_program)
end, end,
{ description = 'Screenshot', group = 'Applications' } { description = 'Screenshot', group = 'Applications' }
), ),
@@ -256,7 +257,7 @@ return gtable.join(
{}, {},
'XF86MonBrightnessUp', 'XF86MonBrightnessUp',
function(c) function(c)
backlight_helper.brightness_increase() backlight_helper:brightness_increase()
end, end,
{ description = 'Raise backlight brightness', group = 'System' } { description = 'Raise backlight brightness', group = 'System' }
), ),
@@ -264,7 +265,7 @@ return gtable.join(
{}, {},
'XF86MonBrightnessDown', 'XF86MonBrightnessDown',
function(c) function(c)
backlight_helper.brightness_decrease() backlight_helper:brightness_decrease()
end, end,
{ description = 'Lower backlight brightness', group = 'System' } { description = 'Lower backlight brightness', group = 'System' }
), ),

View File

@@ -4,10 +4,10 @@
-- Awesome Libs -- Awesome Libs
local aspawn = require('awful.spawn') local aspawn = require('awful.spawn')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local gshape = require('gears.shape')
local naughty = require('naughty') local naughty = require('naughty')
local wibox = require('wibox') local wibox = require('wibox')
local abutton = require('awful.button') local abutton = require('awful.button')
@@ -28,15 +28,13 @@ naughty.config.defaults.icon_size = dpi(80)
naughty.config.defaults.timeout = 5 naughty.config.defaults.timeout = 5
naughty.config.defaults.title = 'System Notification' naughty.config.defaults.title = 'System Notification'
naughty.config.defaults.margin = dpi(10) naughty.config.defaults.margin = dpi(10)
naughty.config.defaults.position = Theme_config.notification.position naughty.config.defaults.position = 'bottom_right'
naughty.config.defaults.border_width = Theme_config.notification.border_width naughty.config.defaults.border_width = dpi(2)
naughty.config.defaults.border_color = Theme_config.notification.border_color naughty.config.defaults.border_color = beautiful.colorscheme.border_color
naughty.config.defaults.spacing = Theme_config.notification.spacing naughty.config.defaults.spacing = dpi(10)
Theme.notification_spacing = Theme_config.notification.corner_spacing
naughty.connect_signal('request::display', function(n) naughty.connect_signal('request::display', function(n)
if User_config.dnd then if beautiful.user_config.dnd then
n:destroy() n:destroy()
else else
if not n.icon then n.icon = gfilesystem.get_configuration_dir() .. 'src/assets/CT.svg' end 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.title then n.title = 'System Notification' end
if not n.message then n.message = 'No message provided' 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 if n.urgency == 'critical' then
color = Theme_config.notification.fg_urgent_message color = beautiful.colorscheme.bg_red
end end
if n.app_name == 'Spotify' then if n.app_name == 'Spotify' then
@@ -104,28 +102,24 @@ naughty.connect_signal('request::display', function(n)
id = 'background_role', id = 'background_role',
widget = wibox.container.background, widget = wibox.container.background,
bg = color, bg = color,
fg = Theme_config.notification.bg, fg = beautiful.colorscheme.bg,
shape = function(cr, width, height) shape = beautiful.shape[8],
gshape.rounded_rect(cr, width, height, dpi(8))
end,
}, },
style = { style = {
underline_normal = false, underline_normal = false,
underline_selected = false, underline_selected = false,
shape_normal = function(cr, width, height) shape_normal = beautiful.shape[8],
gshape.rounded_rect(cr, width, height, dpi(8))
end,
--Don't remove or it will break --Don't remove or it will break
bg_normal = color, bg_normal = color,
bg_selected = color, bg_selected = color,
fg_normal = Theme_config.notification.bg, fg_normal = beautiful.colorscheme.bg,
fg_selected = Theme_config.notification.bg, fg_selected = beautiful.colorscheme.bg,
}, },
widget = naughty.list.actions, widget = naughty.list.actions,
} }
-- Hack to get the action buttons to work even after update -- 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 } hover.bg_hover { widget = action_template._private.layout.children[i].children[1], overlay = 12, press_overlay = 24 }
end end
if (#action_template._private.layout.children > 0) and action_template._private.notification[1].actions[1].program == 'Spotify' then 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() action_template._private.layout.children[3].children[1]:connect_signal('button::press', function()
aspawn('playerctl next') aspawn('playerctl next')
end) end)
end ]] end
local start_timer = n.timeout local start_timer = n.timeout
if n.timeout == 0 then if n.timeout == 0 then
@@ -164,9 +158,7 @@ naughty.connect_signal('request::display', function(n)
resize = true, resize = true,
}, },
widget = wibox.container.background, widget = wibox.container.background,
shape = function(cr, width, height) shape = beautiful.shape[4],
gshape.rounded_rect(cr, width, height, dpi(4))
end,
}, },
widget = wibox.container.place, widget = wibox.container.place,
}, },
@@ -180,7 +172,7 @@ naughty.connect_signal('request::display', function(n)
notification = n, notification = n,
widget = naughty.widget.title, widget = naughty.widget.title,
markup = [[<span foreground="]] .. markup = [[<span foreground="]] ..
Theme_config.notification.bg .. [[" font="JetBrainsMono Nerd Font, Bold 16">]] .. (n.app_name or beautiful.colorscheme.bg .. [[" font="JetBrainsMono Nerd Font, Bold 16">]] .. (n.app_name or
'Unknown App') .. [[</span> | <span font="JetBrainsMono Nerd Font, Regular 16">]] .. (n.title or 'System Notification') .. [[</span>]], 'Unknown App') .. [[</span> | <span font="JetBrainsMono Nerd Font, Regular 16">]] .. (n.title or 'System Notification') .. [[</span>]],
halign = 'left', halign = 'left',
valign = 'center', valign = 'center',
@@ -203,7 +195,7 @@ naughty.connect_signal('request::display', function(n)
widget = wibox.widget.textclock, widget = wibox.widget.textclock,
format = '%H:%M', format = '%H:%M',
font = 'JetBrainsMono Nerd Font, Bold 16', font = 'JetBrainsMono Nerd Font, Bold 16',
fg = Theme_config.notification.bg, fg = beautiful.colorscheme.bg,
halign = 'right', halign = 'right',
valign = 'center', valign = 'center',
}, },
@@ -213,7 +205,7 @@ naughty.connect_signal('request::display', function(n)
{ {
{ {
widget = wibox.widget.imagebox, 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, resize = true,
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
@@ -226,7 +218,7 @@ naughty.connect_signal('request::display', function(n)
widget = wibox.container.arcchart, widget = wibox.container.arcchart,
id = 'arc', id = 'arc',
}, },
fg = Theme_config.notification.bg_close, fg = beautiful.colorscheme.bg,
bg = color, bg = color,
widget = wibox.container.background, widget = wibox.container.background,
id = 'arc_bg', id = 'arc_bg',
@@ -248,10 +240,8 @@ naughty.connect_signal('request::display', function(n)
}, },
widget = wibox.container.background, widget = wibox.container.background,
bg = color, bg = color,
fg = '#212121', fg = beautiful.colorscheme.bg,
shape = function(cr, width, height) shape = beautiful.shape[8],
gshape.rounded_rect(cr, width, height, dpi(8))
end,
}, },
{ -- Main body { -- Main body
{ -- Image { -- Image
@@ -266,9 +256,7 @@ naughty.connect_signal('request::display', function(n)
widget = naughty.widget.icon, widget = naughty.widget.icon,
}, },
widget = wibox.container.background, widget = wibox.container.background,
shape = function(cr, width, height) shape = beautiful.shape[10],
gshape.rounded_rect(cr, width, height, dpi(10))
end,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
strategy = 'exact', strategy = 'exact',
@@ -293,7 +281,7 @@ naughty.connect_signal('request::display', function(n)
{ -- Spacer { -- Spacer
{ {
widget = wibox.container.background, widget = wibox.container.background,
bg = Theme_config.notification.action_bg, bg = beautiful.colorscheme.bg,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
strategy = 'exact', strategy = 'exact',
@@ -307,12 +295,10 @@ naughty.connect_signal('request::display', function(n)
widget = wibox.container.margin, widget = wibox.container.margin,
margins = dpi(15), margins = dpi(15),
}, },
bg = '#212121', bg = beautiful.colorscheme.bg,
border_color = '#414141', border_color = beautiful.colorscheme.border_color,
border_width = dpi(2), border_width = dpi(2),
shape = function(cr, width, height) shape = beautiful.shape[8],
gshape.rounded_rect(cr, width, height, dpi(8))
end,
widget = wibox.container.background, widget = wibox.container.background,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -388,171 +374,6 @@ naughty.connect_signal('request::display', function(n)
} }
box.buttons = {} box.buttons = {}
n.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 = [[<span foreground="]] ..
Theme_config.notification.bg .. [[" font="JetBrainsMono Nerd Font, Bold 16">]] .. (n.app_name or
'Unknown App') .. [[</span> | <span font="JetBrainsMono Nerd Font, Regular 16">]] .. (n.title or 'System Notification') .. [[</span>]],
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
end) end)
--[[ --[[

View File

@@ -6,6 +6,8 @@
local aclient = require('awful.client') local aclient = require('awful.client')
local aplacement = require('awful.placement') local aplacement = require('awful.placement')
local ascreen = require('awful.screen') local ascreen = require('awful.screen')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
local ruled = require('ruled') local ruled = require('ruled')
local config = require('src.tools.config') local config = require('src.tools.config')
@@ -16,8 +18,8 @@ ruled.client.connect_signal('request::rules', function()
ruled.client.append_rule { ruled.client.append_rule {
rule = {}, rule = {},
properties = { properties = {
border_width = Theme.border_width, border_width = dpi(2),
border_color = Theme.border_normal, border_color = beautiful.colorscheme.border_color,
maximized = false, maximized = false,
maximized_horizontal = false, maximized_horizontal = false,
maximized_vertical = false, maximized_vertical = false,

View File

@@ -7,12 +7,13 @@ local aplacement = require('awful.placement')
local apopup = require('awful.popup') local apopup = require('awful.popup')
local aspawn = require('awful.spawn') local aspawn = require('awful.spawn')
local atooltip = require('awful.tooltip') local atooltip = require('awful.tooltip')
local awidget = require('awful.widget') local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gtable = require('gears.table') local gtable = require('gears.table')
local wibox = require('wibox') local wibox = require('wibox')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local inputwidget = require('src.modules.inputbox')
--Own Libs --Own Libs
local toggle_button = require('awful.widget.toggle_widget') local toggle_button = require('awful.widget.toggle_widget')
@@ -147,11 +148,10 @@ end
--- The second page, with a list of wallpapers to choose from --- The second page, with a list of wallpapers to choose from
function setup:wallpaper_page() function setup:wallpaper_page()
local path_promt = awidget.inputbox { local path_promt = inputwidget {
hint_text = 'Path to image...', text_hint = 'Path to image...',
halign = 'left', mouse_focus = true,
valign = 'center', font = 'JetBrainsMono Nerd Font 12 Regular',
font = 'JetBrainsMono Regular 12',
} }
local widget = wibox.widget { local widget = wibox.widget {
@@ -164,7 +164,7 @@ function setup:wallpaper_page()
image = assets_dir .. 'space.jpg', image = assets_dir .. 'space.jpg',
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
clip_shape = Theme_config.setup.wallpaper.clip_shape, clip_shape = beautiful.shape[12],
id = 'wallpaper', id = 'wallpaper',
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -203,9 +203,9 @@ function setup:wallpaper_page()
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
}, },
widget = wibox.container.background, widget = wibox.container.background,
bg = Theme_config.setup.wallpaper.button_bg, bg = beautiful.colorscheme.bg_yellow,
fg = Theme_config.setup.wallpaper.button_fg, fg = beautiful.colorscheme.bg,
shape = Theme_config.setup.wallpaper.button_shape, shape = beautiful.shape[12],
id = 'choose_image', id = 'choose_image',
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -223,7 +223,7 @@ function setup:wallpaper_page()
nil, nil,
{ -- Text { -- Text
{ {
path_promt, path_promt.widget,
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = dpi(600), width = dpi(600),
height = dpi(50), height = dpi(50),
@@ -242,14 +242,14 @@ function setup:wallpaper_page()
}, },
widget = wibox.container.background, widget = wibox.container.background,
bg = gcolor.transparent, bg = gcolor.transparent,
fg = Theme_config.setup.wallpaper.close_fg, fg = beautiful.colorscheme.bg_red,
}, },
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
}, },
widget = wibox.container.background, widget = wibox.container.background,
bg = Theme_config.setup.wallpaper.path_bg, bg = beautiful.colorscheme.bg1,
fg = Theme_config.setup.wallpaper.path_fg, fg = beautiful.colorscheme.fg,
shape = Theme_config.setup.wallpaper.path_shape, shape = beautiful.shape[12],
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = dpi(600), width = dpi(600),
@@ -309,7 +309,7 @@ local function get_widgets()
for _, widget in pairs(widget_list) do for _, widget in pairs(widget_list) do
local tb = toggle_button { local tb = toggle_button {
size = dpi(30), size = dpi(30),
color = Theme_config.setup.bar.widget_toggle_color, color = beautiful.colorscheme.bg_blue,
} }
local w = wibox.widget { local w = wibox.widget {
@@ -321,17 +321,17 @@ local function get_widgets()
text = widget, text = widget,
halign = 'left', halign = 'left',
valign = 'center', valign = 'center',
font = User_config.font.specify .. ' Regular, 10', font = beautiful.user_config.font,
}, },
widget = wibox.container.margin, widget = wibox.container.margin,
margins = dpi(5), margins = dpi(5),
}, },
widget = wibox.widget.background, widget = wibox.widget.background,
bg = Theme_config.setup.bar.widget_bg, bg = beautiful.colorscheme.bg1,
fg = Theme_config.setup.bar.widget_fg, fg = beautiful.colorscheme.fg,
shape = Theme_config.setup.bar.widget_shape, shape = beautiful.shape[8],
border_color = Theme_config.setup.bar.widget_border_color, border_color = beautiful.colorscheme.bg2,
border_width = Theme_config.setup.bar.widget_border_width, border_width = dpi(2),
}, },
{ {
tb, tb,
@@ -371,9 +371,9 @@ function setup:bar_page()
widget = wibox.widget.checkbox, widget = wibox.widget.checkbox,
checked = true, checked = true,
id = 'topbar_checkbox', id = 'topbar_checkbox',
shape = Theme_config.setup.bar.shape, shape = gshape.circle,
color = Theme_config.setup.bar.color, color = beautiful.colorscheme.bg_green,
padding = Theme_config.setup.bar.padding, padding = dpi(4),
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = 30, width = 30,
@@ -389,7 +389,7 @@ function setup:bar_page()
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
image = '/home/crylia/Downloads/2022-12-08_23-19.png', --icon_dir .. "topbar.svg", image = '/home/crylia/Downloads/2022-12-08_23-19.png', --icon_dir .. "topbar.svg",
resize = true, resize = true,
clip_shape = Theme_config.setup.bar.bar_image_shape, clip_shape = beautiful.shape[4],
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -430,9 +430,9 @@ function setup:bar_page()
margins = dpi(10), margins = dpi(10),
}, },
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.bar.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.bar.border_width, border_width = dpi(2),
shape = Theme_config.setup.bar.bar_shape, shape = beautiful.shape[8],
}, },
{ {
{ {
@@ -457,9 +457,9 @@ function setup:bar_page()
margins = dpi(10), margins = dpi(10),
}, },
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.bar.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.bar.border_width, border_width = dpi(2),
shape = Theme_config.setup.bar.bar_shape, shape = beautiful.shape[8],
}, },
{ {
{ {
@@ -484,9 +484,9 @@ function setup:bar_page()
margins = dpi(10), margins = dpi(10),
}, },
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.bar.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.bar.border_width, border_width = dpi(2),
shape = Theme_config.setup.bar.bar_shape, shape = beautiful.shape[8],
}, },
expand = 'none', expand = 'none',
forced_width = dpi(capi.screen.primary.geometry.width * 0.6) * 0.4, forced_width = dpi(capi.screen.primary.geometry.width * 0.6) * 0.4,
@@ -538,9 +538,9 @@ function setup:bar_page()
margins = dpi(10), margins = dpi(10),
}, },
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.bar.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.bar.border_width, border_width = dpi(2),
shape = Theme_config.setup.bar.bar_shape, shape = beautiful.shape[8],
}, },
{ {
{ {
@@ -565,9 +565,9 @@ function setup:bar_page()
margins = dpi(10), margins = dpi(10),
}, },
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.bar.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.bar.border_width, border_width = dpi(2),
shape = Theme_config.setup.bar.bar_shape, shape = beautiful.shape[8],
}, },
{ {
{ {
@@ -592,9 +592,9 @@ function setup:bar_page()
margins = dpi(10), margins = dpi(10),
}, },
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.bar.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.bar.border_width, border_width = dpi(2),
shape = Theme_config.setup.bar.bar_shape, shape = beautiful.shape[8],
}, },
expand = 'none', expand = 'none',
forced_width = dpi(capi.screen.primary.geometry.width * 0.6) * 0.4, forced_width = dpi(capi.screen.primary.geometry.width * 0.6) * 0.4,
@@ -616,9 +616,9 @@ function setup:bar_page()
widget = wibox.widget.checkbox, widget = wibox.widget.checkbox,
checked = false, checked = false,
id = 'bottombar_checkbox', id = 'bottombar_checkbox',
shape = Theme_config.setup.bar.shape, shape = gshape.circle,
color = Theme_config.setup.bar.color, color = beautiful.colorscheme.bg_green,
padding = Theme_config.setup.bar.padding, padding = dpi(4),
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = 30, width = 30,
@@ -634,7 +634,7 @@ function setup:bar_page()
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
image = '/home/crylia/Downloads/2022-12-08_23-19.png', --icon_dir .. "topbar.svg", image = '/home/crylia/Downloads/2022-12-08_23-19.png', --icon_dir .. "topbar.svg",
resize = true, resize = true,
clip_shape = Theme_config.setup.bar.bar_image_shape, clip_shape = beautiful.shape[4],
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -664,7 +664,7 @@ function setup:bar_page()
}, },
{ {
widget = wibox.container.background, widget = wibox.container.background,
bg = gcolor('#212121BB'), bg = beautiful.colorscheme.bg .. 'BB',
id = 'bottom_overlay', id = 'bottom_overlay',
}, },
layout = wibox.layout.stack, layout = wibox.layout.stack,
@@ -687,9 +687,9 @@ function setup:bar_page()
bottom_checkbox.checked = not top_checkbox.checked bottom_checkbox.checked = not top_checkbox.checked
if top_checkbox.checked then if top_checkbox.checked then
top_overlay.bg = gcolor.transparent top_overlay.bg = gcolor.transparent
bottom_overlay.bg = gcolor('#212121BB') bottom_overlay.bg = beautiful.colorscheme.bg .. 'BB'
else else
top_overlay.bg = gcolor('#212121BB') top_overlay.bg = beautiful.colorscheme.bg .. 'BB'
bottom_overlay.bg = gcolor.transparent bottom_overlay.bg = gcolor.transparent
end end
end end
@@ -701,11 +701,11 @@ function setup:bar_page()
bottom_checkbox.checked = not bottom_checkbox.checked bottom_checkbox.checked = not bottom_checkbox.checked
top_checkbox.checked = not bottom_checkbox.checked top_checkbox.checked = not bottom_checkbox.checked
if bottom_checkbox.checked then if bottom_checkbox.checked then
top_overlay.bg = gcolor('#212121BB') top_overlay.bg = beautiful.colorscheme.bg .. 'BB'
bottom_overlay.bg = gcolor.transparent bottom_overlay.bg = gcolor.transparent
else else
top_overlay.bg = gcolor.transparent top_overlay.bg = gcolor.transparent
bottom_overlay.bg = gcolor('#212121BB') bottom_overlay.bg = beautiful.colorscheme.bg .. 'BB'
end end
end end
) )
@@ -733,7 +733,7 @@ local function get_status_bars()
for i, widget in pairs(statusbar_list) do for i, widget in pairs(statusbar_list) do
local tb = toggle_button { local tb = toggle_button {
size = dpi(30), size = dpi(30),
color = Theme_config.setup.bar.widget_toggle_color, color = beautiful.colorscheme.bg_blue,
} }
local w = wibox.widget { local w = wibox.widget {
@@ -744,7 +744,7 @@ local function get_status_bars()
text = widget, text = widget,
halign = 'left', halign = 'left',
valign = 'center', valign = 'center',
font = User_config.font.specify .. ' Regular, 14', font = beautiful.user_config.font .. ' Regular, 14',
}, },
widget = wibox.container.margin, widget = wibox.container.margin,
margins = dpi(5), margins = dpi(5),
@@ -770,15 +770,15 @@ end
--- The fourth page, to customize the notification center --- The fourth page, to customize the notification center
function setup:notification_page() function setup:notification_page()
local secrets = { local secrets = {
api_key = awidget.inputbox { api_key = inputwidget {
hint_text = 'API Key...', text_hint = 'API Key...',
valign = 'center', font = 'JetBrainsMono Nerd Font 12 Regular',
halign = 'left', mouse_focus = true,
}, },
city_id = awidget.inputbox { city_id = inputwidget {
hint_text = 'City ID...', text_hint = 'City ID...',
valign = 'center', font = 'JetBrainsMono Nerd Font 12 Regular',
halign = 'left', mouse_focus = true,
}, },
} }
@@ -788,7 +788,7 @@ function setup:notification_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'Notification Center Setup', text = 'Notification Center Setup',
font = User_config.font.specify .. ' Regular, 24', font = beautiful.user_config.font .. ' Regular 24',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -801,7 +801,7 @@ function setup:notification_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'Status bars', text = 'Status bars',
font = User_config.font.specify .. ' Regular, 16', font = beautiful.user_config.font .. ' Regular 16',
halign = 'center', halign = 'center',
}, },
widget = wibox.container.margin, widget = wibox.container.margin,
@@ -834,7 +834,7 @@ function setup:notification_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'OpenWeatherMap API', text = 'OpenWeatherMap API',
font = User_config.font.specify .. ' Regular, 16', font = beautiful.user_config.font .. ' Regular 16',
halign = 'center', halign = 'center',
}, },
widget = wibox.container.margin, widget = wibox.container.margin,
@@ -860,7 +860,7 @@ function setup:notification_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'API Key', text = 'API Key',
font = User_config.font.specify .. ' Regular, 16', font = beautiful.user_config.font .. ' Regular 16',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -869,7 +869,7 @@ function setup:notification_page()
}, },
{ {
{ {
secrets.api_key, secrets.api_key.widget,
widget = wibox.container.margin, widget = wibox.container.margin,
left = dpi(10), left = dpi(10),
}, },
@@ -877,9 +877,9 @@ function setup:notification_page()
forced_height = dpi(50), forced_height = dpi(50),
forced_width = dpi(400), forced_width = dpi(400),
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.notification.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.notification.border_width, border_width = dpi(2),
shape = Theme_config.setup.notification.shape, shape = beautiful.shape[4],
}, },
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
}, },
@@ -888,7 +888,7 @@ function setup:notification_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'City ID', text = 'City ID',
font = User_config.font.specify .. ' Regular, 16', font = beautiful.user_config.font .. ' Regular 16',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -897,7 +897,7 @@ function setup:notification_page()
}, },
{ {
{ {
secrets.city_id, secrets.city_id.widget,
widget = wibox.container.margin, widget = wibox.container.margin,
left = dpi(10), left = dpi(10),
}, },
@@ -905,9 +905,9 @@ function setup:notification_page()
forced_height = dpi(50), forced_height = dpi(50),
forced_width = dpi(400), forced_width = dpi(400),
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.notification.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.notification.border_width, border_width = dpi(2),
shape = Theme_config.setup.notification.shape, shape = beautiful.shape[4],
}, },
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
}, },
@@ -921,9 +921,9 @@ function setup:notification_page()
{ {
widget = wibox.widget.checkbox, widget = wibox.widget.checkbox,
checked = true, checked = true,
color = Theme_config.setup.notification.checkbox_color, color = beautiful.colorscheme.green,
paddings = Theme_config.setup.notification.checkbox_paddings, paddings = dpi(4),
shape = Theme_config.setup.notification.checkbox_shape, shape = gshape.circle,
id = 'celsius_selector', id = 'celsius_selector',
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -937,7 +937,7 @@ function setup:notification_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'Celsius °C', text = 'Celsius °C',
font = User_config.font.specify .. ' Regular, 14', font = beautiful.user_config.font .. ' Regular 14',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -950,9 +950,9 @@ function setup:notification_page()
{ {
widget = wibox.widget.checkbox, widget = wibox.widget.checkbox,
checked = false, checked = false,
color = Theme_config.setup.notification.checkbox_color, color = beautiful.colorscheme.green,
paddings = Theme_config.setup.notification.checkbox_paddings, paddings = dpi(4),
shape = Theme_config.setup.notification.checkbox_shape, shape = gshape.circle,
id = 'Fahrenheit_selector', id = 'Fahrenheit_selector',
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -966,7 +966,7 @@ function setup:notification_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'Fahrenheit °F', text = 'Fahrenheit °F',
font = User_config.font.specify .. ' Regular, 14', font = beautiful.user_config.font .. ' Regular 14',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -986,7 +986,7 @@ function setup:notification_page()
layout = wibox.layout.align.vertical, layout = wibox.layout.align.vertical,
}, },
spacing_widget = wibox.widget.separator { spacing_widget = wibox.widget.separator {
color = Theme_config.setup.notification.separator_color, color = beautiful.colorscheme.bg1,
}, },
spacing = dpi(5), spacing = dpi(5),
layout = wibox.layout.flex.horizontal, layout = wibox.layout.flex.horizontal,
@@ -1072,14 +1072,14 @@ end
--- The fifth page, to customize the default programs --- The fifth page, to customize the default programs
function setup:programs_page() function setup:programs_page()
local applications = { local applications = {
power_manager = awidget.inputbox { hint_text = 'e.g. xfce4-power-manager-settings' }, power_manager = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. xfce4-power-manager-settings' },
web_browser = awidget.inputbox { hint_text = 'e.g. firefox' }, web_browser = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. firefox' },
terminal = awidget.inputbox { hint_text = 'e.g. kitty' }, terminal = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. kitty' },
text_editor = awidget.inputbox { hint_text = 'e.g. code' }, text_editor = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. code' },
music_player = awidget.inputbox { hint_text = 'e.g. flatpak run com.spotify.Client' }, music_player = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. flatpak run com.spotify.Client' },
gtk_settings = awidget.inputbox { hint_text = 'e.g. lxappearance' }, gtk_settings = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. lxappearance' },
file_manager = awidget.inputbox { hint_text = 'e.g. nautilus' }, file_manager = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. nautilus' },
screen_manager = awidget.inputbox { hint_text = 'e.g. arandr' }, screen_manager = inputwidget { mouse_focus = true, font = 'JetBrainsMono Nerd Font 12 Regular', hint_text = 'e.g. arandr' },
} }
local widget = wibox.widget { local widget = wibox.widget {
@@ -1088,7 +1088,7 @@ function setup:programs_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'Default Applications', text = 'Default Applications',
font = User_config.font.specify .. ' Regular, 24', font = beautiful.user_config.font .. ' Regular 24',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -1103,7 +1103,7 @@ function setup:programs_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'Power Manager', text = 'Power Manager',
font = User_config.font.specify .. ' Regular, 14', font = beautiful.user_config.font .. ' Regular 14',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -1113,7 +1113,7 @@ function setup:programs_page()
nil, nil,
{ {
{ {
applications.power_manager, applications.power_manager.widget,
widget = wibox.container.margin, widget = wibox.container.margin,
left = dpi(10), left = dpi(10),
}, },
@@ -1121,9 +1121,9 @@ function setup:programs_page()
forced_height = dpi(50), forced_height = dpi(50),
forced_width = dpi(350), forced_width = dpi(350),
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.notification.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.notification.border_width, border_width = dpi(2),
shape = Theme_config.setup.notification.shape, shape = beautiful.shape[4],
}, },
expand = 'none', expand = 'none',
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
@@ -1133,7 +1133,7 @@ function setup:programs_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'Web Browser', text = 'Web Browser',
font = User_config.font.specify .. ' Regular, 14', font = beautiful.user_config.font .. ' Regular 14',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -1143,7 +1143,7 @@ function setup:programs_page()
nil, nil,
{ {
{ {
applications.web_browser, applications.web_browser.widget,
widget = wibox.container.margin, widget = wibox.container.margin,
left = dpi(10), left = dpi(10),
}, },
@@ -1151,9 +1151,9 @@ function setup:programs_page()
forced_height = dpi(50), forced_height = dpi(50),
forced_width = dpi(350), forced_width = dpi(350),
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.notification.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.notification.border_width, border_width = dpi(2),
shape = Theme_config.setup.notification.shape, shape = beautiful.shape[4],
}, },
expand = 'none', expand = 'none',
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
@@ -1163,7 +1163,7 @@ function setup:programs_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'Terminal', text = 'Terminal',
font = User_config.font.specify .. ' Regular, 14', font = beautiful.user_config.font .. ' Regular 14',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -1173,7 +1173,7 @@ function setup:programs_page()
nil, nil,
{ {
{ {
applications.terminal, applications.terminal.widget,
widget = wibox.container.margin, widget = wibox.container.margin,
left = dpi(10), left = dpi(10),
}, },
@@ -1181,9 +1181,9 @@ function setup:programs_page()
forced_height = dpi(50), forced_height = dpi(50),
forced_width = dpi(350), forced_width = dpi(350),
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.notification.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.notification.border_width, border_width = dpi(2),
shape = Theme_config.setup.notification.shape, shape = beautiful.shape[4],
}, },
expand = 'none', expand = 'none',
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
@@ -1193,7 +1193,7 @@ function setup:programs_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'Text Editor', text = 'Text Editor',
font = User_config.font.specify .. ' Regular, 14', font = beautiful.user_config.font .. ' Regular 14',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -1203,7 +1203,7 @@ function setup:programs_page()
nil, nil,
{ {
{ {
applications.text_editor, applications.text_editor.widget,
widget = wibox.container.margin, widget = wibox.container.margin,
left = dpi(10), left = dpi(10),
}, },
@@ -1211,9 +1211,9 @@ function setup:programs_page()
forced_height = dpi(50), forced_height = dpi(50),
forced_width = dpi(350), forced_width = dpi(350),
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.notification.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.notification.border_width, border_width = dpi(2),
shape = Theme_config.setup.notification.shape, shape = beautiful.shape[4],
}, },
expand = 'none', expand = 'none',
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
@@ -1232,7 +1232,7 @@ function setup:programs_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'Music Player', text = 'Music Player',
font = User_config.font.specify .. ' Regular, 14', font = beautiful.user_config.font .. ' Regular 14',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -1242,7 +1242,7 @@ function setup:programs_page()
nil, nil,
{ {
{ {
applications.music_player, applications.music_player.widget,
widget = wibox.container.margin, widget = wibox.container.margin,
left = dpi(10), left = dpi(10),
}, },
@@ -1250,9 +1250,9 @@ function setup:programs_page()
forced_height = dpi(50), forced_height = dpi(50),
forced_width = dpi(350), forced_width = dpi(350),
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.notification.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.notification.border_width, border_width = dpi(2),
shape = Theme_config.setup.notification.shape, shape = beautiful.shape[4],
}, },
expand = 'none', expand = 'none',
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
@@ -1262,7 +1262,7 @@ function setup:programs_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'GTK Settings', text = 'GTK Settings',
font = User_config.font.specify .. ' Regular, 14', font = beautiful.user_config.font .. ' Regular 14',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -1272,7 +1272,7 @@ function setup:programs_page()
nil, nil,
{ {
{ {
applications.gtk_settings, applications.gtk_settings.widget,
widget = wibox.container.margin, widget = wibox.container.margin,
left = dpi(10), left = dpi(10),
}, },
@@ -1280,9 +1280,9 @@ function setup:programs_page()
forced_height = dpi(50), forced_height = dpi(50),
forced_width = dpi(350), forced_width = dpi(350),
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.notification.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.notification.border_width, border_width = dpi(2),
shape = Theme_config.setup.notification.shape, shape = beautiful.shape[4],
}, },
expand = 'none', expand = 'none',
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
@@ -1292,7 +1292,7 @@ function setup:programs_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'File Manager', text = 'File Manager',
font = User_config.font.specify .. ' Regular, 14', font = beautiful.user_config.font .. ' Regular 14',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -1302,7 +1302,7 @@ function setup:programs_page()
nil, nil,
{ {
{ {
applications.file_manager, applications.file_manager.widget,
widget = wibox.container.margin, widget = wibox.container.margin,
left = dpi(10), left = dpi(10),
}, },
@@ -1310,9 +1310,9 @@ function setup:programs_page()
forced_height = dpi(50), forced_height = dpi(50),
forced_width = dpi(350), forced_width = dpi(350),
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.notification.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.notification.border_width, border_width = dpi(2),
shape = Theme_config.setup.notification.shape, shape = beautiful.shape[4],
}, },
expand = 'none', expand = 'none',
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
@@ -1322,7 +1322,7 @@ function setup:programs_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'Screen Manager', text = 'Screen Manager',
font = User_config.font.specify .. ' Regular, 14', font = beautiful.user_config.font .. ' Regular 14',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -1332,7 +1332,7 @@ function setup:programs_page()
nil, nil,
{ {
{ {
applications.screen_manager, applications.screen_manager.widget,
widget = wibox.container.margin, widget = wibox.container.margin,
left = dpi(10), left = dpi(10),
}, },
@@ -1340,9 +1340,9 @@ function setup:programs_page()
forced_height = dpi(50), forced_height = dpi(50),
forced_width = dpi(350), forced_width = dpi(350),
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.notification.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.notification.border_width, border_width = dpi(2),
shape = Theme_config.setup.notification.shape, shape = beautiful.shape[4],
}, },
expand = 'none', expand = 'none',
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
@@ -1455,22 +1455,22 @@ end
local function get_layouts() local function get_layouts()
local layouts = { local layouts = {
['cornerne'] = Theme.layout_cornerne, ['cornerne'] = beautiful.theme.layout_cornerne,
['cornernw'] = Theme.layout_cornernw, ['cornernw'] = beautiful.theme.layout_cornernw,
['cornerse'] = Theme.layout_cornerse, ['cornerse'] = beautiful.theme.layout_cornerse,
['cornersw'] = Theme.layout_cornersw, ['cornersw'] = beautiful.theme.layout_cornersw,
['dwindle'] = Theme.layout_dwindle, ['dwindle'] = beautiful.theme.layout_dwindle,
['fairh'] = Theme.layout_fairh, ['fairh'] = beautiful.theme.layout_fairh,
['fairv'] = Theme.layout_fairv, ['fairv'] = beautiful.theme.layout_fairv,
['floating'] = Theme.layout_floating, ['floating'] = beautiful.theme.layout_floating,
['fullscreen'] = Theme.layout_fullscreen, ['fullscreen'] = beautiful.theme.layout_fullscreen,
['magnifier'] = Theme.layout_magnifier, ['magnifier'] = beautiful.theme.layout_magnifier,
['max'] = Theme.layout_max, ['max'] = beautiful.theme.layout_max,
['spiral'] = Theme.layout_spiral, ['spiral'] = beautiful.theme.layout_spiral,
['tile bottom'] = Theme.layout_cornerse, ['tile bottom'] = beautiful.theme.layout_cornerse,
['tile left'] = Theme.layout_cornernw, ['tile left'] = beautiful.theme.layout_cornernw,
['tile top'] = Theme.layout_cornersw, ['tile top'] = beautiful.theme.layout_cornersw,
['tile'] = Theme.layout_cornerne, ['tile'] = beautiful.theme.layout_cornerne,
} }
local list = {} local list = {}
@@ -1493,27 +1493,27 @@ local function get_layouts()
margins = dpi(10), margins = dpi(10),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.setup.layout.bg, bg = beautiful.colorscheme.bg_red,
shape = Theme_config.setup.layout.shape, shape = beautiful.shape[8],
widget = wibox.container.background, widget = wibox.container.background,
}, },
margins = dpi(10), margins = dpi(10),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
widget = wibox.container.background, widget = wibox.container.background,
border_color = Theme_config.setup.layout.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.layout.border_width, border_width = dpi(2),
shape = Theme_config.setup.layout.shape, shape = beautiful.shape[8],
selected = false, selected = false,
} }
w:buttons(gtable.join { w:buttons(gtable.join {
abutton({}, 1, function() abutton({}, 1, function()
if w.selected then if w.selected then
w.border_color = Theme_config.setup.layout.border_color w.border_color = beautiful.colorscheme.bg1
w.selected = false w.selected = false
else else
w.border_color = Theme_config.setup.layout.border_color_selected w.border_color = beautiful.colorscheme.bg_red
w.selected = true w.selected = true
end end
end), end),
@@ -1546,7 +1546,7 @@ function setup:layouts_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'Layouts', text = 'Layouts',
font = User_config.font.specify .. ' Regular, 24', font = beautiful.user_config.font .. ' Regular, 24',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -1614,7 +1614,7 @@ function setup:titlebar_page()
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = 'Layouts', text = 'Layouts',
font = User_config.font.specify .. ' Regular, 24', font = beautiful.user_config.font .. ' Regular, 24',
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -1631,9 +1631,9 @@ function setup:titlebar_page()
widget = wibox.widget.checkbox, widget = wibox.widget.checkbox,
checked = true, checked = true,
id = 'top_tb_radio', id = 'top_tb_radio',
shape = Theme_config.setup.titlebar.checkbox_shape, shape = gshape.circle,
color = Theme_config.setup.titlebar.checkbox_color, color = beautiful.colorscheme.bg_teal,
paddings = Theme_config.setup.titlebar.checkbox_padding, paddings = dpi(4),
}, },
width = dpi(45), width = dpi(45),
height = dpi(45), height = dpi(45),
@@ -1667,9 +1667,9 @@ function setup:titlebar_page()
widget = wibox.widget.checkbox, widget = wibox.widget.checkbox,
checked = false, checked = false,
id = 'left_tb_radio', id = 'left_tb_radio',
shape = Theme_config.setup.titlebar.checkbox_shape, shape = gshape.circle,
color = Theme_config.setup.titlebar.checkbox_color, color = beautiful.colorscheme.bg_teal,
paddings = Theme_config.setup.titlebar.checkbox_padding, paddings = dpi(4),
}, },
width = dpi(45), width = dpi(45),
height = dpi(45), height = dpi(45),
@@ -1716,7 +1716,7 @@ function setup:titlebar_page()
layout = wibox.layout.flex.vertical, layout = wibox.layout.flex.vertical,
}, },
spacing_widget = wibox.widget.separator { spacing_widget = wibox.widget.separator {
color = Theme_config.setup.titlebar.seperator_color, color = beautiful.colorscheme.bg1,
}, },
spacing = dpi(5), spacing = dpi(5),
layout = wibox.layout.flex.horizontal, layout = wibox.layout.flex.horizontal,
@@ -1805,7 +1805,7 @@ function setup.new(args)
}, },
widget = wibox.container.background, widget = wibox.container.background,
id = 'page_left', id = 'page_left',
bg = Theme_config.setup.bg .. '88', bg = beautiful.colorscheme.bg .. '88',
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = dpi(64), width = dpi(64),
@@ -1826,7 +1826,7 @@ function setup.new(args)
}, },
widget = wibox.container.background, widget = wibox.container.background,
id = 'page_right', id = 'page_right',
bg = Theme_config.setup.bg .. '88', bg = beautiful.colorscheme.bg .. '88',
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = dpi(64), width = dpi(64),
@@ -1858,9 +1858,9 @@ function setup.new(args)
strategy = 'exact', strategy = 'exact',
}, },
screen = screen, screen = screen,
bg = Theme_config.setup.bg, bg = beautiful.colorscheme.bg,
border_color = Theme_config.setup.border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.setup.border_width, border_width = dpi(2),
placement = aplacement.centered, placement = aplacement.centered,
ontop = false, -- !CHANGE THIS TO TRUE WHEN DONE TESTING! ontop = false, -- !CHANGE THIS TO TRUE WHEN DONE TESTING!
visible = true, visible = true,

View File

@@ -4,6 +4,7 @@ local math = math
local abutton = require('awful.button') local abutton = require('awful.button')
local atitlebar = require('awful.titlebar') local atitlebar = require('awful.titlebar')
local atooltip = require('awful.tooltip') local atooltip = require('awful.tooltip')
local beautiful = require('beautiful')
local cairo = require('lgi').cairo local cairo = require('lgi').cairo
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color') local gcolor = require('gears.color')
@@ -26,7 +27,7 @@ local instance = nil
local titlebar = {} local titlebar = {}
local titlebar_position = User_config.titlebar_position local titlebar_position = beautiful.user_config.titlebar_position
-- Converts the given hex color to hsv -- Converts the given hex color to hsv
local function hex2hsv(color) local function hex2hsv(color)
@@ -229,12 +230,12 @@ end
local function create_button_image(name, is_focused, event, is_on) local function create_button_image(name, is_focused, event, is_on)
titlebar.key = titlebar.key or {} titlebar.key = titlebar.key or {}
titlebar.key.close_color = Theme_config.titlebar.close titlebar.key.close_color = beautiful.colorscheme.bg_red
titlebar.key.minimize_color = Theme_config.titlebar.minimize titlebar.key.minimize_color = beautiful.colorscheme.bg_yellow
titlebar.key.maximize_color = Theme_config.titlebar.maximize titlebar.key.maximize_color = beautiful.colorscheme.bg_green
titlebar.key.floating_color = Theme_config.titlebar.floating titlebar.key.floating_color = beautiful.colorscheme.bg_purple
titlebar.key.ontop_color = Theme_config.titlebar.ontop titlebar.key.ontop_color = beautiful.colorscheme.bg_purple
titlebar.key.sticky_color = Theme_config.titlebar.sticky titlebar.key.sticky_color = beautiful.colorscheme.bg_purple
local focus_state = is_focused and 'focused' or 'unfocused' local focus_state = is_focused and 'focused' or 'unfocused'
local key_img 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 (event == 'press') and darken(button_color, 25) or button_color
titlebar.key[key_color] = button_color titlebar.key[key_color] = button_color
end 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 surface = cairo.ImageSurface.create('ARGB32', button_size, button_size)
local cr = cairo.Context.create(surface) local cr = cairo.Context.create(surface)
cr:arc(button_size / 2, button_size / 2, button_size / 2, math.rad(0), math.rad(360)) 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.antialias = cairo.Antialias.BEST
cr:fill() cr:fill()
titlebar.key[key_img] = surface titlebar.key[key_img] = surface
@@ -332,8 +333,8 @@ local function create_titlebar_button(c, name, button_callback, property)
{ {
button_img, button_img,
widget = wibox.container.constraint, widget = wibox.container.constraint,
height = Theme_config.titlebar.button_size, height = dpi(18),
width = Theme_config.titlebar.button_size, width = dpi(18),
strategy = 'exact', strategy = 'exact',
}, },
widget = wibox.container.margin, widget = wibox.container.margin,
@@ -387,8 +388,8 @@ local function create_titlebar_title(c)
local function update() local function update()
title_widget.markup = ("<span foreground='%s'>%s</span>"):format( title_widget.markup = ("<span foreground='%s'>%s</span>"):format(
(((relative_luminance('#fefefa') + 0.05) / (relative_luminance(c.color) + 0.05)) >= 7 and true) (((relative_luminance(beautiful.colorscheme.fg) + 0.05) / (relative_luminance(c.color) + 0.05)) >= 7 and true)
and '#fefefa' or '#242424', c.name) and beautiful.colorscheme.fg or beautiful.colorscheme.bg, c.name)
end end
c:connect_signal('property::name', update) c:connect_signal('property::name', update)
@@ -400,7 +401,7 @@ local function create_titlebar_title(c)
return { return {
title_widget, title_widget,
widget = wibox.container.margin, widget = wibox.container.margin,
margins = Theme_config.titlebar.title_margin, margins = dpi(5),
} }
end end
@@ -501,23 +502,23 @@ end
function add_titlebar(c) function add_titlebar(c)
if titlebar_position == 'top' then if titlebar_position == 'top' then
atitlebar(c, { atitlebar(c, {
size = Theme_config.titlebar.size, size = dpi(38),
bg = gcolor.transparent, bg = gcolor.transparent,
position = 'top', position = 'top',
}):setup { }):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, widget = wibox.container.margin,
left = dpi(5), 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), buttons = get_titlebar_mouse_bindings(c),
layout = wibox.layout.flex.horizontal, 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, widget = wibox.container.margin,
right = dpi(5), right = dpi(5),
}, },
@@ -527,30 +528,30 @@ function add_titlebar(c)
bg = duotone_gradient_vertical( bg = duotone_gradient_vertical(
lighten(c.color, 1), lighten(c.color, 1),
c.color, c.color,
Theme_config.titlebar.size, dpi(38),
0, 0,
0.5 0.5
), ),
} }
elseif titlebar_position == 'left' then elseif titlebar_position == 'left' then
atitlebar(c, { atitlebar(c, {
size = Theme_config.titlebar.size, size = dpi(38),
bg = gcolor.transparent, bg = gcolor.transparent,
position = 'left', position = 'left',
}):setup { }):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, widget = wibox.container.margin,
top = dpi(5), 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), buttons = get_titlebar_mouse_bindings(c),
layout = wibox.layout.flex.vertical, 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, widget = wibox.container.margin,
left = dpi(5), left = dpi(5),
}, },
@@ -560,7 +561,7 @@ function add_titlebar(c)
bg = duotone_gradient_horizontal( bg = duotone_gradient_horizontal(
lighten(c.color, 1), lighten(c.color, 1),
c.color, c.color,
Theme_config.titlebar.size, dpi(38),
0, 0,
0.5 0.5
), ),
@@ -608,7 +609,7 @@ if not instance then
c.color = color c.color = color
add_titlebar(c) add_titlebar(c)
else else
c.color = Theme_config.titlebar.color c.color = beautiful.colorscheme.bg
add_titlebar(c) add_titlebar(c)
c:connect_signal('request::activate', c._cb_add_window_decorations) c:connect_signal('request::activate', c._cb_add_window_decorations)
end end

View File

@@ -6,6 +6,7 @@
local abutton = require('awful.button') local abutton = require('awful.button')
local aspawn = require('awful.spawn') local aspawn = require('awful.spawn')
local base = require('wibox.widget.base') local base = require('wibox.widget.base')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gfilesystem = require('gears').filesystem local gfilesystem = require('gears').filesystem
@@ -13,14 +14,12 @@ local Gio = require('lgi').Gio
local gtable = require('gears.table') local gtable = require('gears.table')
local wibox = require('wibox') 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 libs
local config = require('src.tools.config') local config = require('src.tools.config')
local hover = require('src.tools.hover') 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 = { local capi = {
awesome = awesome, awesome = awesome,
@@ -132,8 +131,8 @@ local function get_applications_from_file()
{ -- Icon { -- Icon
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
image = Get_gicon_path(app_info.get_icon(app)) or image = icon_lookup:get_gicon_path(app_info.get_icon(app)) or
Get_gicon_path(app_info.get_icon(app), icon_lookup:get_gicon_path(app_info.get_icon(app),
Gio.DesktopAppInfo.get_string(desktop_app_info, 'X-AppImage-Old-Icon')) or '', Gio.DesktopAppInfo.get_string(desktop_app_info, 'X-AppImage-Old-Icon')) or '',
resize = true, resize = true,
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
@@ -173,11 +172,11 @@ local function get_applications_from_file()
terminal = Gio.DesktopAppInfo.get_string(desktop_app_info, 'Terminal') == 'true', terminal = Gio.DesktopAppInfo.get_string(desktop_app_info, 'Terminal') == 'true',
actions = Gio.DesktopAppInfo.list_actions(desktop_app_info), actions = Gio.DesktopAppInfo.list_actions(desktop_app_info),
desktop_file = Gio.DesktopAppInfo.get_filename(desktop_app_info) or '', desktop_file = Gio.DesktopAppInfo.get_filename(desktop_app_info) or '',
border_color = Theme_config.application_launcher.application.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.application_launcher.application.border_width, border_width = dpi(2),
bg = Theme_config.application_launcher.application.bg, bg = beautiful.colorscheme.bg1,
fg = Theme_config.application_launcher.application.fg, fg = beautiful.colorscheme.fg,
shape = Theme_config.application_launcher.application.shape, shape = beautiful.shape[4],
widget = wibox.container.background, widget = wibox.container.background,
} }
local context_menu = cm { local context_menu = cm {
@@ -215,7 +214,7 @@ local function get_applications_from_file()
{ {
name = 'Execute as sudo', name = 'Execute as sudo',
icon = gcolor.recolor_image(icondir .. 'launch.svg', icon = gcolor.recolor_image(icondir .. 'launch.svg',
Theme_config.application_launcher.application.cm_icon_color), beautiful.colorscheme.bg_purple),
callback = function() callback = function()
capi.awesome.emit_signal('application_launcher::show') capi.awesome.emit_signal('application_launcher::show')
aspawn('/home/crylia/.config/awesome/src/scripts/start_as_admin.sh ' .. app_widget.exec) 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', name = 'Pin to dock',
icon = gcolor.recolor_image(icondir .. 'pin.svg', icon = gcolor.recolor_image(icondir .. 'pin.svg',
Theme_config.application_launcher.application.cm_icon_color), beautiful.colorscheme.bg_purple),
callback = function() callback = function()
-- Open dock.js and read all its content into a table, add the new app into the table and write it back -- 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) --[[ async.read_json(gfilesystem.get_configuration_dir() .. 'src/config/dock.json', function(data)
table.insert(data, { table.insert(data, {
name = app_widget.name or '', name = app_widget.name or '',
icon = Get_gicon_path(app_info.get_icon(app)) or icon = icon_lookup.get_gicon_path(app_info.get_icon(app)) or
Get_gicon_path(app_info.get_icon(app), icon_lookup.get_gicon_path(app_info.get_icon(app),
Gio.DesktopAppInfo.get_string(desktop_app_info, 'X-AppImage-Old-Icon')) or '', Gio.DesktopAppInfo.get_string(desktop_app_info, 'X-AppImage-Old-Icon')) or '',
comment = app_widget.comment or '', comment = app_widget.comment or '',
exec = app_widget.exec or '', exec = app_widget.exec or '',
@@ -254,12 +253,12 @@ local function get_applications_from_file()
{ {
name = 'Add to desktop', name = 'Add to desktop',
icon = gcolor.recolor_image(icondir .. 'desktop.svg', icon = gcolor.recolor_image(icondir .. 'desktop.svg',
Theme_config.application_launcher.application.cm_icon_color), beautiful.colorscheme.bg_purple),
callback = function() callback = function()
capi.awesome.emit_signal('application_launcher::show') capi.awesome.emit_signal('application_launcher::show')
capi.awesome.emit_signal('desktop::add_to_desktop', { capi.awesome.emit_signal('desktop::add_to_desktop', {
label = app_info.get_name(app), 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'), exec = Gio.DesktopAppInfo.get_string(desktop_app_info, 'Exec'),
desktop_file = Gio.DesktopAppInfo.get_filename(desktop_app_info) or '', desktop_file = Gio.DesktopAppInfo.get_filename(desktop_app_info) or '',
}) })
@@ -372,9 +371,9 @@ function application_grid:set_applications(search_filter)
'update::selected', 'update::selected',
function() function()
if self._private.curser.y == pos.row and self._private.curser.x == pos.col then 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 else
app.border_color = Theme_config.application_launcher.application.border_color app.border_color = beautiful.colorscheme.bg1
end end
end end
) )

View File

@@ -8,12 +8,15 @@ local akeygrabber = require('awful.keygrabber')
local aplacement = require('awful.placement') local aplacement = require('awful.placement')
local apopup = require('awful.popup') local apopup = require('awful.popup')
local awidget = require('awful.widget') local awidget = require('awful.widget')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears.table') local gtable = require('gears.table')
local wibox = require('wibox') local wibox = require('wibox')
local gtimer = require('gears.timer')
-- Own libs -- Own libs
local app_grid = require('src.modules.application_launcher.application') local app_grid = require('src.modules.application_launcher.application')
local input = require('src.modules.inputbox')
local capi = { local capi = {
awesome = awesome, awesome = awesome,
@@ -29,10 +32,11 @@ function application_launcher.new(args)
args = args or {} args = args or {}
-- Create a new inputbox -- Create a new inputbox
local searchbar = awidget.inputbox { local searchbar = input {
hint_text = 'Search...', text_hint = 'Search...',
valign = 'center', mouse_focus = true,
halign = 'left', fg = beautiful.colorscheme.fg,
password_mode = true,
} }
-- Application launcher popup -- Application launcher popup
local application_container = apopup { 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, widget = wibox.container.margin,
margins = 5, margins = 5,
}, },
@@ -51,11 +60,11 @@ function application_launcher.new(args)
height = dpi(50), height = dpi(50),
}, },
widget = wibox.container.background, widget = wibox.container.background,
bg = Theme_config.application_launcher.searchbar.bg, bg = beautiful.colorscheme.bg,
fg = Theme_config.application_launcher.searchbar.fg, fg = beautiful.colorscheme.fg,
border_color = Theme_config.application_launcher.searchbar.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.application_launcher.searchbar.border_width, border_width = dpi(2),
shape = Theme_config.application_launcher.searchbar.shape, shape = beautiful.shape[4],
id = 'searchbar_bg', id = 'searchbar_bg',
}, },
{ {
@@ -79,19 +88,19 @@ function application_launcher.new(args)
stretch = false, stretch = false,
screen = args.screen, screen = args.screen,
placement = aplacement.centered, placement = aplacement.centered,
bg = Theme_config.application_launcher.bg, bg = beautiful.colorscheme.bg,
border_color = Theme_config.application_launcher.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.application_launcher.border_width, 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 gtable.crush(application_container, application_launcher, true)
searchbar:buttons(gtable.join {
abutton({}, 1, function()
searchbar:focus()
end),
})
--#region Hover signals to change the cursor to a text cursor --#region Hover signals to change the cursor to a text cursor
local old_cursor, old_wibox local old_cursor, old_wibox
@@ -119,7 +128,7 @@ function application_launcher.new(args)
application_container.visible = not application_container.visible application_container.visible = not application_container.visible
end end
if application_container.visible then 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() searchbar:focus()
else else
searchbar:set_text('') searchbar:set_text('')
@@ -128,44 +137,41 @@ function application_launcher.new(args)
end end
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 -- 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 if stop_key == 'Escape' then
capi.awesome.emit_signal('application_launcher::show') capi.awesome.emit_signal('application_launcher::show')
end end
searchbar:set_text('') searchbar:set_text('')
application_grid:set_applications(searchbar:get_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) end)
-- When started change the background for the searchbar -- When started change the background for the searchbar
searchbar:connect_signal('started', function() searchbar:connect_signal('inputbox::start', function()
searchbar_bg.border_color = Theme_config.application_launcher.searchbar.border_active searchbar_bg.border_color = beautiful.colorscheme.bg_blue
end) end)
-- On every keypress in the searchbar check for certain inputs -- 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 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') capi.awesome.emit_signal('application_launcher::show')
application_grid:reset() application_grid:reset()
searchbar:set_text('') 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 if key == 'Down' then
application_grid:move_down() application_grid:move_down()
elseif key == 'Right' then elseif key == 'Right' then
application_grid:move_right() application_grid:move_right()
end end
searchbar:stop() searchbar:unfocus()
--New keygrabber to allow for key navigation --New keygrabber to allow for key navigation
akeygrabber.run(function(mod, key2, event) akeygrabber.run(function(mod, key2, event)
if event == 'press' then if event == 'press' then
@@ -197,7 +203,7 @@ function application_launcher.new(args)
end end
end end
end) end)
searchbar_bg.border_color = Theme_config.application_launcher.searchbar.border_color searchbar_bg.border_color = beautiful.colorscheme.border_color
end end
-- Update the applications in the grid -- Update the applications in the grid
application_grid:set_applications(searchbar:get_text()) application_grid:set_applications(searchbar:get_text())

View File

@@ -2,6 +2,7 @@
local abutton = require('awful.button') local abutton = require('awful.button')
local aspawn = require('awful.spawn') local aspawn = require('awful.spawn')
local base = require('wibox.widget.base') local base = require('wibox.widget.base')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gshape = require('gears.shape') 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') name = name:gsub('^%s*(.-)%s*$', '%1')
local icon_color, fg local icon_color, fg
if device_type == 'source' then if device_type == 'source' then
icon_color = Theme_config.volume_controller.device_microphone_fg icon_color = beautiful.colorscheme.bg_blue
fg = Theme_config.volume_controller.device_microphone_fg fg = beautiful.colorscheme.bg_blue
elseif device_type == 'sink' then elseif device_type == 'sink' then
icon_color = Theme_config.volume_controller.device_headphones_fg icon_color = beautiful.colorscheme.bg_purple
fg = Theme_config.volume_controller.device_headphones_fg fg = beautiful.colorscheme.bg_purple
end end
local device_widget = wibox.widget { local device_widget = wibox.widget {
@@ -112,11 +113,11 @@ function audio_controller:get_device_widget(device, name, device_type)
margins = dpi(10), margins = dpi(10),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.volume_controller.device_bg, bg = beautiful.colorscheme.bg,
fg = fg, fg = fg,
border_color = Theme_config.volume_controller.device_border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.volume_controller.device_border_width, border_width = dpi(2),
shape = Theme_config.volume_controller.device_shape, shape = beautiful.shape[4],
widget = wibox.container.background, widget = wibox.container.background,
sink = device, 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) self:connect_signal('AC::device_changed', function(new_sink)
if device_widget.device == new_sink then if device_widget.device == new_sink then
device_widget.bg = Theme_config.volume_controller.device_headphones_selected_bg device_widget.bg = beautiful.colorscheme.bg_purple
device_widget.fg = Theme_config.volume_controller.device_headphones_selected_fg device_widget.fg = beautiful.colorscheme.bg
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:get_children_by_id('icon')[1].image = gcolor.recolor_image(icondir .. 'volume-high.svg', beautiful.colorscheme.bg)
else else
device_widget.bg = Theme_config.volume_controller.device_bg device_widget.bg = beautiful.colorscheme.bg
device_widget.fg = fg device_widget.fg = fg
device_widget:get_children_by_id('icon')[1].image = gcolor.recolor_image(icondir .. 'volume-high.svg', icon_color) device_widget:get_children_by_id('icon')[1].image = gcolor.recolor_image(icondir .. 'volume-high.svg', icon_color)
end end
@@ -198,7 +199,7 @@ function audio_controller.new()
{ {
resize = false, resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg', 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, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -217,9 +218,11 @@ function audio_controller.new()
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
}, },
id = 'sink_dd_shape', id = 'sink_dd_shape',
bg = Theme_config.volume_controller.list_bg, bg = beautiful.colorscheme.bg1,
fg = Theme_config.volume_controller.list_headphones_fg, fg = beautiful.colorscheme.bg_purple,
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, widget = wibox.container.background,
}, },
{ -- sink dropdown { -- sink dropdown
@@ -235,10 +238,12 @@ function audio_controller.new()
margins = dpi(10), margins = dpi(10),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
border_color = Theme_config.volume_controller.list_border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.volume_controller.list_border_width, border_width = dpi(2),
id = 'sink_list_shape', 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, widget = wibox.container.background,
}, },
id = 'sink_height', id = 'sink_height',
@@ -256,7 +261,7 @@ function audio_controller.new()
{ {
resize = false, resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg', 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, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -275,9 +280,11 @@ function audio_controller.new()
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
}, },
id = 'source_dd_shape', id = 'source_dd_shape',
bg = Theme_config.volume_controller.list_bg, bg = beautiful.colorscheme.bg1,
fg = Theme_config.volume_controller.list_headphones_fg, fg = beautiful.colorscheme.bg_purple,
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, widget = wibox.container.background,
}, },
{ -- source dropdown { -- source dropdown
@@ -293,10 +300,12 @@ function audio_controller.new()
margins = dpi(10), margins = dpi(10),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
border_color = Theme_config.volume_controller.list_border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.volume_controller.list_border_width, border_width = dpi(2),
id = 'source_list_shape', 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, widget = wibox.container.background,
}, },
id = 'source_height', id = 'source_height',
@@ -317,7 +326,7 @@ function audio_controller.new()
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = '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', id = 'sink_icon',
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -326,15 +335,13 @@ function audio_controller.new()
strategy = 'exact', strategy = 'exact',
}, },
{ {
bar_shape = function(cr, width, height) bar_shape = beautiful.shape[4],
gshape.rounded_rect(cr, width, height, dpi(5))
end,
bar_height = dpi(5), bar_height = dpi(5),
bar_color = Theme_config.volume_controller.border_color, bar_color = beautiful.colorscheme.border_color,
bar_active_color = Theme_config.volume_controller.volume_fg, bar_active_color = beautiful.colorscheme.bg_purple,
handle_color = Theme_config.volume_controller.volume_fg, handle_color = beautiful.colorscheme.bg_purple,
handle_shape = gshape.circle, 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_width = dpi(15),
handle_cursor = 'left_ptr', handle_cursor = 'left_ptr',
maximum = 100, maximum = 100,
@@ -363,7 +370,7 @@ function audio_controller.new()
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = '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', id = 'source_icon',
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -372,15 +379,13 @@ function audio_controller.new()
strategy = 'exact', strategy = 'exact',
}, },
{ {
bar_shape = function(cr, width, height) bar_shape = beautiful.shape[4],
gshape.rounded_rect(cr, width, height, dpi(5))
end,
bar_height = dpi(5), bar_height = dpi(5),
bar_color = Theme_config.volume_controller.border_color, bar_color = beautiful.colorscheme.border_color,
bar_active_color = Theme_config.volume_controller.volume_fg, bar_active_color = beautiful.colorscheme.bg_purple,
handle_color = Theme_config.volume_controller.volume_fg, handle_color = beautiful.colorscheme.bg_purple,
handle_shape = gshape.circle, 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_width = dpi(15),
handle_cursor = 'left_ptr', handle_cursor = 'left_ptr',
maximum = 100, maximum = 100,
@@ -426,7 +431,7 @@ function audio_controller.new()
w.sink_volume = volume w.sink_volume = volume
w.sink_muted = muted w.sink_muted = muted
if muted then 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 else
local icon = icondir .. 'volume' local icon = icondir .. 'volume'
if volume == 0 then if volume == 0 then
@@ -440,7 +445,7 @@ function audio_controller.new()
end end
sink_slider:set_value(volume) 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
end) end)
@@ -460,14 +465,14 @@ function audio_controller.new()
w.source_volume = volume w.source_volume = volume
w.source_muted = muted w.source_muted = muted
if muted then 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 else
if not volume then return end if not volume then return end
source_slider:set_value(tonumber(volume)) source_slider:set_value(tonumber(volume))
if volume > 0 then 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 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 end
end) end)
@@ -500,16 +505,14 @@ function audio_controller.new()
end end
sink_dd_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg', 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 else
rubato_timer.target = 0 rubato_timer.target = 0
sink_dd_shape.shape = function(cr, width, height) sink_dd_shape.shape = beautiful.shape[4]
gshape.rounded_rect(cr, width, height, 4)
end
sink_dd_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg', 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
end), end),
}) })
@@ -543,16 +546,14 @@ function audio_controller.new()
end end
source_dd_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg', 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 else
rubato_timer.target = 0 rubato_timer.target = 0
source_dd_shape.shape = function(cr, width, height) source_dd_shape.shape = beautiful.shape[4]
gshape.rounded_rect(cr, width, height, 4)
end
source_dd_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg', 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
end), end),
}) })

View File

@@ -5,6 +5,7 @@
-- Awesome Libs -- Awesome Libs
local aplacement = require('awful.placement') local aplacement = require('awful.placement')
local apopup = require('awful.popup') local apopup = require('awful.popup')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
@@ -39,7 +40,7 @@ function osd.new(args)
{ {
{ -- Volume Icon { -- 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', valign = 'center',
halign = 'center', halign = 'center',
resize = true, resize = true,
@@ -55,8 +56,8 @@ function osd.new(args)
{ {
{ {
id = 'progressbar', id = 'progressbar',
color = Theme_config.volume_osd.bar_bg_active, color = beautiful.colorscheme.bg_purple,
background_color = Theme_config.volume_osd.bar_bg, background_color = beautiful.colorscheme.bg1,
max_value = 100, max_value = 100,
value = 0, value = 0,
shape = gshape.rounded_rect, shape = gshape.rounded_rect,
@@ -84,16 +85,16 @@ function osd.new(args)
bottom = dpi(20), bottom = dpi(20),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
shape = Theme_config.volume_osd.shape, shape = beautiful.shape[12],
widget = wibox.container.background, widget = wibox.container.background,
}, },
ontop = true, ontop = true,
stretch = false, stretch = false,
visible = false, visible = false,
border_color = Theme_config.volume_osd.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.volume_osd.border_width, border_width = dpi(2),
fg = Theme_config.volume_osd.fg, fg = beautiful.colorscheme.bg_purple,
bg = Theme_config.volume_osd.bg, bg = beautiful.colorscheme.bg,
screen = 1, screen = 1,
placement = function(c) aplacement.bottom(c, { margins = dpi(20) }) end, 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) audio_helper:connect_signal('output::get', function(_, muted, volume)
volume = tonumber(volume or 0) volume = tonumber(volume or 0)
if muted then 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 w.widget:get_children_by_id('progressbar')[1].value = 0
else else
w.widget:get_children_by_id('progressbar')[1].value = volume w.widget:get_children_by_id('progressbar')[1].value = volume
@@ -126,7 +127,7 @@ function osd.new(args)
icon = icon .. '-high' icon = icon .. '-high'
end 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 w.widget:get_children_by_id('text_role')[1].text = volume
end end
w:run() w:run()

View File

@@ -6,6 +6,7 @@
local abutton = require('awful.button') local abutton = require('awful.button')
local awidget = require('awful.widget') local awidget = require('awful.widget')
local base = require('wibox.widget.base') local base = require('wibox.widget.base')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears').color local gcolor = require('gears').color
local gfilesystem = require('gears').filesystem local gfilesystem = require('gears').filesystem
@@ -50,7 +51,7 @@ end
--#endregion --#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 --- Connect to a device if not connected else disconnect
function device:toggle_connect() function device:toggle_connect()
if not self.device.Paired then if not self.device.Paired then
@@ -110,8 +111,8 @@ function device.new(args)
local inputbox = input { local inputbox = input {
text = args.device.Alias or args.device.Name, text = args.device.Alias or args.device.Name,
font = 'JetBrainsMono Nerd Font 12', font = beautiful.user_config.font .. ' 12',
fg = Theme_config.bluetooth_controller.device_fg, fg = beautiful.colorscheme.bg_blue,
} }
local ret = base.make_widget_from_value(wibox.widget { local ret = base.make_widget_from_value(wibox.widget {
@@ -121,7 +122,7 @@ function device.new(args)
{ {
{ {
image = gcolor.recolor_image( image = gcolor.recolor_image(
icondir .. icon .. '.svg', Theme_config.bluetooth_controller.icon_color), icondir .. icon .. '.svg', beautiful.colorscheme.bg_purple),
resize = false, resize = false,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -165,8 +166,8 @@ function device.new(args)
margins = dpi(2), margins = dpi(2),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
shape = Theme_config.bluetooth_controller.icon_shape, shape = beautiful.shape[4],
bg = Theme_config.bluetooth_controller.con_button_color, bg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background, widget = wibox.container.background,
}, },
margin = dpi(5), margin = dpi(5),
@@ -177,12 +178,12 @@ function device.new(args)
margins = dpi(5), margins = dpi(5),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.bluetooth_controller.device_bg, bg = beautiful.colorscheme.bg,
fg = Theme_config.bluetooth_controller.device_fg, fg = beautiful.colorscheme.bg_blue,
border_color = Theme_config.bluetooth_controller.device_border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.bluetooth_controller.device_border_width, border_width = dpi(2),
id = 'background', id = 'background',
shape = Theme_config.bluetooth_controller.device_shape, shape = beautiful.shape[4],
widget = wibox.container.background, widget = wibox.container.background,
}) })
@@ -195,7 +196,7 @@ function device.new(args)
-- Set the image of the connection button depending on the connection state -- 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 ret:get_children_by_id('con')[1].image = gcolor.recolor_image(ret.device.Connected and icondir .. 'link.svg' or
icondir .. 'link-off.svg', icondir .. 'link-off.svg',
Theme_config.bluetooth_controller.icon_color_dark) beautiful.colorscheme.bg)
local cm = context_menu { local cm = context_menu {
widget_template = wibox.widget { widget_template = wibox.widget {
@@ -232,7 +233,7 @@ function device.new(args)
name = ret.device.Connected and 'Disconnect' or 'Connect', name = ret.device.Connected and 'Disconnect' or 'Connect',
icon = gcolor.recolor_image(ret.device.Connected and icondir .. 'bluetooth-off.svg' or icon = gcolor.recolor_image(ret.device.Connected and icondir .. 'bluetooth-off.svg' or
icondir .. 'bluetooth-on.svg', icondir .. 'bluetooth-on.svg',
Theme_config.bluetooth_controller.icon_color), beautiful.colorscheme.bg_purple),
callback = function() callback = function()
ret:toggle_connect() ret:toggle_connect()
end, end,
@@ -242,7 +243,7 @@ function device.new(args)
name = 'Pair', name = 'Pair',
icon = gcolor.recolor_image(ret.device.Paired and icondir .. 'link-off.svg' or icon = gcolor.recolor_image(ret.device.Paired and icondir .. 'link-off.svg' or
icondir .. 'link.svg', icondir .. 'link.svg',
Theme_config.bluetooth_controller.icon_color), beautiful.colorscheme.bg_purple),
callback = function() callback = function()
ret:toggle_pair() ret:toggle_pair()
end, end,
@@ -250,7 +251,7 @@ function device.new(args)
{ -- Trust/Untrust a device { -- Trust/Untrust a device
name = ret.device.Trusted and 'Untrust' or 'Trust', name = ret.device.Trusted and 'Untrust' or 'Trust',
icon = gcolor.recolor_image(ret.device.Trusted and icondir .. 'untrusted.svg' or icondir .. 'trusted.svg', 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() callback = function()
ret:toggle_trusted() ret:toggle_trusted()
end, end,
@@ -258,7 +259,7 @@ function device.new(args)
}, },
{ -- Rename a device { -- Rename a device
name = 'Rename', 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() callback = function()
inputbox:focus() inputbox:focus()
inputbox:connect_signal('inputbox::keypressed', function(_, mod, key) inputbox:connect_signal('inputbox::keypressed', function(_, mod, key)
@@ -271,7 +272,7 @@ function device.new(args)
}, },
{ -- Remove a device { -- Remove a device
name = 'Remove', 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() callback = function()
args.remove_callback(ret.device) args.remove_callback(ret.device)
end, 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('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 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', 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 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('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 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 elseif value.id:match('paired') then
value:get_children_by_id('icon_role')[1].image = gcolor.recolor_image(ret.device.Paired and 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
end end
cm:toggle() cm:toggle()
@@ -314,7 +315,7 @@ function device.new(args)
capi.awesome.connect_signal(ret.device.object_path .. '_updated', function(d) 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 ret:get_children_by_id('con')[1].image = gcolor.recolor_image(d.Connected and icondir .. 'link.svg' or
icondir .. 'link-off.svg', icondir .. 'link-off.svg',
Theme_config.bluetooth_controller.icon_color_dark) beautiful.colorscheme.bg)
end) end)
hover.bg_hover { widget = ret } hover.bg_hover { widget = ret }

View File

@@ -6,6 +6,7 @@
local abutton = require('awful.button') local abutton = require('awful.button')
local aspawn = require('awful.spawn') local aspawn = require('awful.spawn')
local base = require('wibox.widget.base') local base = require('wibox.widget.base')
local beautiful = require('beautiful')
local dbus_proxy = require('src.lib.lua-dbus_proxy.src.dbus_proxy') local dbus_proxy = require('src.lib.lua-dbus_proxy.src.dbus_proxy')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears').color local gcolor = require('gears').color
@@ -263,7 +264,7 @@ function bluetooth.new(args)
{ {
resize = false, resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg', image = gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.bluetooth_controller.connected_icon_color), beautiful.colorscheme.bg_purple),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -281,9 +282,9 @@ function bluetooth.new(args)
}, },
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
}, },
bg = Theme_config.bluetooth_controller.connected_bg, bg = beautiful.colorscheme.bg1,
fg = Theme_config.bluetooth_controller.connected_fg, fg = beautiful.colorscheme.bg_purple,
shape = Theme_config.bluetooth_controller.connected_shape, shape = beautiful.shape[4],
widget = wibox.container.background, widget = wibox.container.background,
id = 'connected_bg', id = 'connected_bg',
}, },
@@ -304,9 +305,9 @@ function bluetooth.new(args)
margins = dpi(10), margins = dpi(10),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
border_color = Theme_config.bluetooth_controller.con_device_border_color, border_color = beautiful.colorscheme.bg1,
border_width = Theme_config.bluetooth_controller.con_device_border_width, border_width = dpi(2),
shape = Theme_config.bluetooth_controller.con_device_shape, shape = beautiful.shape[4],
widget = wibox.container.background, widget = wibox.container.background,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -320,7 +321,7 @@ function bluetooth.new(args)
{ {
resize = false, resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg', image = gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.bluetooth_controller.discovered_icon_color), beautiful.colorscheme.bg_blue),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -339,9 +340,9 @@ function bluetooth.new(args)
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
}, },
id = 'discovered_bg', id = 'discovered_bg',
bg = Theme_config.bluetooth_controller.discovered_bg, bg = beautiful.colorscheme.bg1,
fg = Theme_config.bluetooth_controller.discovered_fg, fg = beautiful.colorscheme.bg_blue,
shape = Theme_config.bluetooth_controller.discovered_shape, shape = beautiful.shape[4],
widget = wibox.container.background, widget = wibox.container.background,
}, },
id = 'discovered_margin', id = 'discovered_margin',
@@ -360,9 +361,9 @@ function bluetooth.new(args)
margins = dpi(10), margins = dpi(10),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
border_color = Theme_config.bluetooth_controller.con_device_border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.bluetooth_controller.con_device_border_width, border_width = dpi(2),
shape = Theme_config.bluetooth_controller.con_device_shape, shape = beautiful.shape[4],
widget = wibox.container.background, widget = wibox.container.background,
forced_height = 0, forced_height = 0,
id = 'discovered_list', id = 'discovered_list',
@@ -371,7 +372,7 @@ function bluetooth.new(args)
{ -- action buttons { -- action buttons
{ {
dnd_widget { dnd_widget {
color = Theme_config.bluetooth_controller.power_bg, color = beautiful.colorscheme.bg_blue,
size = dpi(40), size = dpi(40),
}, },
id = 'dnd', id = 'dnd',
@@ -384,7 +385,7 @@ function bluetooth.new(args)
{ {
{ {
image = gcolor.recolor_image(icondir .. 'refresh.svg', image = gcolor.recolor_image(icondir .. 'refresh.svg',
Theme_config.bluetooth_controller.refresh_icon_color), beautiful.colorscheme.bg),
resize = false, resize = false,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -393,8 +394,8 @@ function bluetooth.new(args)
widget = wibox.container.margin, widget = wibox.container.margin,
margins = dpi(5), margins = dpi(5),
}, },
shape = Theme_config.bluetooth_controller.refresh_shape, shape = beautiful.shape[4],
bg = Theme_config.bluetooth_controller.refresh_bg, bg = beautiful.colorscheme.bg_blue,
id = 'scan', id = 'scan',
widget = wibox.container.background, widget = wibox.container.background,
}, },
@@ -515,7 +516,7 @@ function bluetooth.new(args)
end end
connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg', 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 end
end) end)
@@ -530,7 +531,7 @@ function bluetooth.new(args)
end end
connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg', 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) end)
@@ -545,16 +546,14 @@ function bluetooth.new(args)
end end
connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg', connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
Theme_config.bluetooth_controller.connected_icon_color)) beautiful.colorscheme.bg_purple))
end end
else else
connected_animation.target = 0 connected_animation.target = 0
connected_margin.connected_bg.shape = function(cr, width, height) connected_margin.connected_bg.shape = beautiful.shape[4]
gshape.rounded_rect(cr, width, height, 4)
end
connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg', connected_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.bluetooth_controller.connected_icon_color)) beautiful.colorscheme.bg_purple))
end end
end) end)
@@ -584,7 +583,7 @@ function bluetooth.new(args)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4)) gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end end
discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg', 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 end
end) end)
@@ -600,7 +599,7 @@ function bluetooth.new(args)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4)) gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end end
discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg', 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) end)
@@ -616,15 +615,13 @@ function bluetooth.new(args)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4)) gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end end
discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg', discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
Theme_config.bluetooth_controller.discovered_icon_color)) beautiful.colorscheme.bg_blue))
end end
else else
discovered_animation.target = 0 discovered_animation.target = 0
discovered_bg.shape = function(cr, width, height) discovered_bg.shape = beautiful.shape[4]
gshape.rounded_rect(cr, width, height, 4)
end
discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg', discovered_icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.bluetooth_controller.discovered_icon_color)) beautiful.colorscheme.bg_blue))
end end
end) end)
--#endregion --#endregion

View File

@@ -5,6 +5,7 @@
-- Awesome Libs -- Awesome Libs
local aplacement = require('awful.placement') local aplacement = require('awful.placement')
local apopup = require('awful.popup') local apopup = require('awful.popup')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
@@ -44,61 +45,61 @@ function brightness_osd.new(args)
{ {
{ -- Brightness Icon { -- 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', valign = 'center',
halign = 'center', halign = 'center',
resize = true, resize = true,
id = 'icon_role', id = 'icon_role',
widget = wibox.widget.imagebox widget = wibox.widget.imagebox,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = dpi(25), width = dpi(25),
height = dpi(25), height = dpi(25),
strategy = 'exact' strategy = 'exact',
}, },
{ -- Brightness Bar { -- Brightness Bar
{ {
{ {
id = 'progressbar', id = 'progressbar',
color = Theme_config.brightness_ods.bar_bg_active, color = beautiful.colorscheme.bg_blue,
background_color = Theme_config.brightness_ods.bar_bg, background_color = beautiful.colorscheme.bg,
max_value = 100, max_value = 100,
value = 0, value = 0,
shape = gshape.rounded_rect, shape = gshape.rounded_rect,
widget = wibox.widget.progressbar widget = wibox.widget.progressbar,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = dpi(250), width = dpi(250),
height = dpi(5), height = dpi(5),
}, },
widget = wibox.container.place widget = wibox.container.place,
}, },
{ -- Brightness text { -- Brightness text
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
id = 'text_role', id = 'text_role',
text = '0', text = '0',
valign = 'center', valign = 'center',
halign = 'center' halign = 'center',
}, },
spacing = dpi(10), spacing = dpi(10),
layout = wibox.layout.fixed.horizontal layout = wibox.layout.fixed.horizontal,
}, },
left = dpi(10), left = dpi(10),
right = dpi(10), right = dpi(10),
top = dpi(20), top = dpi(20),
bottom = dpi(20), bottom = dpi(20),
widget = wibox.container.margin widget = wibox.container.margin,
}, },
shape = Theme_config.brightness_ods.shape, shape = beautiful.shape[4],
widget = wibox.container.background widget = wibox.container.background,
}, },
ontop = true, ontop = true,
stretch = false, stretch = false,
visible = false, visible = false,
border_color = Theme_config.brightness_ods.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.brightness_ods.border_width, border_width = dpi(2),
fg = Theme_config.brightness_ods.fg, fg = beautiful.colorscheme.bg_blue,
bg = Theme_config.brightness_ods.bg, bg = beautiful.colorscheme.bg,
screen = 1, screen = 1,
placement = function(c) aplacement.bottom(c, { margins = dpi(20) }) end, placement = function(c) aplacement.bottom(c, { margins = dpi(20) }) end,
} }
@@ -110,7 +111,7 @@ function brightness_osd.new(args)
autostart = true, autostart = true,
callback = function() callback = function()
w.visible = false w.visible = false
end end,
} }
backlight_helper:connect_signal('brightness_changed', function() backlight_helper:connect_signal('brightness_changed', function()
@@ -127,7 +128,7 @@ function brightness_osd.new(args)
icon = icon .. '-high.svg' icon = icon .. '-high.svg'
end 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.widget:get_children_by_id('text_role')[1].text = brightness
w:run() w:run()
end) end)

View File

@@ -1,5 +1,7 @@
-- Awesome Libs -- Awesome Libs
local awful = require('awful') local awful = require('awful')
local apopup = require('awful.popup')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears.table') local gtable = require('gears.table')
local gcolor = require('gears.color') local gcolor = require('gears.color')
@@ -348,7 +350,7 @@ function calendar:create_calendar_weeks_widget()
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
}, },
id = 'background', id = 'background',
fg = Theme_config.calendar.day.fg_unfocus, fg = beautiful.colorscheme.bg2,
widget = wibox.container.background, widget = wibox.container.background,
}, },
strategy = 'exact', strategy = 'exact',
@@ -371,8 +373,8 @@ function calendar:create_weekdays_widget()
valign = 'center', valign = 'center',
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
}, },
bg = Theme_config.calendar.weekdays.bg, bg = beautiful.colorscheme.bg,
fg = Theme_config.calendar.weekdays.fg, fg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background, widget = wibox.container.background,
}) })
end end
@@ -421,9 +423,9 @@ function calendar:create_calendar_widget()
margins = dpi(2), margins = dpi(2),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
fg = Theme_config.calendar.task.fg, fg = beautiful.colorscheme.bg,
bg = bg, bg = bg,
shape = Theme_config.calendar.task.shape, shape = beautiful.shape[4],
forced_height = dpi(20), forced_height = dpi(20),
widget = wibox.container.background, widget = wibox.container.background,
} }
@@ -460,11 +462,11 @@ function calendar:create_calendar_widget()
color = cal.color, color = cal.color,
} }
local task_popup = awful.popup { local task_popup = apopup {
widget = ti, widget = ti,
ontop = true, ontop = true,
visible = false, visible = false,
bg = '#00000000', bg = gcolor.transparent,
x = capi.mouse.coords().x, x = capi.mouse.coords().x,
y = capi.mouse.coords().y, y = capi.mouse.coords().y,
screen = capi.mouse.screen, 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) 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 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 border = beautiful.colorscheme.border_color
local bg = Theme_config.calendar.day.bg_unfocus local bg = beautiful.colorscheme.bg
local fg = Theme_config.calendar.day.fg_unfocus local fg = beautiful.colorscheme.bg2
local y = tonumber(os.date('%Y')) local y = tonumber(os.date('%Y'))
local m = tonumber(os.date('%m')) local m = tonumber(os.date('%m'))
if (i == self.date.day) and (m == last_month) and (y == year) then if (i == self.date.day) and (m == last_month) and (y == year) then
bg = Theme_config.calendar.day.bg_focus bg = beautiful.colorscheme.bg_teal
fg = Theme_config.calendar.day.fg_focus fg = beautiful.colorscheme.bg
end end
local day = wibox.widget { local day = wibox.widget {
@@ -540,7 +542,7 @@ function calendar:create_calendar_widget()
id = 'day_bg', id = 'day_bg',
widget = wibox.container.background, widget = wibox.container.background,
bg = bg, bg = bg,
shape = Theme_config.calendar.day.shape, shape = beautiful.shape[4],
fg = fg, fg = fg,
}, },
widget = wibox.container.place, widget = wibox.container.place,
@@ -563,11 +565,11 @@ function calendar:create_calendar_widget()
}, },
id = 'background', id = 'background',
widget = wibox.container.background, widget = wibox.container.background,
bg = Theme_config.calendar.day.bg_unfocus, bg = beautiful.colorscheme.bg,
fg = Theme_config.calendar.day.fg_unfocus, fg = beautiful.colorscheme.bg2,
border_color = border, border_color = border,
border_width = Theme_config.calendar.day.border_width, border_width = dpi(2),
shape = Theme_config.calendar.day.shape, shape = beautiful.shape[4],
}, },
id = 'day', id = 'day',
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -586,15 +588,15 @@ function calendar:create_calendar_widget()
local row = 1 local row = 1
local col = months_t[self.date.month].first_day local col = months_t[self.date.month].first_day
for i = 1, months_t[self.date.month].day_count, 1 do for i = 1, months_t[self.date.month].day_count, 1 do
local border = Theme_config.calendar.day.border_color local border = beautiful.colorscheme.border_color
local bg = Theme_config.calendar.day.bg local bg = beautiful.colorscheme.bg
local fg = Theme_config.calendar.day.fg local fg = beautiful.colorscheme.fg
local m = tonumber(os.date('%m')) local m = tonumber(os.date('%m'))
local y = tonumber(os.date('%Y')) local y = tonumber(os.date('%Y'))
if (i == self.date.day) and (m == self.date.month) and (y == self.date.year) then if (i == self.date.day) and (m == self.date.month) and (y == self.date.year) then
bg = Theme_config.calendar.day.bg_focus bg = beautiful.colorscheme.bg_teal
fg = Theme_config.calendar.day.fg_focus fg = beautiful.colorscheme.bg
end end
local day = wibox.widget { local day = wibox.widget {
@@ -617,7 +619,7 @@ function calendar:create_calendar_widget()
id = 'day_bg', id = 'day_bg',
widget = wibox.container.background, widget = wibox.container.background,
bg = bg, bg = bg,
shape = Theme_config.calendar.day.shape, shape = beautiful.shape[4],
fg = fg, fg = fg,
}, },
widget = wibox.container.place, widget = wibox.container.place,
@@ -638,11 +640,11 @@ function calendar:create_calendar_widget()
}, },
id = 'background', id = 'background',
widget = wibox.container.background, widget = wibox.container.background,
bg = Theme_config.calendar.day.bg, bg = beautiful.colorscheme.bg,
fg = Theme_config.calendar.day.fg, fg = beautiful.colorscheme.fg,
border_color = border, border_color = border,
border_width = Theme_config.calendar.day.border_width, border_width = dpi(2),
shape = Theme_config.calendar.day.shape, shape = beautiful.shape[4],
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = dpi(100), width = dpi(100),
@@ -668,15 +670,15 @@ function calendar:create_calendar_widget()
end end
for i = 1, 7 - months_t[self.date.month].last_day, 1 do for i = 1, 7 - months_t[self.date.month].last_day, 1 do
local border = Theme_config.calendar.day.border_color local border = beautiful.colorscheme.border_color
local bg = Theme_config.calendar.day.bg_unfocus local bg = beautiful.colorscheme.bg
local fg = Theme_config.calendar.day.fg_unfocus local fg = beautiful.colorscheme.bg2
local m = tonumber(os.date('%m')) local m = tonumber(os.date('%m'))
local y = tonumber(os.date('%Y')) local y = tonumber(os.date('%Y'))
if (i == self.date.day) and (m == next_month) and (y == year) then if (i == self.date.day) and (m == next_month) and (y == year) then
bg = Theme_config.calendar.day.bg_focus bg = beautiful.colorscheme.bg_teal
fg = Theme_config.calendar.day.fg_focus fg = beautiful.colorscheme.bg
end end
local day = wibox.widget { local day = wibox.widget {
{ {
@@ -698,7 +700,7 @@ function calendar:create_calendar_widget()
id = 'day_bg', id = 'day_bg',
widget = wibox.container.background, widget = wibox.container.background,
bg = bg, bg = bg,
shape = Theme_config.calendar.day.shape, shape = beautiful.shape[4],
fg = fg, fg = fg,
}, },
widget = wibox.container.place, widget = wibox.container.place,
@@ -719,11 +721,11 @@ function calendar:create_calendar_widget()
}, },
id = 'background', id = 'background',
widget = wibox.container.background, widget = wibox.container.background,
bg = Theme_config.calendar.day.bg_unfocus, bg = beautiful.colorscheme.bg,
fg = Theme_config.calendar.day.fg_unfocus, fg = beautiful.colorscheme.bg2,
border_color = border, border_color = border,
border_width = Theme_config.calendar.day.border_width, border_width = dpi(2),
shape = Theme_config.calendar.day.shape, shape = beautiful.shape[4],
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = dpi(100), width = dpi(100),
@@ -752,13 +754,13 @@ function calendar.new(args)
{ {
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
resize = false, 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', halign = 'center',
valign = 'center', valign = 'center',
}, },
id = 'add_ical', id = 'add_ical',
shape = Theme_config.calendar.add_ical.shape, shape = beautiful.shape[4],
bg = Theme_config.calendar.add_ical.bg, bg = beautiful.colorscheme.bg_red,
widget = wibox.container.background, widget = wibox.container.background,
}, },
widget = wibox.container.margin, widget = wibox.container.margin,
@@ -769,13 +771,13 @@ function calendar.new(args)
{ {
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
resize = false, 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', halign = 'center',
valign = 'center', valign = 'center',
}, },
id = 'add_task', id = 'add_task',
shape = Theme_config.calendar.add_task.shape, shape = beautiful.shape[4],
bg = Theme_config.calendar.add_task.bg, bg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background, widget = wibox.container.background,
}, },
widget = wibox.container.margin, widget = wibox.container.margin,
@@ -876,12 +878,12 @@ function calendar.new(args)
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
}, },
widget = wibox.container.background, widget = wibox.container.background,
bg = Theme_config.calendar.bg, bg = beautiful.colorscheme.bg,
border_color = Theme_config.calendar.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.calendar.border_width, border_width = dpi(2),
border_strategy = 'inner', border_strategy = 'inner',
fg = Theme_config.calendar.fg, fg = beautiful.colorscheme.fg,
shape = Theme_config.calendar.shape, shape = beautiful.shape,
}) })
ret:get_tasks() ret:get_tasks()

View File

@@ -1,5 +1,6 @@
-- Awesome Libs -- Awesome Libs
local awful = require('awful') local awful = require('awful')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gtable = require('gears.table') local gtable = require('gears.table')
@@ -21,7 +22,7 @@ function task_info.new(args)
local ret = gobject {} local ret = gobject {}
gtable.crush(ret, task_info, true) 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)) 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), top = dpi(15),
bottom = dpi(15), bottom = dpi(15),
}, },
bg = Theme_config.calendar.task_info.bg, bg = beautiful.colorscheme.bg,
fg = Theme_config.calendar.task_info.fg, fg = beautiful.colorscheme.fg,
shape = Theme_config.calendar.task_info.shape, shape = beautiful.shape[12],
widget = wibox.container.background, widget = wibox.container.background,
} }

View File

@@ -3,7 +3,9 @@
--------------------------------------- ---------------------------------------
-- Awesome Libs -- Awesome Libs
local awful = require('awful') local awful = require('awful')
local apopup = require('awful.popup')
local abutton = awful.button local abutton = awful.button
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears.table') local gtable = require('gears.table')
local base = require('wibox.widget.base') local base = require('wibox.widget.base')
@@ -101,8 +103,8 @@ function context_menu:make_entries(wtemplate, entries, spacing)
margins = dpi(5), margins = dpi(5),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.desktop.context_menu.entry_bg, bg = beautiful.colorscheme.bg,
fg = Theme_config.desktop.context_menu.entry_fg, fg = beautiful.colorscheme.bg_red,
widget = wibox.container.background, 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 menu_entry:get_children_by_id('text_role')[1].text = entry.name
if entry.submenu then if entry.submenu then
menu_entry:get_children_by_id('arrow_role')[1].image = 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 end
gtable.crush(menu_entry, entry, true) gtable.crush(menu_entry, entry, true)
@@ -133,14 +135,13 @@ function context_menu:make_entries(wtemplate, entries, spacing)
}) })
if entry.submenu then if entry.submenu then
menu_entry.popup = awful.popup { menu_entry.popup = apopup {
widget = self:make_entries(wtemplate, entry.submenu, spacing), widget = self:make_entries(wtemplate, entry.submenu, spacing),
bg = Theme_config.desktop.context_menu.bg, bg = beautiful.colorscheme.bg,
ontop = true, ontop = true,
fg = Theme_config.desktop.context_menu.fg, fg = beautiful.colorscheme.bg_red,
border_width = Theme_config.desktop.context_menu.border_width, border_width = dpi(2),
border_color = Theme_config.desktop.context_menu.border_color, border_color = beautiful.colorscheme.border_color,
shape = Theme_config.desktop.context_menu.shape,
visible = false, visible = false,
} }
@@ -197,14 +198,13 @@ function context_menu.new(args)
local entries = ret:make_entries(args.widget_template, args.entries, args.spacing) local entries = ret:make_entries(args.widget_template, args.entries, args.spacing)
ret = awful.popup { ret = apopup {
widget = entries, widget = entries,
bg = Theme_config.desktop.context_menu.bg, bg = beautiful.colorscheme.bg,
fg = Theme_config.desktop.context_menu.fg, fg = beautiful.colorscheme.bg_red,
ontop = true, ontop = true,
border_width = Theme_config.desktop.context_menu.border_width, border_width = dpi(2),
border_color = Theme_config.desktop.context_menu.border_color, border_color = beautiful.colorscheme.border_color,
shape = Theme_config.desktop.context_menu.shape,
visible = false, visible = false,
x = capi.mouse.coords().x + 10, x = capi.mouse.coords().x + 10,
y = capi.mouse.coords().y - 10, y = capi.mouse.coords().y - 10,

View File

@@ -1,10 +1,11 @@
-------------------------------------------------------------------------------------------------------------- local tinsert = table.insert
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen -- local pairs = pairs
--------------------------------------------------------------------------------------------------------------
-- Awesome Libs -- Awesome Libs
local aplacement = require('awful.placement') local aplacement = require('awful.placement')
local apopup = require('awful.popup') 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 wibox = require('wibox')
local capi = { local capi = {
@@ -12,16 +13,13 @@ local capi = {
client = client, client = client,
} }
return function(s, widgets) local function prepare_widgets(w)
local function prepare_widgets(w)
local layout = { local layout = {
forced_height = dpi(50),
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
} }
for i, widget in pairs(w) do for i, widget in pairs(w) do
if i == 1 then if i == 1 then
table.insert(layout, tinsert(layout,
{ {
widget, widget,
left = dpi(6), left = dpi(6),
@@ -31,7 +29,7 @@ return function(s, widgets)
widget = wibox.container.margin, widget = wibox.container.margin,
}) })
elseif i == #w then elseif i == #w then
table.insert(layout, tinsert(layout,
{ {
widget, widget,
left = dpi(3), left = dpi(3),
@@ -41,7 +39,7 @@ return function(s, widgets)
widget = wibox.container.margin, widget = wibox.container.margin,
}) })
else else
table.insert(layout, tinsert(layout,
{ {
widget, widget,
left = dpi(3), left = dpi(3),
@@ -53,20 +51,28 @@ return function(s, widgets)
end end
end end
return layout return layout
end end
return setmetatable({}, {
__call = function(_, s, widgets)
local top_center = apopup { local top_center = apopup {
screen = s, screen = s,
widget = prepare_widgets(widgets), widget = {
prepare_widgets(widgets),
widget = wibox.container.constraint,
strategy = 'exact',
height = dpi(50),
},
ontop = false, ontop = false,
bg = Theme_config.center_bar.bg, bg = beautiful.colorscheme.bg,
visible = true, visible = true,
maximum_width = dpi(500), maximum_width = dpi(500),
placement = function(c) aplacement.top(c, { margins = dpi(10) }) end, placement = function(c) aplacement.top(c, { margins = dpi(10) }) end,
} }
top_center:struts { top_center:struts {
top = dpi(55), top = dpi(60),
} }
capi.client.connect_signal('manage', function(c) capi.client.connect_signal('manage', function(c)
@@ -101,4 +107,5 @@ return function(s, widgets)
end end
end) end)
end end,
})

View File

@@ -1,25 +1,28 @@
-------------------------------------------------------------------------------------------------------------- local setmetatable = setmetatable
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen -- local table = table
-------------------------------------------------------------------------------------------------------------- local ipairs = ipairs
local pairs = pairs
-- Awesome Libs -- Awesome Libs
local lgi = require('lgi')
local Gio = lgi.Gio
local abutton = require('awful.button') local abutton = require('awful.button')
local aplacement = require('awful.placement')
local apopup = require('awful.popup') local apopup = require('awful.popup')
local awidget = require('awful.widget')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table') 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 gtimer = require('gears.timer')
local amenu = require('awful.menu') local lgi = require('lgi')
local Gio = lgi.Gio
local wibox = require('wibox')
-- Local libs -- Local libs
local config = require('src.tools.config') 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 hover = require('src.tools.hover')
local icon_lookup = require('src.tools.gio_icon_lookup')()
local capi = { local capi = {
awesome = awesome, awesome = awesome,
@@ -102,8 +105,8 @@ function dock:get_element_widget(desktop_file)
local GDesktopAppInfo = Gio.DesktopAppInfo.new_from_filename(desktop_file) local GDesktopAppInfo = Gio.DesktopAppInfo.new_from_filename(desktop_file)
local icon = Get_gicon_path(nil, GDesktopAppInfo.get_string(GDesktopAppInfo, 'Icon')) or local icon = icon_lookup:get_gicon_path(nil, GDesktopAppInfo.get_string(GDesktopAppInfo, 'Icon')) or
Get_gicon_path(nil, Gio.DesktopAppInfo.get_string(GDesktopAppInfo, 'X-AppImage-Old-Icon')) or '' icon_lookup:get_gicon_path(nil, Gio.DesktopAppInfo.get_string(GDesktopAppInfo, 'X-AppImage-Old-Icon')) or ''
local widget = wibox.widget { local widget = wibox.widget {
{ {
@@ -118,19 +121,19 @@ function dock:get_element_widget(desktop_file)
id = 'icon_role', id = 'icon_role',
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = User_config.dock_icon_size, width = beautiful.user_config.dock_icon_size,
height = User_config.dock_icon_size, height = beautiful.user_config.dock_icon_size,
}, },
widget = wibox.container.margin, widget = wibox.container.margin,
margins = dpi(5), margins = dpi(5),
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = User_config.dock_icon_size + dpi(10), -- + margins width = beautiful.user_config.dock_icon_size + dpi(10), -- + margins
height = User_config.dock_icon_size + dpi(10), height = beautiful.user_config.dock_icon_size + dpi(10),
strategy = 'exact', strategy = 'exact',
}, },
bg = Theme_config.dock.element.bg, bg = beautiful.colorscheme.bg1,
shape = Theme_config.dock.element.shape, shape = beautiful.shape[8],
widget = wibox.container.background, 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 for _, action in ipairs(Gio.DesktopAppInfo.list_actions(GDesktopAppInfo)) do
table.insert(action_entries, { table.insert(action_entries, {
name = Gio.DesktopAppInfo.get_action_name(GDesktopAppInfo, action) or '', name = Gio.DesktopAppInfo.get_action_name(GDesktopAppInfo, action) or '',
icon = Get_gicon_path(nil, GDesktopAppInfo.get_string(GDesktopAppInfo, 'Icon')) or icon = icon_lookup:get_gicon_path(nil, GDesktopAppInfo.get_string(GDesktopAppInfo, 'Icon')) or
Get_gicon_path(nil, Gio.DesktopAppInfo.get_string(GDesktopAppInfo, 'X-AppImage-Old-Icon')) or icon_lookup: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), gcolor.recolor_image(icondir .. 'entry.svg', beautiful.colorscheme.bg_yellow),
callback = function() callback = function()
Gio.DesktopAppInfo.launch_action(GDesktopAppInfo, action) Gio.DesktopAppInfo.launch_action(GDesktopAppInfo, action)
end, end,
@@ -149,7 +152,7 @@ function dock:get_element_widget(desktop_file)
table.insert(action_entries, { table.insert(action_entries, {
name = 'Remove from Dock', 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() callback = function()
local data = config.read_json(gfilesystem.get_configuration_dir() .. 'src/config/dock_' .. self.screen.index .. '.json') local data = config.read_json(gfilesystem.get_configuration_dir() .. 'src/config/dock_' .. self.screen.index .. '.json')
for i, v in ipairs(data) do for i, v in ipairs(data) do
@@ -243,11 +246,8 @@ end
---@param args {desktop_file: string} The path to the .desktop file ---@param args {desktop_file: string} The path to the .desktop file
function dock:pin_element(args) function dock:pin_element(args)
if not args then return end if not args then return end
local e = args.desktop_file local e = args.desktop_file
assert(e, 'No desktop file provided')
self:emit_signal('dock::pin_element', e) self:emit_signal('dock::pin_element', e)
self:write_elements_to_file_async() self:write_elements_to_file_async()
@@ -267,19 +267,19 @@ function dock:add_start_element()
id = 'icon_role', id = 'icon_role',
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = User_config.dock_icon_size, width = beautiful.user_config.dock_icon_size,
height = User_config.dock_icon_size, height = beautiful.user_config.dock_icon_size,
}, },
widget = wibox.container.margin, widget = wibox.container.margin,
margins = dpi(5), margins = dpi(5),
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = User_config.dock_icon_size + dpi(10), -- + margins width = beautiful.user_config.dock_icon_size + dpi(10), -- + margins
height = User_config.dock_icon_size + dpi(10), height = beautiful.user_config.dock_icon_size + dpi(10),
strategy = 'exact', strategy = 'exact',
}, },
bg = Theme_config.dock.element.bg, bg = beautiful.colorscheme.bg1,
shape = Theme_config.dock.element.shape, shape = beautiful.shape[8],
widget = wibox.container.background, widget = wibox.container.background,
} }
@@ -297,9 +297,6 @@ function dock:add_start_element()
return widget return widget
end 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) function dock:unpin_element(args)
if not args then return end if not args then return end
@@ -367,7 +364,7 @@ local function check_for_dock_hide(self, a_popup)
minimized = false minimized = false
local y = c:geometry().y local y = c:geometry().y
local h = c.height 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 self.visible = false
return return
else else
@@ -451,7 +448,7 @@ function dock.new(args)
forced_width = dpi(2), forced_width = dpi(2),
forced_height = dpi(20), forced_height = dpi(20),
thickness = dpi(2), thickness = dpi(2),
color = Theme_config.dock.element.border, color = beautiful.colorscheme.border_color,
}, },
{ {
spacing = dpi(5), spacing = dpi(5),
@@ -473,7 +470,7 @@ function dock.new(args)
ontop = true, ontop = true,
visible = true, visible = true,
placement = function(c) aplacement.bottom(c, { margins = dpi(10) }) end, placement = function(c) aplacement.bottom(c, { margins = dpi(10) }) end,
bg = Theme_config.dock.bg, bg = beautiful.colorscheme.bg,
screen = args.screen, screen = args.screen,
} }
@@ -500,7 +497,7 @@ function dock.new(args)
forced_height = dpi(20), forced_height = dpi(20),
forced_width = dpi(2), forced_width = dpi(2),
thickness = dpi(2), thickness = dpi(2),
color = Theme_config.dock.element.border, color = beautiful.colorscheme.border_color,
}, },
widget = wibox.container.margin, widget = wibox.container.margin,
right = dpi(5), right = dpi(5),
@@ -520,19 +517,19 @@ function dock.new(args)
id = 'icon_role', id = 'icon_role',
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = User_config.dock_icon_size, width = beautiful.user_config.dock_icon_size,
height = User_config.dock_icon_size, height = beautiful.user_config.dock_icon_size,
}, },
widget = wibox.container.margin, widget = wibox.container.margin,
margins = dpi(5), margins = dpi(5),
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = User_config.dock_icon_size + dpi(10), -- + margins width = beautiful.user_config.dock_icon_size + dpi(10), -- + margins
height = User_config.dock_icon_size + dpi(10), height = beautiful.user_config.dock_icon_size + dpi(10),
strategy = 'exact', strategy = 'exact',
}, },
bg = Theme_config.dock.element.bg, bg = beautiful.colorscheme.bg1,
shape = Theme_config.dock.element.shape, shape = beautiful.shape[8],
widget = wibox.container.background, widget = wibox.container.background,
} }
@@ -543,15 +540,19 @@ function dock.new(args)
} }
element:buttons(gtable.join( element:buttons(gtable.join(
abutton({}, 1, function(c) abutton({}, 1, function()
if c == client.focus then if client == client.focus then
c.minimized = true client.minimized = true
else 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
end), end),
abutton({}, 3, function() abutton({}, 3, function()
amenu.client_list { theme = { width = dpi(250) } } --TODO: Add context menu with options
end) end)
)) ))

View File

@@ -1,59 +1,58 @@
-------------------------------------------------------------------------------------------------------------- local tinsert = table.insert
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen -- local ipairs = ipairs
--------------------------------------------------------------------------------------------------------------
return function(s) local beautiful = require('beautiful')
---Lookup function to return the widget from its easy name string
---@param widgets table return setmetatable({}, {
---@return widget __call = function(_, s)
local function get_widgets(widgets) local function get_widgets(widgets)
local widget_table = {} local widget_table = {}
if widgets then if widgets then
for _, widget in ipairs(widgets) do for _, widget in ipairs(widgets) do
if widget == 'Audio' then if widget == 'Audio' then
table.insert(widget_table, require('src.widgets.audio')(s)) tinsert(widget_table, require('src.widgets.audio')(s))
elseif widget == 'Battery' then elseif widget == 'Battery' then
table.insert(widget_table, require('src.widgets.battery')(User_config.battery_kind)) tinsert(widget_table, require('src.widgets.battery')(beautiful.user_config.battery_kind))
elseif widget == 'Bluetooth' then elseif widget == 'Bluetooth' then
table.insert(widget_table, require('src.widgets.bluetooth')(s)) tinsert(widget_table, require('src.widgets.bluetooth')(s))
elseif widget == 'Clock' then elseif widget == 'Clock' then
table.insert(widget_table, require('src.widgets.clock')()) tinsert(widget_table, require('src.widgets.clock') {})
elseif widget == 'Cpu Frequency' then elseif widget == 'Cpu Frequency' then
table.insert(widget_table, require('src.widgets.cpu_info')('freq')) tinsert(widget_table, require('src.widgets.cpu_info')('freq'))
elseif widget == 'Cpu Temperature' then elseif widget == 'Cpu Temperature' then
table.insert(widget_table, require('src.widgets.cpu_info')('temp')) tinsert(widget_table, require('src.widgets.cpu_info')('temp'))
elseif widget == 'Cpu Usage' then elseif widget == 'Cpu Usage' then
table.insert(widget_table, require('src.widgets.cpu_info')('usage')) tinsert(widget_table, require('src.widgets.cpu_info')('usage'))
elseif widget == 'Date' then elseif widget == 'Date' then
table.insert(widget_table, require('src.widgets.date')(s)) tinsert(widget_table, require('src.widgets.date')(s))
elseif widget == 'Gpu Temperature' then elseif widget == 'Gpu Temperature' then
table.insert(widget_table, require('src.widgets.gpu_info')('temp')) tinsert(widget_table, require('src.widgets.gpu_info')('temp'))
elseif widget == 'Gpu Usage' then elseif widget == 'Gpu Usage' then
table.insert(widget_table, require('src.widgets.gpu_info')('usage')) tinsert(widget_table, require('src.widgets.gpu_info')('usage'))
elseif widget == 'Keyboard Layout' then elseif widget == 'Keyboard Layout' then
table.insert(widget_table, require('src.widgets.kblayout')(s)) tinsert(widget_table, require('src.widgets.kblayout')(s))
elseif widget == 'Tiling Layout' then elseif widget == 'Tiling Layout' then
table.insert(widget_table, require('src.widgets.layout_list')()) tinsert(widget_table, require('src.widgets.layout_list')(s))
elseif widget == 'Network' then elseif widget == 'Network' then
table.insert(widget_table, require('src.widgets.network') { screen = s }) tinsert(widget_table, require('src.widgets.network')(s))
elseif widget == 'Power Button' then elseif widget == 'Power Button' then
table.insert(widget_table, require('src.widgets.power')()) tinsert(widget_table, require('src.widgets.power') {})
elseif widget == 'Ram Usage' then elseif widget == 'Ram Usage' then
table.insert(widget_table, require('src.widgets.ram_info')()) tinsert(widget_table, require('src.widgets.ram_info') {})
elseif widget == 'Systray' then elseif widget == 'Systray' then
table.insert(widget_table, require('src.widgets.systray')()) tinsert(widget_table, require('src.widgets.systray') {})
elseif widget == 'Taglist' then elseif widget == 'Taglist' then
table.insert(widget_table, require('src.widgets.taglist')(s)) tinsert(widget_table, require('src.widgets.taglist')(s))
elseif widget == 'Tasklist' then elseif widget == 'Tasklist' then
table.insert(widget_table, require('src.widgets.tasklist')(s)) tinsert(widget_table, require('src.widgets.tasklist')(s))
end end
end end
end end
return widget_table return widget_table
end end
if User_config.crylia_bar then if beautiful.user_config.crylia_bar then
for index, screen in ipairs(User_config.crylia_bar) do for index, screen in ipairs(beautiful.user_config.crylia_bar) do
if index == s.index then if index == s.index then
if screen.left_bar then if screen.left_bar then
require('src.modules.crylia_bar.left_bar')(s, get_widgets(screen.left_bar)) require('src.modules.crylia_bar.left_bar')(s, get_widgets(screen.left_bar))
@@ -68,4 +67,5 @@ return function(s)
end end
end end
require('src.modules.crylia_bar.dock') { screen = s } require('src.modules.crylia_bar.dock') { screen = s }
end end,
})

View File

@@ -1,20 +1,20 @@
-------------------------------------------------------------------------------------------------------------- local tinsert = table.insert
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen -- local pairs = pairs
--------------------------------------------------------------------------------------------------------------
-- Awesome Libs -- 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 dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox') local wibox = require('wibox')
return function(s, w) local function prepare_widgets(w)
local function prepare_widgets(widgets)
local layout = { local layout = {
forced_height = dpi(50),
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
} }
for i, widget in pairs(widgets) do for i, widget in pairs(w) do
if i == 1 then if i == 1 then
table.insert(layout, tinsert(layout,
{ {
widget, widget,
left = dpi(6), left = dpi(6),
@@ -23,8 +23,8 @@ return function(s, w)
bottom = dpi(6), bottom = dpi(6),
widget = wibox.container.margin, widget = wibox.container.margin,
}) })
elseif i == #widgets then elseif i == #w then
table.insert(layout, tinsert(layout,
{ {
widget, widget,
left = dpi(3), left = dpi(3),
@@ -34,7 +34,7 @@ return function(s, w)
widget = wibox.container.margin, widget = wibox.container.margin,
}) })
else else
table.insert(layout, tinsert(layout,
{ {
widget, widget,
left = dpi(3), left = dpi(3),
@@ -46,21 +46,27 @@ return function(s, w)
end end
end end
return layout return layout
end end
local top_left = awful.popup { return setmetatable({}, {
__call = function(_, s, w)
local top_left = apopup {
screen = s, screen = s,
widget = prepare_widgets(w), widget = {
prepare_widgets(w),
widget = wibox.container.constraint,
strategy = 'exact',
height = dpi(50),
},
ontop = false, ontop = false,
bg = Theme_config.left_bar.bg, bg = beautiful.colorscheme.bg,
visible = true, visible = true,
maximum_width = dpi(650), maximum_width = dpi(850),
placement = function(c) awful.placement.top_left(c, { margins = dpi(10) }) end, placement = function(c) aplacement.top_left(c, { margins = dpi(10) }) end,
} }
top_left:struts { top_left:struts {
top = dpi(55), top = dpi(60),
} }
end,
Global_config.top_struts = dpi(55) })
end

View File

@@ -1,20 +1,21 @@
-------------------------------------------------------------------------------------------------------------- local tinsert = table.insert
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen -- local pairs = pairs
--------------------------------------------------------------------------------------------------------------
-- Awesome Libs -- Awesome Libs
local awful = require('awful') local aplacement = require('awful.placement')
local dpi = require('beautiful').xresources.apply_dpi local apopup = require('awful.popup')
local beautiful = require('beautiful')
local dpi = beautiful.xresources.apply_dpi
local wibox = require('wibox') local wibox = require('wibox')
return function(s, w) local function prepare_widgets(w)
local function prepare_widgets(widgets)
local layout = { local layout = {
forced_height = dpi(50),
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
} }
for i, widget in pairs(widgets) do
for i, widget in pairs(w) do
if i == 1 then if i == 1 then
table.insert(layout, tinsert(layout,
{ {
widget, widget,
left = dpi(6), left = dpi(6),
@@ -23,8 +24,8 @@ return function(s, w)
bottom = dpi(6), bottom = dpi(6),
widget = wibox.container.margin, widget = wibox.container.margin,
}) })
elseif i == #widgets then elseif i == #w then
table.insert(layout, tinsert(layout,
{ {
widget, widget,
left = dpi(3), left = dpi(3),
@@ -34,7 +35,7 @@ return function(s, w)
widget = wibox.container.margin, widget = wibox.container.margin,
}) })
else else
table.insert(layout, tinsert(layout,
{ {
widget, widget,
left = dpi(3), left = dpi(3),
@@ -46,20 +47,26 @@ return function(s, w)
end end
end end
return layout return layout
end end
local top_right = awful.popup { return setmetatable({}, {
widget = prepare_widgets(w), __call = function(_, s, w)
local top_right = apopup {
widget = {
prepare_widgets(w),
widget = wibox.container.constraint,
strategy = 'exact',
height = dpi(50),
},
ontop = false, ontop = false,
bg = Theme_config.right_bar.bg, bg = beautiful.colorscheme.bg,
visible = true, visible = true,
screen = s, screen = s,
placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end, placement = function(c) aplacement.top_right(c, { margins = dpi(10) }) end,
} }
top_right:struts { top_right:struts {
top = dpi(55), top = dpi(60),
} }
end,
Global_config.top_struts = top_right })
end

View File

@@ -4,6 +4,7 @@
local wibox = require('wibox') local wibox = require('wibox')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gshape = require('gears.shape') local gshape = require('gears.shape')
local beautiful = require('beautiful')
return function(s) return function(s)
---Lookup function to return the widget from its easy name string ---Lookup function to return the widget from its easy name string
@@ -16,13 +17,13 @@ return function(s)
if widget == 'Audio' then if widget == 'Audio' then
table.insert(widget_table, require('src.widgets.audio')(s)) table.insert(widget_table, require('src.widgets.audio')(s))
elseif widget == 'Battery' then 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 elseif widget == 'Bluetooth' then
table.insert(widget_table, require('src.widgets.bluetooth')()) table.insert(widget_table, require('src.widgets.bluetooth')())
elseif widget == 'Clock' then elseif widget == 'Clock' then
table.insert(widget_table, require('src.widgets.clock')()) table.insert(widget_table, require('src.widgets.clock')())
elseif widget == 'Cpu Frequency' then 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 elseif widget == 'Cpu Temperature' then
table.insert(widget_table, require('src.widgets.cpu_info')('temp')) table.insert(widget_table, require('src.widgets.cpu_info')('temp'))
elseif widget == 'Cpu Usage' then elseif widget == 'Cpu Usage' then
@@ -55,8 +56,8 @@ return function(s)
return widget_table return widget_table
end end
if User_config.crylia_wibox then if beautiful.user_config.crylia_wibox then
for index, screen in ipairs(User_config.crylia_wibox) do for index, screen in ipairs(beautiful.user_config.crylia_wibox) do
if index == s.index then if index == s.index then
local function prepare_widgets(widgets) local function prepare_widgets(widgets)
local layout = { local layout = {
@@ -112,17 +113,15 @@ return function(s)
type = 'desktop', type = 'desktop',
height = dpi(55), height = dpi(55),
width = 1920, width = 1920,
bg = '#212121', bg = beautiful.colorscheme.bg,
shape = function(cr, width, height) 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, end,
} }
w:struts { w:struts {
bottom = dpi(55), bottom = dpi(60),
} }
Global_config.bottom_struts = dpi(55)
end end
end end
end end

View File

@@ -1,6 +1,7 @@
local Gio = require('lgi').Gio local Gio = require('lgi').Gio
local awful = require('awful') local awful = require('awful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local beautiful = require('beautiful')
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local grid = require('wibox.layout.grid') local grid = require('wibox.layout.grid')
@@ -17,6 +18,7 @@ local capi = {
awesome = awesome, awesome = awesome,
screen = screen, screen = screen,
} }
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/desktop/' local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/desktop/'
local desktop = { mt = {} } local desktop = { mt = {} }
@@ -88,14 +90,14 @@ end
function desktop:get_grid_index_at(y, x) function desktop:get_grid_index_at(y, x)
local margin_x, margin_y = dpi(10), dpi(10) 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 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 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) col = math.max(col, 1)
local row = math.floor((y - margin_y) / cell_height) + 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) row = math.max(row, 1)
return col, row return col, row
@@ -159,32 +161,32 @@ function desktop:add_element(args, pos)
entries = { entries = {
{ {
name = 'Open with', 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 = { submenu = {
--!TODO: Fetch programs and add them as entries --!TODO: Fetch programs and add them as entries
}, },
}, },
{ {
name = 'Copy', 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() callback = function()
end, end,
}, },
{ {
name = 'Cut', 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() callback = function()
end, end,
}, },
{ {
name = 'Rename', 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() callback = function()
end, end,
}, },
{ {
name = 'Remove', 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() callback = function()
self:remove_element(e) self:remove_element(e)
self:save_layout() self:save_layout()
@@ -192,7 +194,7 @@ function desktop:add_element(args, pos)
}, },
{ {
name = 'Actions', 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 = { submenu = {
-- TODO: fetch actions from desktop file -- TODO: fetch actions from desktop file
}, },
@@ -295,9 +297,7 @@ function desktop:draw_selector()
x = start_pos.x - self.args.screen.geometry.x, x = start_pos.x - self.args.screen.geometry.x,
y = start_pos.y - self.args.screen.geometry.y, y = start_pos.y - self.args.screen.geometry.y,
visible = true, visible = true,
shape = function(cr, w, h) shape = beautiful.shape[10],
gshape.rounded_rect(cr, w, h, dpi(10))
end,
} }
selector.point = { x = start_pos.x - self.args.screen.geometry.x, y = start_pos.y - self.args.screen.geometry.y } 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) self.widget.manual:add(selector)
@@ -359,8 +359,8 @@ function desktop.new(args)
args.icon_size = dpi(48) args.icon_size = dpi(48)
local rows = 20 local rows = 15
local cols = 11 local cols = 8
local h_spacing = dpi(10) local h_spacing = dpi(10)
local v_spacing = dpi(20) local v_spacing = dpi(20)
@@ -449,11 +449,11 @@ function desktop.new(args)
entries = { entries = {
{ {
name = 'Create new', 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 = { submenu = {
{ {
name = 'Folder', 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() callback = function()
--create a new folder and if it exists add a number to the end --create a new folder and if it exists add a number to the end
local folder_name = 'New folder' local folder_name = 'New folder'
@@ -475,7 +475,7 @@ function desktop.new(args)
}, },
{ {
name = 'File', 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() callback = function()
--create new text file and if it exists add a number to the end --create new text file and if it exists add a number to the end
local file_name = 'New file.txt' local file_name = 'New file.txt'
@@ -499,76 +499,76 @@ function desktop.new(args)
}, },
{ {
name = 'Terminal', 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() callback = function()
awful.spawn(User_config.terminal) awful.spawn(beautiful.user_config.terminal)
end, end,
}, },
{ {
name = 'Web Browser', 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() callback = function()
awful.spawn(User_config.web_browser) awful.spawn(beautiful.user_config.web_browser)
end, end,
}, },
{ {
name = 'File Manager', 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() callback = function()
awful.spawn(User_config.file_manager) awful.spawn(beautiful.user_config.file_manager)
end, end,
}, },
{ {
name = 'Text Editor', 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() callback = function()
awful.spawn(User_config.text_editor) awful.spawn(beautiful.user_config.text_editor)
end, end,
}, },
{ {
name = 'Music Player', 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() callback = function()
awful.spawn(User_config.music_player) awful.spawn(beautiful.user_config.music_player)
end, end,
}, },
{ {
name = 'Applications', 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() callback = function()
end, end,
}, },
{ {
name = 'GTK Settings', 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() callback = function()
awful.spawn(User_config.gtk_settings) awful.spawn(beautiful.user_config.gtk_settings)
end, end,
}, },
{ {
name = 'Energy Settings', 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() callback = function()
awful.spawn(User_config.energy_manager) awful.spawn(beautiful.user_config.energy_manager)
end, end,
}, },
{ {
name = 'Screen Settings', 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() callback = function()
awful.spawn(User_config.screen_settings) awful.spawn(beautiful.user_config.screen_settings)
end, end,
}, },
{ {
name = 'Reload Awesome', 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() callback = function()
capi.awesome.restart() capi.awesome.restart()
end, end,
}, },
{ {
name = 'Quit', 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() callback = function()
capi.awesome.quit() capi.awesome.quit()
end, end,

View File

@@ -1,4 +1,5 @@
local base = require('wibox.widget.base') local base = require('wibox.widget.base')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gshape = require('gears.shape') local gshape = require('gears.shape')
@@ -7,6 +8,8 @@ local lgi = require('lgi')
local cairo = lgi.cairo local cairo = lgi.cairo
local wibox = require('wibox') local wibox = require('wibox')
local input = require('src.modules.inputbox')
local element = { mt = {} } local element = { mt = {} }
function element:layout(_, width, height) function element:layout(_, width, height)
@@ -196,6 +199,12 @@ function element.new(args)
local text_img, size = outlined_text(args.label, args.width) 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 { local w = base.make_widget_from_value(wibox.widget {
{ {
{ {
@@ -231,7 +240,7 @@ function element.new(args)
halign = 'center', halign = 'center',
widget = wibox.container.place, widget = wibox.container.place,
}, },
fg = '#ffffff', fg = beautiful.colorscheme.fg,
bg = gcolor.transparent, bg = gcolor.transparent,
border_color = gcolor.transparent, border_color = gcolor.transparent,
border_width = dpi(2), border_width = dpi(2),

View File

@@ -1,45 +1,32 @@
-------------------------------------------------------------------------------------------------------------- local tinsert = table.insert
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen -- local load = load
-------------------------------------------------------------------------------------------------------------- local ipairs = ipairs
-- Awesome Libs -- Awesome Libs
local awful = require('awful') local awful = require('awful')
local beautiful = require('beautiful')
awful.screen.connect_for_each_screen(function(s) local instance = nil
-- Create 9 tags if not instance then
awful.layout.append_default_layouts(User_config.layouts) instance = setmetatable({}, {
awful.tag({ '1', '2', '3', '4', '5', '6', '7', '8', '9' }, s, User_config.layouts[1]) __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
awful.layout.append_default_layouts(layouts)
awful.tag({ '1', '2', '3', '4', '5', '6', '7', '8', '9' }, s, layouts[1])
require('src.modules.desktop.desktop') { screen = s } require('src.modules.desktop.desktop') { screen = s }
require('src.modules.crylia_bar.init')(s) require('src.modules.crylia_bar')(s)
--require('src.modules.crylia_wibox.init')(s) --require('src.modules.crylia_wibox.init')(s)
require('src.modules.notification-center.init') { screen = s } require('src.modules.notification-center') { screen = s }
--require('src.modules.window_switcher.init')(s) --require('src.modules.window_switcher.init') { screen = s }
require('src.modules.application_launcher.init') { screen = s } require('src.modules.application_launcher') { screen = s }
end) end)
end,
local ip = require('src.modules.inputbox.init') { })
text = 'inputboxtest', end
cursor_pos = 4, return instance
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,
},
}
]]

View File

@@ -2,6 +2,7 @@ local Pango = require('lgi').Pango
local PangoCairo = require('lgi').PangoCairo local PangoCairo = require('lgi').PangoCairo
local akey = require('awful.key') local akey = require('awful.key')
local akeygrabber = require('awful.keygrabber') local akeygrabber = require('awful.keygrabber')
local beautiful = require('beautiful')
local cairo = require('lgi').cairo local cairo = require('lgi').cairo
local gobject = require('gears.object') local gobject = require('gears.object')
local gtable = require('gears.table') local gtable = require('gears.table')
@@ -33,21 +34,10 @@ local function get_subtext_layout(layout, starti, endi)
end end
function inputbox.draw_text(self) function inputbox.draw_text(self)
local text = self:get_text()
local highlight = self:get_highlight() local highlight = self:get_highlight()
local fg_color = { 1, 1, 1, 1 } local fg_color = { 1, 1, 1, 1 }
local cursor_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 _, 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) 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 -- Draw highlight
if highlight.start_pos ~= highlight.end_pos then if highlight.start_pos ~= highlight.end_pos then
cr:set_source_rgb(0, 0, 1) 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 sub_extent = get_subtext_layout(self._private.layout, highlight.start_pos, highlight.end_pos)
local _, x_offset = self._private.layout:index_to_line_x(self:get_highlight().start_pos, false) local _, x_offset = self._private.layout:index_to_line_x(highlight.start_pos, false)
cr:rectangle( cr:rectangle(
x_offset / Pango.SCALE, x_offset / Pango.SCALE,
pango_extent.y / Pango.SCALE, pango_extent.y / Pango.SCALE,
@@ -68,23 +58,11 @@ function inputbox.draw_text(self)
end end
-- Draw text -- Draw text
if not self.password_mode then
PangoCairo.update_layout(cr, self._private.layout) PangoCairo.update_layout(cr, self._private.layout)
cr:set_source_rgba(table.unpack(fg_color)) cr:set_source_rgba(table.unpack(fg_color))
cr:move_to(0, 0) cr:move_to(0, 0)
PangoCairo.show_layout(cr, self._private.layout) 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
-- Draw cursor -- Draw cursor
if self._private.show_cursor then if self._private.show_cursor then
cr:set_source_rgba(table.unpack(cursor_color)) 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_text(text:sub(1, cursor_pos - 1) .. text:sub(cursor_pos + 1))
self:set_cursor_pos(cursor_pos - 1) self:set_cursor_pos(cursor_pos - 1)
end end
self:emit_signal('inputbox::keypressed', {}, 'BackSpace')
end, end,
}, },
akey { -- Delete highlight or right of cursor akey { -- Delete highlight or right of cursor
@@ -158,7 +135,6 @@ function inputbox:start_keygrabber()
else else
self:set_text(text:sub(1, cursor_pos) .. text:sub(cursor_pos + 2, #text)) self:set_text(text:sub(1, cursor_pos) .. text:sub(cursor_pos + 2, #text))
end end
self:emit_signal('inputbox::keypressed', {}, 'Delete')
end, end,
}, },
akey { -- Move cursor to left akey { -- Move cursor to left
@@ -211,8 +187,6 @@ function inputbox:start_keygrabber()
self:set_cursor_pos(cursor_pos - 1) self:set_cursor_pos(cursor_pos - 1)
self:set_highlight(nil, hl.end_pos - 1) self:set_highlight(nil, hl.end_pos - 1)
end 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, end,
}, },
akey { -- Highlight to the right akey { -- Highlight to the right
@@ -405,7 +379,6 @@ function inputbox:start_mousegrabber(x, y)
self:set_cursor_pos(index) self:set_cursor_pos(index)
mb_start = index mb_start = index
end end
print(self:get_highlight().start_pos, self:get_highlight().end_pos)
hl = self:get_highlight() hl = self:get_highlight()
return m.buttons[1] return m.buttons[1]
end, 'xterm') end, 'xterm')
@@ -428,7 +401,7 @@ end
function inputbox:set_text(text) function inputbox:set_text(text)
if self:get_text() == text then return end if self:get_text() == text then return end
text = '<span foreground="' .. (self._private.fg or '#ffffff') .. '">' .. text .. '</span>' text = '<span foreground="' .. (self._private.fg or beautiful.colorscheme.fg) .. '">' .. text .. '</span>'
local attributes, parsed = Pango.parse_markup(text, -1, 0) local attributes, parsed = Pango.parse_markup(text, -1, 0)
@@ -524,7 +497,7 @@ function inputbox.new(args)
trailing = 0, trailing = 0,
} }
ret._private.fg = args.fg or '#ffffff' ret._private.fg = args.fg or beautiful.colorscheme.fg
ret._private.highlight = args.highlight or { ret._private.highlight = args.highlight or {
start_pos = 0, start_pos = 0,
end_pos = 0, end_pos = 0,

View File

@@ -5,6 +5,7 @@
-- Awesome Libs -- Awesome Libs
local abutton = require('awful.button') local abutton = require('awful.button')
local awidget = require('awful.widget') local awidget = require('awful.widget')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears').table local gtable = require('gears').table
local gfilesystem = require('gears').filesystem local gfilesystem = require('gears').filesystem
@@ -169,7 +170,7 @@ function access_point.new(args)
{ {
image = gcolor.recolor_image( image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(args.NetworkManagerAccessPoint.Strength / 25) + 1 .. '.svg', 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', id = 'icon',
resize = true, resize = true,
valign = 'center', valign = 'center',
@@ -237,12 +238,12 @@ function access_point.new(args)
margins = dpi(5), margins = dpi(5),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.network_manager.access_point.bg, bg = beautiful.colorscheme.bg,
fg = Theme_config.network_manager.access_point.fg, fg = beautiful.colorscheme.bg_red,
border_color = Theme_config.network_manager.access_point.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.network_manager.access_point.border_width, border_width = dpi(2),
id = 'background', id = 'background',
shape = Theme_config.network_manager.access_point.device_shape, shape = beautiful.shape[8],
widget = wibox.container.background, widget = wibox.container.background,
}) })
@@ -270,31 +271,31 @@ function access_point.new(args)
if ret.is_ap_active(ret.NetworkManagerAccessPoint.object_path) then if ret.is_ap_active(ret.NetworkManagerAccessPoint.object_path) then
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image( ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(data.Strength / 25) + 1 .. '.svg', icondir .. 'wifi-strength-' .. math.floor(data.Strength / 25) + 1 .. '.svg',
Theme_config.network_manager.access_point.icon_color2) beautiful.colorscheme.bg)
else else
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image( ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(data.Strength / 25) + 1 .. '.svg', 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 end
end, 'PropertiesChanged') end, 'PropertiesChanged')
if ret:is_ap_active(ret.NetworkManagerAccessPoint) then if ret:is_ap_active(ret.NetworkManagerAccessPoint) then
ret.bg = Theme_config.network_manager.access_point.fg ret.bg = beautiful.colorscheme.bg_red
ret.fg = Theme_config.network_manager.access_point.bg ret.fg = beautiful.colorscheme.bg
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image( ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(ret.NetworkManagerAccessPoint.Strength / 25) + 1 .. '.svg', 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( 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 else
ret.bg = Theme_config.network_manager.access_point.bg ret.bg = beautiful.colorscheme.bg
ret.fg = Theme_config.network_manager.access_point.fg ret.fg = beautiful.colorscheme.bg_red
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image( ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
icondir .. 'wifi-strength-' .. math.floor(ret.NetworkManagerAccessPoint.Strength / 25) + 1 .. '.svg', 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( 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 end
ret.ap_form = ap_form { ret.ap_form = ap_form {
@@ -338,7 +339,7 @@ function access_point.new(args)
name = 'ret.device.Connected' and 'Disconnect' or 'Connect', name = 'ret.device.Connected' and 'Disconnect' or 'Connect',
icon = gcolor.recolor_image('ret.device.Connected' and icondir .. 'link-off.svg' or icon = gcolor.recolor_image('ret.device.Connected' and icondir .. 'link-off.svg' or
icondir .. 'link.svg', icondir .. 'link.svg',
Theme_config.network_manager.access_point.icon_color), beautiful.colorscheme.bg_red),
callback = function() callback = function()
ret:toggle_connection(ret.NetworkManagerAccessPoint) ret:toggle_connection(ret.NetworkManagerAccessPoint)
end, end,

View File

@@ -2,6 +2,7 @@ local abutton = require('awful.button')
local aplacement = require('awful.placement') local aplacement = require('awful.placement')
local apopup = require('awful.popup') local apopup = require('awful.popup')
local awidget = require('awful.widget') local awidget = require('awful.widget')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gtable = require('gears.table') local gtable = require('gears.table')
local gcolor = require('gears.color') local gcolor = require('gears.color')
@@ -42,7 +43,7 @@ function ap_form.new(args)
{ {
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
text = NM.utils_ssid_to_utf8(args.NetworkManagerAccessPoint.Ssid), 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', halign = 'center',
valign = 'center', valign = 'center',
}, },
@@ -53,7 +54,7 @@ function ap_form.new(args)
{ {
{ {
widget = wibox.widget.imagebox, 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, resize = false,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -62,15 +63,15 @@ function ap_form.new(args)
margins = dpi(5), margins = dpi(5),
}, },
widget = wibox.container.background, widget = wibox.container.background,
shape = Theme_config.network_manager.form.close_icon_shape, shape = beautiful.shape[8],
id = 'close_button', id = 'close_button',
bg = Theme_config.network_manager.form.close_bg, bg = beautiful.colorscheme.bg_red,
}, },
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
}, },
widget = wibox.container.background, widget = wibox.container.background,
bg = Theme_config.network_manager.form.header_bg, bg = beautiful.colorscheme.bg,
fg = Theme_config.network_manager.form.header_fg, fg = beautiful.colorscheme.bg_red,
}, },
{ -- Form { -- Form
{ -- Password { -- Password
@@ -100,10 +101,10 @@ function ap_form.new(args)
id = 'const', id = 'const',
}, },
widget = wibox.container.background, widget = wibox.container.background,
bg = '#212121', bg = beautiful.colorscheme.bg,
fg = '#F0F0F0', fg = beautiful.colorscheme.fg,
border_color = '#414141', border_color = beautiful.colorscheme.border_color,
border_width = 2, border_width = dpi(2),
shape = gshape.rounded_rect, shape = gshape.rounded_rect,
forced_width = 300, forced_width = 300,
forced_height = 50, forced_height = 50,
@@ -117,12 +118,12 @@ function ap_form.new(args)
{ {
{ {
checked = false, checked = false,
shape = Theme_config.network_manager.form.checkbox_shape, shape = beautiful.shape[4],
color = Theme_config.network_manager.form.checkbox_fg, color = beautiful.colorscheme.bg,
paddings = dpi(3), paddings = dpi(3),
check_color = Theme_config.network_manager.form.checkbox_bg, check_color = beautiful.colorscheme.bg_red,
border_color = Theme_config.network_manager.form.checkbox_bg, border_color = beautiful.colorscheme.bg_red,
border_width = 2, border_width = dpi(2),
id = 'checkbox', id = 'checkbox',
widget = wibox.widget.checkbox, widget = wibox.widget.checkbox,
}, },
@@ -158,9 +159,9 @@ function ap_form.new(args)
margins = dpi(10), margins = dpi(10),
}, },
widget = wibox.container.background, widget = wibox.container.background,
bg = Theme_config.network_manager.form.button_bg, bg = beautiful.colorscheme.bg_blue,
fg = Theme_config.network_manager.form.button_fg, fg = beautiful.colorscheme.bg,
shape = Theme_config.network_manager.form.button_shape, shape = beautiful.shape[8],
id = 'connect_button', id = 'connect_button',
}, },
widget = wibox.container.margin, widget = wibox.container.margin,
@@ -179,11 +180,10 @@ function ap_form.new(args)
visible = false, visible = false,
width = dpi(600), width = dpi(600),
height = dpi(400), height = dpi(400),
bg = Theme_config.network_manager.form.bg, bg = beautiful.colorscheme.bg,
fg = Theme_config.network_manager.form.fg, fg = beautiful.colorscheme.fg,
shape = Theme_config.network_manager.form.shape, border_color = beautiful.colorscheme.border_color,
border_color = Theme_config.network_manager.form.border_color, border_width = dpi(2),
border_width = Theme_config.network_manager.form.border_width,
type = 'dialog', type = 'dialog',
screen = args.screen, screen = args.screen,
} }

View File

@@ -6,6 +6,7 @@
local abutton = require('awful.button') local abutton = require('awful.button')
local base = require('wibox.widget.base') local base = require('wibox.widget.base')
local dbus_proxy = require('src.lib.lua-dbus_proxy.src.dbus_proxy') local dbus_proxy = require('src.lib.lua-dbus_proxy.src.dbus_proxy')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
@@ -168,7 +169,7 @@ function network:scan_access_points()
app_name = 'Network Manager', app_name = 'Network Manager',
title = 'Error: Scan failed!', title = 'Error: Scan failed!',
message = 'Failed to scan for access points.\n' .. failure, 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, timeout = 5,
} }
return return
@@ -239,7 +240,7 @@ function network.new(args)
{ {
resize = false, resize = false,
image = gcolor.recolor_image(icondir .. 'menu-down.svg', image = gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.network_manager.wifi_icon_color), beautiful.colorscheme.bg_red),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -263,11 +264,9 @@ function network.new(args)
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
}, },
id = 'wifi_bg', id = 'wifi_bg',
bg = Theme_config.network_manager.wifi_bg, bg = beautiful.colorscheme.bg1,
fg = Theme_config.network_manager.wifi_fg, fg = beautiful.colorscheme.bg_red,
shape = function(cr, width, height) shape = beautiful.shape[4],
gshape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background, widget = wibox.container.background,
}, },
id = 'wifi_margin', id = 'wifi_margin',
@@ -287,8 +286,8 @@ function network.new(args)
margins = dpi(10), margins = dpi(10),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
border_color = Theme_config.network_manager.ap_border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.network_manager.ap_border_width, border_width = dpi(2),
shape = function(cr, width, height) shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4)) gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end, end,
@@ -299,7 +298,7 @@ function network.new(args)
{ -- action buttons { -- action buttons
{ {
dnd_widget { dnd_widget {
color = Theme_config.network_manager.power_icon_color, color = beautiful.colorscheme.bg_red,
size = dpi(40), size = dpi(40),
}, },
id = 'dnd', id = 'dnd',
@@ -312,7 +311,7 @@ function network.new(args)
{ {
{ {
image = gcolor.recolor_image(icondir .. 'refresh.svg', image = gcolor.recolor_image(icondir .. 'refresh.svg',
Theme_config.network_manager.refresh_icon_color), beautiful.colorscheme.bg_red),
resize = false, resize = false,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -324,11 +323,9 @@ function network.new(args)
id = 'center', id = 'center',
}, },
border_width = dpi(2), border_width = dpi(2),
border_color = Theme_config.network_manager.border_color, border_color = beautiful.colorscheme.border_color,
shape = function(cr, width, height) shape = beautiful.shape[4],
gshape.rounded_rect(cr, width, height, dpi(4)) bg = beautiful.colorscheme.bg,
end,
bg = Theme_config.network_manager.refresh_bg,
widget = wibox.container.background, widget = wibox.container.background,
id = 'refresh', id = 'refresh',
}, },
@@ -345,12 +342,10 @@ function network.new(args)
margins = dpi(15), margins = dpi(15),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
shape = function(cr, width, height) shape = beautiful.shape[8],
gshape.rounded_rect(cr, width, height, dpi(8)) border_color = beautiful.colorscheme.border_color,
end, border_width = dpi(2),
border_color = Theme_config.network_manager.border_color, bg = beautiful.colorscheme.bg,
border_width = Theme_config.network_manager.border_width,
bg = Theme_config.network_manager.bg,
id = 'background', id = 'background',
widget = wibox.container.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)) gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end end
wifi.icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg', wifi.icon:set_image(gcolor.recolor_image(icondir .. 'menu-up.svg',
Theme_config.network_manager.wifi_icon_color)) beautiful.colorscheme.bg_red))
else else
rubato_timer.target = 0 rubato_timer.target = 0
wifi_margin.wifi_bg.shape = function(cr, width, height) wifi_margin.wifi_bg.shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, true, true, true, true, dpi(4)) gshape.partially_rounded_rect(cr, width, height, true, true, true, true, dpi(4))
end end
wifi.icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg', wifi.icon:set_image(gcolor.recolor_image(icondir .. 'menu-down.svg',
Theme_config.network_manager.wifi_icon_color)) beautiful.colorscheme.bg_red))
end end
end end
) )

View File

@@ -3,6 +3,7 @@
------------------------------------- -------------------------------------
-- Awesome Libs -- Awesome Libs
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local base = require('wibox.widget.base') 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.background,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -152,8 +153,8 @@ function info_center.new(args)
{ {
dnd_widget { dnd_widget {
text = 'Do not disturb', text = 'Do not disturb',
color = Theme_config.notification_center.dnd_color, color = beautiful.colorscheme.bg_purple,
fg = Theme_config.notification_center.dnd_fg, fg = beautiful.colorscheme.bg_red,
size = dpi(40), size = dpi(40),
}, },
id = 'dnd', id = 'dnd',
@@ -171,11 +172,9 @@ function info_center.new(args)
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
id = 'clear', id = 'clear',
}, },
fg = Theme_config.notification_center.clear_all_button.fg, fg = beautiful.colorscheme.bg,
bg = Theme_config.notification_center.clear_all_button.bg, bg = beautiful.colorscheme.bg_blue,
shape = function(cr, width, height) shape = beautiful.shape[12],
gshape.rounded_rect(cr, width, height, 12)
end,
id = 'clear_all_bg', id = 'clear_all_bg',
widget = wibox.container.background, widget = wibox.container.background,
}, },
@@ -200,7 +199,7 @@ function info_center.new(args)
}, },
spacing_widget = { spacing_widget = {
thickness = dpi(2), thickness = dpi(2),
color = Theme_config.notification_center.spacing_color, color = beautiful.colorscheme.bg1,
span_ratio = 0.9, span_ratio = 0.9,
widget = wibox.widget.separator, widget = wibox.widget.separator,
}, },
@@ -243,14 +242,14 @@ function info_center.new(args)
end) end)
w:get_children_by_id('dnd')[1]:get_widget():connect_signal('dnd::toggle', function(enabled) 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) end)
w.container = apopup { w.container = apopup {
widget = w, widget = w,
bg = Theme_config.notification_center.bg, bg = beautiful.colorscheme.bg,
border_color = Theme_config.notification_center.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.notification_center.border_width, border_width = dpi(2),
placement = function(c) placement = function(c)
aplacement.top(c, { margins = dpi(10) }) aplacement.top(c, { margins = dpi(10) })
end, end,

View File

@@ -7,9 +7,16 @@ local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox') local wibox = require('wibox')
local naughty = require('naughty') local naughty = require('naughty')
local gtimer = require('gears.timer') 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 hover = require('src.tools.hover')
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/notifications/'
return setmetatable({}, { return setmetatable({}, {
__call = function() __call = function()
local ret = wibox.widget { local ret = wibox.widget {
@@ -19,27 +26,195 @@ return setmetatable({}, {
spacing = dpi(20), spacing = dpi(20),
} }
--!No, :get_children_by_id() does not work here for some reason, yes I hate it too naughty.connect_signal('request::display', function(n)
--[[ naughty.connect_signal('notification_surface', function(b)
local start_time = os.time() local start_time = os.time()
local w = wibox.template.make_from_value(b) local color = beautiful.colorscheme.bg_blue
w = w:get_widget() local w = wibox.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 { { -- Title
text = 'now', {
{
{ -- 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 = [[<span foreground="]] ..
beautiful.colorscheme.bg .. [[" font="JetBrainsMono Nerd Font, Bold 16">]] .. (n.app_name or
'Unknown App') .. [[</span> | <span font="JetBrainsMono Nerd Font, Regular 16">]] .. (n.title or 'System Notification') .. [[</span>]],
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', font = 'JetBrainsMono Nerd Font, Bold 12',
fg = beautiful.colorscheme.bg,
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
widget = wibox.widget.textbox, 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),
} }
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)
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:connect_signal('mouse::leave', function()
w.children[1].children[1].children[1].children[1].children[1].children[2].children[1].children[2]:connect_signal('button::press', 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:remove_widgets(w)
ret:emit_signal('new_children') ret:emit_signal('new_children')
end) end)
))
gtimer { gtimer {
timeout = 1, timeout = 1,
@@ -47,7 +222,7 @@ return setmetatable({}, {
call_now = true, call_now = true,
callback = function() callback = function()
local time_ago = math.floor(os.time() - start_time) 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 if time_ago < 5 then
timer_text:set_text('now') timer_text:set_text('now')
elseif time_ago < 60 then elseif time_ago < 60 then
@@ -64,7 +239,7 @@ return setmetatable({}, {
ret:add(w) ret:add(w)
ret:emit_signal('new_children') ret:emit_signal('new_children')
end) ]] end)
return ret return ret
end, end,

View File

@@ -4,6 +4,7 @@
-- Awesome Libs -- Awesome Libs
local aspawn = require('awful.spawn') local aspawn = require('awful.spawn')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem') 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'), image = gsurface.load_uncached(gfilesystem.get_configuration_dir() .. 'src/assets/userpfp/userpfp.png'),
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
clip_shape = function(cr, width, height) clip_shape = beautiful.shape[12],
gshape.rounded_rect(cr, width, height, dpi(12))
end,
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
}, },
strategy = 'exact', strategy = 'exact',
@@ -46,10 +45,11 @@ if not instance then
{ {
{ -- Username { -- Username
image = gcolor.recolor_image(icondir .. 'user.svg', image = gcolor.recolor_image(icondir .. 'user.svg',
Theme_config.notification_center.profile.username_icon_color), beautiful.colorscheme.bg_blue),
valign = 'center', valign = 'center',
halign = 'left', halign = 'left',
resize = false, resize = true,
width = dpi(20),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
}, },
{ -- Username { -- Username
@@ -64,10 +64,11 @@ if not instance then
{ {
{ {
image = gcolor.recolor_image(icondir .. 'laptop.svg', image = gcolor.recolor_image(icondir .. 'laptop.svg',
Theme_config.notification_center.profile.os_prefix_icon_color), beautiful.colorscheme.bg_blue),
valign = 'center', valign = 'center',
halign = 'left', halign = 'left',
resize = false, resize = true,
width = dpi(20),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
}, },
{ -- OS { -- OS
@@ -82,10 +83,11 @@ if not instance then
{ {
{ {
image = gcolor.recolor_image(icondir .. 'penguin.svg', image = gcolor.recolor_image(icondir .. 'penguin.svg',
Theme_config.notification_center.profile.kernel_icon_color), beautiful.colorscheme.bg_blue),
valign = 'center', valign = 'center',
halign = 'left', halign = 'left',
resize = false, resize = true,
width = dpi(20),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
}, },
{ -- Kernel { -- Kernel
@@ -100,10 +102,11 @@ if not instance then
{ {
{ {
image = gcolor.recolor_image(icondir .. 'clock.svg', image = gcolor.recolor_image(icondir .. 'clock.svg',
Theme_config.notification_center.profile.uptime_icon_color), beautiful.colorscheme.bg_blue),
valign = 'center', valign = 'center',
halign = 'left', halign = 'left',
resize = false, resize = true,
width = dpi(20),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
}, },
{ -- Uptime { -- Uptime
@@ -124,10 +127,10 @@ if not instance then
}, },
widget = wibox.layout.fixed.vertical, widget = wibox.layout.fixed.vertical,
}, },
fg = Theme_config.notification_center.profile.fg, fg = beautiful.colorscheme.bg_green,
border_color = Theme_config.notification_center.profile.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.notification_center.profile.border_width, border_width = dpi(2),
shape = Theme_config.notification_center.profile.shape, shape = beautiful.shape[12],
widget = wibox.container.background, widget = wibox.container.background,
}, },
strategy = 'exact', strategy = 'exact',

View File

@@ -3,6 +3,7 @@
--------------------------- ---------------------------
-- Awesome Libs -- Awesome Libs
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox') local wibox = require('wibox')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
@@ -29,9 +30,7 @@ return setmetatable({}, { __call = function()
{ {
image = icondir .. 'default_image.svg', image = icondir .. 'default_image.svg',
resize = true, resize = true,
clip_shape = function(cr, width, height) clip_shape = beautiful.shape[8],
gshape.rounded_rect(cr, width, height, dpi(8))
end,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
@@ -53,7 +52,7 @@ return setmetatable({}, { __call = function()
id = 'title', id = 'title',
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
}, },
fg = Theme_config.notification_center.song_info.title_fg, fg = beautiful.colorscheme.bg_red,
widget = wibox.container.background, widget = wibox.container.background,
}, },
strategy = 'max', strategy = 'max',
@@ -72,7 +71,7 @@ return setmetatable({}, { __call = function()
text = 'Unknown Artist', text = 'Unknown Artist',
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
}, },
fg = Theme_config.notification_center.song_info.artist_fg, fg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background, widget = wibox.container.background,
}, },
strategy = 'max', strategy = 'max',
@@ -86,7 +85,7 @@ return setmetatable({}, { __call = function()
{ {
resize = false, resize = false,
image = gcolor.recolor_image(icondir .. 'shuffle.svg', image = gcolor.recolor_image(icondir .. 'shuffle.svg',
Theme_config.notification_center.song_info.shuffle_disabled), beautiful.colorscheme.bg1),
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
id = 'shuffle', id = 'shuffle',
@@ -97,7 +96,7 @@ return setmetatable({}, { __call = function()
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
id = 'prev', 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, widget = wibox.widget.imagebox,
}, },
{ {
@@ -106,7 +105,7 @@ return setmetatable({}, { __call = function()
halign = 'center', halign = 'center',
id = 'play_pause', id = 'play_pause',
image = gcolor.recolor_image(icondir .. 'play-pause.svg', image = gcolor.recolor_image(icondir .. 'play-pause.svg',
Theme_config.notification_center.song_info.play_enabled), beautiful.colorscheme.bg_teal),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
}, },
{ {
@@ -114,12 +113,12 @@ return setmetatable({}, { __call = function()
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
id = 'next', 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, widget = wibox.widget.imagebox,
}, },
{ {
resize = false, 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, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -146,7 +145,7 @@ return setmetatable({}, { __call = function()
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
}, },
fg = Theme_config.notification_center.song_info.duration_fg, fg = beautiful.colorscheme.bg_teal,
widget = wibox.container.background, widget = wibox.container.background,
}, },
right = dpi(10), right = dpi(10),
@@ -154,15 +153,13 @@ return setmetatable({}, { __call = function()
}, },
{ -- Progressbar { -- Progressbar
{ {
color = Theme_config.notification_center.song_info.progress_color, color = beautiful.colorscheme.bg_purple,
background_color = Theme_config.notification_center.song_info.progress_background_color, background_color = beautiful.colorscheme.bg1,
max_value = 100, max_value = 100,
value = 0, value = 0,
id = 'progress', id = 'progress',
forced_height = dpi(5), forced_height = dpi(5),
shape = function(cr, width) shape = beautiful.shape[4],
gshape.rounded_bar(cr, width, dpi(5))
end,
widget = wibox.widget.progressbar, widget = wibox.widget.progressbar,
}, },
widget = wibox.container.place, widget = wibox.container.place,
@@ -176,7 +173,7 @@ return setmetatable({}, { __call = function()
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
}, },
fg = Theme_config.notification_center.song_info.duration_fg, fg = beautiful.colorscheme.bg_teal,
widget = wibox.container.background, widget = wibox.container.background,
}, },
left = dpi(10), left = dpi(10),
@@ -189,9 +186,9 @@ return setmetatable({}, { __call = function()
widget = wibox.container.margin, widget = wibox.container.margin,
margins = dpi(10), margins = dpi(10),
}, },
border_color = Theme_config.notification_center.song_info.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.notification_center.song_info.border_width, border_width = dpi(2),
shape = Theme_config.notification_center.song_info.shape, shape = beautiful.shape[12],
widget = wibox.container.background, widget = wibox.container.background,
}, },
widget = wibox.container.margin, widget = wibox.container.margin,

View File

@@ -4,6 +4,7 @@
-- Awesome Libs -- Awesome Libs
local awful = require('awful') local awful = require('awful')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gears = require('gears') local gears = require('gears')
local wibox = require('wibox') local wibox = require('wibox')
@@ -39,8 +40,8 @@ return setmetatable({}, { __call = function()
{ {
{ {
{ --Bar { --Bar
color = Theme_config.notification_center.status_bar.cpu_usage_color, color = beautiful.colorscheme.bg_teal,
background_color = Theme_config.notification_center.status_bar.bar_bg_color, background_color = beautiful.colorscheme.bg1,
max_value = 100, max_value = 100,
value = 0, value = 0,
forced_height = dpi(8), forced_height = dpi(8),
@@ -99,13 +100,15 @@ return setmetatable({}, { __call = function()
if widget == 'cpu_usage' then if widget == 'cpu_usage' then
cpu_usage:connect_signal('update::cpu_usage', function(_, v) cpu_usage:connect_signal('update::cpu_usage', function(_, v)
if not v then return nil end
tooltip.text = 'CPU Usage: ' .. v .. '%' tooltip.text = 'CPU Usage: ' .. v .. '%'
rubato_timer.target = v rubato_timer.target = v
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icondir .. 'cpu/cpu.svg', 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) end)
elseif widget == 'cpu_temp' then elseif widget == 'cpu_temp' then
cpu_temp:connect_signal('update::cpu_temp', function(_, v) cpu_temp:connect_signal('update::cpu_temp', function(_, v)
if not v then return nil end
local temp_icon local temp_icon
if v < 50 then if v < 50 then
temp_icon = icondir .. 'cpu/thermometer-low.svg' temp_icon = icondir .. 'cpu/thermometer-low.svg'
@@ -115,29 +118,31 @@ return setmetatable({}, { __call = function()
temp_icon = icondir .. 'cpu/thermometer-high.svg' temp_icon = icondir .. 'cpu/thermometer-high.svg'
end end
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(temp_icon, 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' tooltip.text = 'CPU Temp: ' .. v .. '°C'
rubato_timer.target = v rubato_timer.target = v
end) end)
elseif widget == 'ram_usage' then elseif widget == 'ram_usage' then
ram:connect_signal('update::ram_widget', function(_, MemTotal, _, MemAvailable) 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 if not MemTotal or not MemAvailable then return end
local ram_usage = math.floor(((MemTotal - MemAvailable) / MemTotal * 100) + 0.5) local ram_usage = math.floor(((MemTotal - MemAvailable) / MemTotal * 100) + 0.5)
tooltip.text = 'RAM Usage: ' .. ram_usage .. '%' tooltip.text = 'RAM Usage: ' .. ram_usage .. '%'
rubato_timer.target = ram_usage rubato_timer.target = ram_usage
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icondir .. 'cpu/ram.svg', 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) end)
elseif widget == 'gpu_usage' then elseif widget == 'gpu_usage' then
gpu_usage:connect_signal('update::gpu_usage', function(_, v) 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 .. '%' tooltip.text = 'GPU Usage: ' .. v .. '%'
rubato_timer.target = tonumber(v) rubato_timer.target = tonumber(v)
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icondir .. 'cpu/gpu.svg', 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) end)
elseif widget == 'gpu_temp' then elseif widget == 'gpu_temp' then
gpu_temp:connect_signal('update::gpu_temp', function(_, v) gpu_temp:connect_signal('update::gpu_temp', function(_, v)
if not v then return nil end
local temp_icon, temp_num local temp_icon, temp_num
if v then if v then
@@ -154,12 +159,13 @@ return setmetatable({}, { __call = function()
temp_icon = icondir .. 'cpu/thermometer-low.svg' temp_icon = icondir .. 'cpu/thermometer-low.svg'
end end
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(temp_icon, 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' tooltip.text = 'GPU Temp: ' .. temp_num .. '°C'
rubato_timer.target = temp_num rubato_timer.target = temp_num
end) end)
elseif widget == 'volume' then elseif widget == 'volume' then
audio:connect_signal('sink::get', function(_, muted, volume) audio:connect_signal('sink::get', function(_, muted, volume)
if not volume and muted then return nil end
local icon = icondir .. 'audio/volume' local icon = icondir .. 'audio/volume'
volume = tonumber(volume) volume = tonumber(volume)
if not volume then if not volume then
@@ -179,12 +185,13 @@ return setmetatable({}, { __call = function()
end end
end end
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icon .. '.svg', 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 .. '%' tooltip.text = 'Volume: ' .. volume .. '%'
rubato_timer.target = volume rubato_timer.target = volume
end) end)
elseif widget == 'microphone' then elseif widget == 'microphone' then
audio:connect_signal('source::get', function(_, muted, volume) audio:connect_signal('source::get', function(_, muted, volume)
if not volume and muted then return nil end
if not volume then if not volume then
return return
end end
@@ -197,12 +204,13 @@ return setmetatable({}, { __call = function()
icon = icon .. '-off' icon = icon .. '-off'
end end
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icon .. '.svg', 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 .. '%' tooltip.text = 'Microphone: ' .. volume .. '%'
rubato_timer.target = volume rubato_timer.target = volume
end) end)
elseif widget == 'backlight' then elseif widget == 'backlight' then
backlight:connect_signal('brightness::get', function(_, v) backlight:connect_signal('brightness::get', function(_, v)
if not v then return nil end
local icon = icondir .. 'brightness' local icon = icondir .. 'brightness'
if v >= 0 and v < 34 then if v >= 0 and v < 34 then
icon = icon .. '-low' icon = icon .. '-low'
@@ -212,18 +220,19 @@ return setmetatable({}, { __call = function()
icon = icon .. '-high' icon = icon .. '-high'
end end
w:get_children_by_id('image_role')[1]:set_image(gears.color.recolor_image(icon .. '.svg', 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 .. '%' tooltip.text = 'Backlight: ' .. v .. '%'
rubato_timer.target = v rubato_timer.target = v
end) end)
elseif widget == 'battery' then elseif widget == 'battery' then
--[[ battery:connect_signal('update::battery_widget', function(battery, battery_icon) --[[ 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, 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 .. '%' tooltip.text = 'Battery: ' .. battery .. '%'
rubato_timer.target = battery rubato_timer.target = battery
end) ]] end) ]]
end end
table.insert(bar_layout, w) table.insert(bar_layout, w)
end 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), width = dpi(480),
strategy = 'exact', strategy = 'exact',
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -246,9 +255,9 @@ return setmetatable({}, { __call = function()
magins = dpi(10), magins = dpi(10),
layout = wibox.container.margin, layout = wibox.container.margin,
}, },
border_color = Theme_config.notification_center.status_bar.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.notification_center.status_bar.border_width, border_width = dpi(2),
shape = Theme_config.notification_center.status_bar.shape, shape = beautiful.shape[12],
widget = wibox.container.background, widget = wibox.container.background,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,

View File

@@ -3,6 +3,7 @@
-------------------------------- --------------------------------
-- Awesome Libs -- Awesome Libs
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox') local wibox = require('wibox')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
@@ -82,12 +83,12 @@ if not instance then
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
id = 'description', id = 'description',
}, },
fg = Theme_config.notification_center.weather.description_fg, fg = beautiful.colorscheme.bg_blue,
widget = wibox.container.background, widget = wibox.container.background,
}, },
{ -- line { -- line
{ {
bg = Theme_config.notification_center.weather.line_color, bg = beautiful.colorscheme.bg1,
widget = wibox.container.background, widget = wibox.container.background,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -99,7 +100,7 @@ if not instance then
{ -- Speed { -- Speed
{ {
image = gcolor.recolor_image(icondir .. 'weather-windy.svg', image = gcolor.recolor_image(icondir .. 'weather-windy.svg',
Theme_config.notification_center.weather.speed_icon_color), beautiful.colorscheme.bg_red),
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
@@ -127,7 +128,7 @@ if not instance then
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
image = gcolor.recolor_image(icondir .. 'humidity.svg', image = gcolor.recolor_image(icondir .. 'humidity.svg',
Theme_config.notification_center.weather.humidity_icon_color), beautiful.colorscheme.bg_red),
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
width = dpi(24), width = dpi(24),
@@ -154,9 +155,9 @@ if not instance then
}, },
widget = wibox.container.place, widget = wibox.container.place,
}, },
border_color = Theme_config.notification_center.weather.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.notification_center.weather.border_width, border_width = dpi(2),
shape = Theme_config.notification_center.weather.shape, shape = beautiful.shape[12],
widget = wibox.container.background, widget = wibox.container.background,
}, },
top = dpi(20), top = dpi(20),
@@ -176,7 +177,7 @@ if not instance then
call_now = true, call_now = true,
callback = function() callback = function()
aspawn.easy_async_with_shell("curl -sf 'http://api.openweathermap.org/data/2.5/weather?id=" .. 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) function(stdout)
if not stdout:match('error') then if not stdout:match('error') then
local weather_metadata = json_lua:decode(stdout) local weather_metadata = json_lua:decode(stdout)

View File

@@ -7,6 +7,7 @@ local abutton = require('awful.button')
local akey = require('awful.key') local akey = require('awful.key')
local akeygrabber = require('awful.keygrabber') local akeygrabber = require('awful.keygrabber')
local aspawn = require('awful.spawn') local aspawn = require('awful.spawn')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table') local gtable = require('gears.table')
@@ -31,27 +32,27 @@ local function get_button(type)
if type == 'shutdown' then if type == 'shutdown' then
icon = icondir .. 'shutdown.svg' icon = icondir .. 'shutdown.svg'
name = 'Shutdown' name = 'Shutdown'
bg_color = Theme_config.powermenu.shutdown_button_bg bg_color = beautiful.colorscheme.bg_blue
command = 'shutdown now' command = 'shutdown now'
elseif type == 'reboot' then elseif type == 'reboot' then
icon = icondir .. 'reboot.svg' icon = icondir .. 'reboot.svg'
name = 'Reboot' name = 'Reboot'
bg_color = Theme_config.powermenu.reboot_button_bg bg_color = beautiful.colorscheme.bg_red
command = 'reboot' command = 'reboot'
elseif type == 'logout' then elseif type == 'logout' then
icon = icondir .. 'logout.svg' icon = icondir .. 'logout.svg'
name = 'Logout' name = 'Logout'
bg_color = Theme_config.powermenu.logout_button_bg bg_color = beautiful.colorscheme.bg_yellow
command = 'awesome-client "awesome.quit()"' command = 'awesome-client "awesome.quit()"'
elseif type == 'lock' then elseif type == 'lock' then
icon = icondir .. 'lock.svg' icon = icondir .. 'lock.svg'
name = 'Lock' name = 'Lock'
bg_color = Theme_config.powermenu.lock_button_bg bg_color = beautiful.colorscheme.bg_green
command = 'dm-tool lock' command = 'dm-tool lock'
elseif type == 'suspend' then elseif type == 'suspend' then
icon = icondir .. 'suspend.svg' icon = icondir .. 'suspend.svg'
name = 'Suspend' name = 'Suspend'
bg_color = Theme_config.powermenu.suspend_button_bg bg_color = beautiful.colorscheme.bg_purple
command = 'systemctl suspend' command = 'systemctl suspend'
end end
@@ -81,9 +82,9 @@ local function get_button(type)
margins = dpi(10), margins = dpi(10),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
fg = Theme_config.powermenu.button_fg, fg = beautiful.colorscheme.bg,
bg = bg_color, bg = bg_color,
shape = Theme_config.powermenu.button_shape, shape = beautiful.shape[12],
widget = wibox.container.background, widget = wibox.container.background,
id = 'background', id = 'background',
}, },
@@ -117,7 +118,7 @@ function powermenu.new()
{ {
image = icondir .. 'defaultpfp.svg', image = icondir .. 'defaultpfp.svg',
resize = true, resize = true,
clip_shape = Theme_config.powermenu.profile_picture_shape, clip_shape = beautiful.shape[30],
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
id = 'icon_role', id = 'icon_role',
@@ -159,7 +160,7 @@ function powermenu.new()
type = 'splash', type = 'splash',
visible = false, visible = false,
ontop = true, ontop = true,
bg = Theme_config.powermenu.container_bg, bg = beautiful.colorscheme.bg .. '88',
height = capi.screen.primary.geometry.height, height = capi.screen.primary.geometry.height,
width = capi.screen.primary.geometry.width, width = capi.screen.primary.geometry.width,
x = capi.screen.primary.geometry.x, x = capi.screen.primary.geometry.x,
@@ -201,7 +202,7 @@ function powermenu.new()
end end
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', '') w:get_children_by_id('text_role')[1].text = stdout:gsub('\n', '')
end) end)

View File

@@ -3,19 +3,30 @@
--------------------------------- ---------------------------------
-- Awesome Libs -- Awesome Libs
local awful = require("awful") local aplacement = require('awful.placement')
local dpi = require("beautiful").xresources.apply_dpi local apopup = require('awful.popup')
local gears = require("gears") local beautiful = require('beautiful')
local wibox = require("wibox") 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 = { local capi = {
awesome = awesome, awesome = awesome,
client = client,
mouse = mouse, 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 { local window_switcher_list = wibox.widget {
window_elements, window_elements,
@@ -33,9 +44,9 @@ return function(s)
gears.shape.rounded_rect(cr, width, height, dpi(12)) gears.shape.rounded_rect(cr, width, height, dpi(12))
end, end,
placement = awful.placement.centered, placement = awful.placement.centered,
bg = Theme_config.window_switcher.bg, bg = beautiful.colorscheme.bg,
border_color = Theme_config.window_switcher.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.window_switcher.border_width border_width = dpi(2)
} }
window_switcher_container:setup { window_switcher_container:setup {
@@ -51,4 +62,94 @@ return function(s)
end end
end end
) )
end ]]
local client_preview = {}
function client_preview:toggle()
self.visible = not self.visible
end 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,
})

View File

@@ -4,6 +4,7 @@
-- Awesome Libs -- Awesome Libs
local awful = require('awful') local awful = require('awful')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local gears = require('gears') local gears = require('gears')
local wibox = require('wibox') local wibox = require('wibox')
@@ -91,13 +92,11 @@ return function()
margins = dpi(20), margins = dpi(20),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
shape = function(cr, width, height) shape = beautiful.shape[12],
gears.shape.rounded_rect(cr, width, height, dpi(12)) border_color = beautiful.colorscheme.border_color,
end, border_width = dpi(2),
border_color = Theme_config.window_switcher.border_color, bg = beautiful.colorscheme.bg,
border_width = Theme_config.window_switcher.border_width, fg = beautiful.colorscheme.bg_green,
bg = Theme_config.window_switcher.bg,
fg = Theme_config.window_switcher.element_fg,
widget = wibox.container.background, widget = wibox.container.background,
} }
@@ -119,7 +118,7 @@ return function()
local b_timed_bg = rubato.timed { duration = 0.5 } local b_timed_bg = rubato.timed { duration = 0.5 }
-- starting color -- 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 -- Foreground rubato init
@@ -128,7 +127,7 @@ return function()
local b_timed_fg = rubato.timed { duration = 0.5 } local b_timed_fg = rubato.timed { duration = 0.5 }
-- starting color -- 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 -- Border rubato init
local r_timed_border = rubato.timed { duration = 0.5 } local r_timed_border = rubato.timed { duration = 0.5 }
@@ -136,7 +135,7 @@ return function()
local b_timed_border = rubato.timed { duration = 0.5 } local b_timed_border = rubato.timed { duration = 0.5 }
-- starting color -- 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) .border_color)
local function set_bg(newbg) local function set_bg(newbg)
@@ -176,29 +175,26 @@ return function()
b_timed_border:subscribe(update_border) b_timed_border:subscribe(update_border)
if i == selected then 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_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(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)
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)
.border_color) set_border(beautiful.colorscheme.bg_purple)
set_border(Theme_config.window_switcher.selected_border_color) set_fg(beautiful.colorscheme.fg)
set_fg(Theme_config.window_switcher.selected_fg) set_bg(beautiful.colorscheme.bg1)
set_bg(Theme_config.window_switcher.selected_bg)
elseif i == selected - 1 or (selected == 1 and i == #clients_sorted) then 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_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(Theme_config.window_switcher.selected_fg) 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(Theme_config.window_switcher r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_purple)
.selected_border_color) set_border(beautiful.colorscheme.border_color)
set_border(Theme_config.window_switcher.border_color) set_fg(beautiful.colorscheme.bg_green)
set_fg(Theme_config.window_switcher.element_fg) set_bg(beautiful.colorscheme.bg)
set_bg(Theme_config.window_switcher.bg)
else 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_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(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)
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)
.border_color) set_border(beautiful.colorscheme.border_color)
set_border(Theme_config.window_switcher.border_color) set_fg(beautiful.colorscheme.bg_green)
set_fg(Theme_config.window_switcher.element_fg) set_bg(beautiful.colorscheme.bg)
set_bg(Theme_config.window_switcher.bg)
end end
end end
elseif fn == 'raise' then elseif fn == 'raise' then

View File

@@ -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',
}

View File

@@ -6,55 +6,118 @@
-- ╚██████╗██║ ██║ ██║ ███████╗██║██║ ██║ -- -- ╚██████╗██║ ██║ ██║ ███████╗██║██║ ██║ --
-- ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝ -- -- ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝ --
-------------------------------------------------- --------------------------------------------------
local awful = require('awful')
local beautiful = require('beautiful') local beautiful = require('beautiful')
local dpi = beautiful.xresources.apply_dpi
local gshape = require('gears.shape')
local gwallpaper = require('gears.wallpaper') local gwallpaper = require('gears.wallpaper')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local config = require('src.tools.config')
local capi = { local capi = {
awesome = awesome, awesome = awesome,
screen = screen, screen = screen,
} }
Theme_path = gfilesystem.get_configuration_dir() .. '/src/theme/' local function get_userconfig()
Theme = {} 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) 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. -- 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 --#region Client variables
Theme.useless_gap = Theme_config.window.useless_gap theme.useless_gap = dpi(5)
Theme.border_width = Theme_config.window.border_width theme.border_width = dpi(2)
Theme.border_normal = Theme_config.window.border_normal theme.border_normal = theme.colorscheme.bg_1
Theme.border_marked = Theme_config.window.border_marked theme.border_marked = theme.colorscheme.bg_red
--#endregion --#endregion
--#region Tooltip variables --#region Tooltip variables
Theme.tooltip_border_color = Theme_config.tooltip.border_color theme.tooltip_border_color = theme.colorscheme.border_color
Theme.tooltip_bg = Theme_config.tooltip.bg theme.tooltip_bg = theme.colorscheme.bg
Theme.tooltip_fg = Theme_config.tooltip.fg theme.tooltip_fg = theme.colorscheme.bg_teal
Theme.tooltip_border_width = Theme_config.tooltip.border_width theme.tooltip_border_width = dpi(2)
Theme.tooltip_gaps = Theme_config.tooltip.gaps theme.tooltip_gaps = dpi(15)
Theme.tooltip_shape = Theme_config.tooltip.shape
--#endregion --#endregion
--#region Hotkeys variables --#region Hotkeys variables
Theme.hotkeys_bg = Theme_config.hotkeys.bg theme.hotkeys_bg = theme.colorscheme.bg
Theme.hotkeys_fg = Theme_config.hotkeys.fg theme.hotkeys_fg = theme.colorscheme.fg
Theme.hotkeys_border_width = Theme_config.hotkeys.border_width theme.hotkeys_border_width = dpi(2)
Theme.hotkeys_border_color = Theme_config.hotkeys.border_color theme.hotkeys_border_color = theme.colorscheme.border_color
Theme.hotkeys_shape = Theme_config.hotkeys.shape theme.hotkeys_modifiers_fg = theme.colorscheme.bg_teal
Theme.hotkeys_modifiers_fg = Theme_config.hotkeys.modifiers_fg theme.hotkeys_description_font = theme.user_config.font
Theme.hotkeys_description_font = Theme_config.hotkeys.description_font theme.hotkeys_font = theme.user_config.font
Theme.hotkeys_font = Theme_config.hotkeys.font theme.hotkeys_group_margin = dpi(20)
Theme.hotkeys_group_margin = Theme_config.hotkeys.group_margin theme.hotkeys_label_bg = theme.colorscheme.bg_teal
Theme.hotkeys_label_bg = Theme_config.hotkeys.label_bg theme.hotkeys_label_fg = theme.colorscheme.bg
Theme.hotkeys_label_fg = Theme_config.hotkeys.label_fg
--#endregion --#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 -- Wallpaper
beautiful.wallpaper = User_config.wallpaper beautiful.wallpaper = theme.user_config['wallpaper']
capi.screen.connect_signal('request::wallpaper', function(s) capi.screen.connect_signal('request::wallpaper', function(s)
if beautiful.wallpaper then if beautiful.wallpaper then
if type(beautiful.wallpaper) == 'string' then if type(beautiful.wallpaper) == 'string' then
@@ -65,7 +128,7 @@ capi.screen.connect_signal('request::wallpaper', function(s)
end end
end) end)
beautiful.init(Theme) beautiful.init(theme)
-- Load titlebar -- Load titlebar
require('src.core.titlebar')() --require('src.core.titlebar')()

View File

@@ -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

View File

@@ -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 <super> + <e>
]] --
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 <Super>(<Meta> or <Windows Key>) default
Run xmodmap -pm to see a list of all possible keys.
Example:
"mod1" <-- Is Alt_L
"mod2" <-- is Numlock
"mod3" <-- Nothing on my system
"mod4" <-- for the super/windows key
"mod5" <-- for the shift key
]] --
modkey = 'Mod4',
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',
},
},
},
}

View File

@@ -1,5 +1,9 @@
local ipairs = ipairs
local io = io
local Gio = require('lgi').Gio local Gio = require('lgi').Gio
local aspawn = require('awful.spawn') local aspawn = require('awful.spawn')
local beautiful = require('beautiful')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local capi = { local capi = {
@@ -14,11 +18,13 @@ local function is_restart()
return restart_detected return restart_detected
end 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(table) do for _, t in ipairs(beautiful.user_config.autostart) do
aspawn(t); aspawn(t);
end end
local path = gfilesystem.get_xdg_config_home() .. 'autostart/' local path = gfilesystem.get_xdg_config_home() .. 'autostart/'
@@ -31,4 +37,7 @@ return function(table)
Gio.AppInfo.launch_uris_async(Gio.AppInfo.create_from_commandline(Gio.DesktopAppInfo.get_string(app, 'Exec'), nil, 0)) Gio.AppInfo.launch_uris_async(Gio.AppInfo.create_from_commandline(Gio.DesktopAppInfo.get_string(app, 'Exec'), nil, 0))
end end
end end
end,
})
end end
return instance

View File

@@ -1,17 +1,19 @@
local lgi = require('lgi') local assert = assert
local GLib = lgi.GLib local error = error
local Gio = lgi.Gio local io = io
local pairs = pairs
-- Awesome libs
local aspawn = require('awful.spawn')
local gfilesystem = require('gears.filesystem')
local gobject = require('gears.object') local gobject = require('gears.object')
local gtable = require('gears.table') 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 json = require('src.lib.json-lua.json-lua')
local config = {} local config = {}
local instance
---Takes a file path and puts the content into the callback ---Takes a file path and puts the content into the callback
---@param path string file path, caller has to make sure it exists ---@param path string file path, caller has to make sure it exists
---@return string|nil file_content ---@return string|nil file_content
@@ -58,7 +60,10 @@ config.write_json = function(path, content)
handler:close() handler:close()
end end
local function new() local instance = nil
if not instance then
instance = setmetatable(config, {
__call = function()
local ret = gobject {} local ret = gobject {}
gtable.crush(ret, config, true) gtable.crush(ret, config, true)
@@ -78,10 +83,8 @@ local function new()
end end
return ret return ret
end end,
})
if not instance then
instance = new()
end end
return instance return instance

View File

@@ -1,23 +1,31 @@
local setmetatable = setmetatable
-- Libraries -- Libraries
local lgi = require('lgi') local lgi = require('lgi')
local Gtk = lgi.require('Gtk', '3.0') local Gtk = lgi.require('Gtk', '3.0')
-- Init a new Gtk theme from the users string local icon_lookup = {}
local gtk_theme = Gtk.IconTheme.get_default()
---Gets the icon path from an AppInfo gicon. function icon_lookup:get_gicon_path(app, icon_string)
---@param app Gio.AppInfo|nil
---@param icon_string string|nil
---@return string|nil path
function Get_gicon_path(app, icon_string)
if (not app) and (not icon_string) then return end if (not app) and (not icon_string) then return end
if icon_string then 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 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 if icon_info then
return icon_info:get_filename() return icon_info:get_filename()
end end
return nil return nil
end 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

View File

@@ -13,12 +13,12 @@ function backlight.brightness_get_async(callback)
end end
function backlight:brightness_increase() function backlight:brightness_increase()
aspawn('brightnessctl set +2%') aspawn('brightnessctl set 2+%')
self:emit_signal('brightness_changed') self:emit_signal('brightness_changed')
end end
function backlight:brightness_decrease() function backlight:brightness_decrease()
aspawn('brightnessctl set -2%') aspawn('brightnessctl set 2-%')
self:emit_signal('brightness_changed') self:emit_signal('brightness_changed')
end end

View File

@@ -1,5 +1,6 @@
local gobject = require('gears.object') local gobject = require('gears.object')
local watch = require('awful.widget.watch') local watch = require('awful.widget.watch')
local beautiful = require('beautiful')
local instance = nil local instance = nil
@@ -14,14 +15,14 @@ local function new()
end end
local average = 0 local average = 0
if User_config.clock_mode == 'average' then if beautiful.user_config.clock_mode == 'average' then
for i = 1, #cpu_freq do for i = 1, #cpu_freq do
average = average + cpu_freq[i] average = average + cpu_freq[i]
end end
average = math.floor((average / #cpu_freq) + 0.5) average = math.floor((average / #cpu_freq) + 0.5)
self:emit_signal('update::cpu_freq_average', average) self:emit_signal('update::cpu_freq_average', average)
elseif User_config.clock_mode then elseif beautiful.user_config.clock_mode then
self:emit_signal('update::cpu_freq_core', cpu_freq[User_config.clock_mode]) self:emit_signal('update::cpu_freq_core', cpu_freq[beautiful.user_config.clock_mode])
end end
end) end)

View File

@@ -2,6 +2,7 @@
local gobject = require('gears.object') local gobject = require('gears.object')
local gtable = require('gears.table') local gtable = require('gears.table')
local aspawn = require('awful.spawn') local aspawn = require('awful.spawn')
local beautiful = require('beautiful')
local instance = nil local instance = nil
local kb_helper = {} local kb_helper = {}
@@ -37,7 +38,7 @@ local function new()
gtable.crush(self, kb_helper, true) gtable.crush(self, kb_helper, true)
self.layout_list = User_config.kblayout self.layout_list = beautiful.user_config.kblayout
return self return self
end end

View File

@@ -7,6 +7,7 @@ local gfilesystem = require('gears.filesystem')
local gtimer = require('gears.timer') local gtimer = require('gears.timer')
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gtable = require('gears.table') local gtable = require('gears.table')
local beautiful = require('beautiful')
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/notifications/' 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) local function on_loop_status(_, status)
if status == 'TRACK' then if status == 'TRACK' then
w:get_children_by_id('repeat')[1].image = gcolor.recolor_image(icondir .. 'repeat-once.svg', 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 elseif status == 'PLAYLIST' then
w:get_children_by_id('repeat')[1].image = gcolor.recolor_image(icondir .. 'repeat.svg', 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 else
w:get_children_by_id('repeat')[1].image = gcolor.recolor_image(icondir .. 'repeat.svg', 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
end end
@@ -173,10 +174,10 @@ local function start_manage(self, w, name)
local function on_shuffle(_, status) local function on_shuffle(_, status)
if status then if status then
w:get_children_by_id('shuffle')[1].image = gcolor.recolor_image(icondir .. 'shuffle.svg', 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 else
w:get_children_by_id('shuffle')[1].image = gcolor.recolor_image(icondir .. 'shuffle.svg', 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
end end

View File

@@ -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

View File

@@ -30,7 +30,7 @@ local function overlay_color(col, overlay, opacity)
end end
local function bg_hover(args) local function bg_hover(args)
--[[ args = args or {} args = args or {}
local old_cursor, old_wibox local old_cursor, old_wibox
local _, r, g, b, a = args.widget.bg:get_rgba() 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) args.widget:connect_signal('property::bg', function(_, newbg)
r, g, b, a = hex_to_rgba(newbg) r, g, b, a = hex_to_rgba(newbg)
end) ]] end)
end end
--[[ local function fg_hover(args) --[[ local function fg_hover(args)

View File

@@ -1,11 +1,9 @@
local gfilesystem = require("gears.filesystem") local gfilesystem = require('gears.filesystem')
local gobject = require("gears.object") local gobject = require('gears.object')
local gtable = require("gears.table") local gtable = require('gears.table')
local naughty = require("naughty") 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 = {} } local ical = { mt = {} }
ical.VCALENDAR = {} ical.VCALENDAR = {}
@@ -75,25 +73,25 @@ ical._private.parser = {}
function ical._private.add_to_cache(file, vcal) function ical._private.add_to_cache(file, vcal)
-- Copy file to src/config/files/calendar/ -- Copy file to src/config/files/calendar/
local path = gfilesystem.get_configuration_dir() .. "src/config/" local path = gfilesystem.get_configuration_dir() .. 'src/config/'
local file_name = file:match(".*/(.*)") local file_name = file:match('.*/(.*)')
if not if not
os.execute("cp " .. os.execute('cp ' ..
file .. " " .. gfilesystem.get_configuration_dir() .. "src/config/files/calendar/" .. file_name) then file .. ' ' .. gfilesystem.get_configuration_dir() .. 'src/config/files/calendar/' .. file_name) then
naughty.notification({ naughty.notification {
app_name = "Systemnotification", app_name = 'Systemnotification',
title = "Error", title = 'Error',
text = "Could not copy file to config/files/calendar/", text = 'Could not copy file to config/files/calendar/',
timeout = 0, timeout = 0,
urgency = "critical", urgency = 'critical',
}) }
return return
end end
local handler = io.open(path .. "calendar.json", "r") local handler = io.open(path .. 'calendar.json', 'r')
if not handler then return end if not handler then return end
local json_data = json:decode(handler:read("a")) local json_data = json:decode(handler:read('a'))
handler:close() handler:close()
if not (type(json_data) == "table") then return end if not (type(json_data) == 'table') then return end
table.insert(json_data, { table.insert(json_data, {
file = file_name, file = file_name,
VCALENDAR = vcal, VCALENDAR = vcal,
@@ -101,19 +99,19 @@ function ical._private.add_to_cache(file, vcal)
json_data = json:encode(json_data) 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 if not handler then return end
handler:write(json_data) handler:write(json_data)
handler:close() handler:close()
end end
function ical:add_calendar(file) function ical:add_calendar(file)
local handler = io.open(file, "r") local handler = io.open(file, 'r')
if not handler then return end if not handler then return end
-- Check if the line is a BEGIN:VCALENDAR -- 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 = {} 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) vcal = self._private.parser:VCALENDAR(handler)
table.insert(self.VCALENDAR, vcal) table.insert(self.VCALENDAR, vcal)
self._private.add_to_cache(file, vcal) self._private.add_to_cache(file, vcal)
@@ -124,12 +122,12 @@ function ical.new(args)
args = args or {} args = args or {}
local ret = gobject { enable_properties = true, enable_auto_signals = true } local ret = gobject { enable_properties = true, enable_auto_signals = true }
gtable.crush(ret, ical, true) gtable.crush(ret, ical, true)
local path = gfilesystem.get_configuration_dir() .. "src/config/calendar.json" local path = gfilesystem.get_configuration_dir() .. 'src/config/calendar.json'
local handler = io.open(path, "r") local handler = io.open(path, 'r')
if not handler then return ret end 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() handler:close()
if not (type(json_data) == "table") then return end if not (type(json_data) == 'table') then return end
--Load into the cache --Load into the cache
for _, v in ipairs(json_data) do for _, v in ipairs(json_data) do
ret._private.cache[v.file] = v.VCALENDAR ret._private.cache[v.file] = v.VCALENDAR
@@ -138,21 +136,7 @@ function ical.new(args)
local function get_random_color() local function get_random_color()
local colors = { local colors = {
color["Blue200"], '#FF0000',
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"],
} }
return colors[math.random(1, 15)] return colors[math.random(1, 15)]
@@ -167,63 +151,63 @@ function ical._private.parser:VEVENT(handler)
local VEVENT = {} local VEVENT = {}
while true do 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 break
end end
local v, k = line:match("(.*):(.*)") local v, k = line:match('(.*):(.*)')
if v:match("CREATED") then if v:match('CREATED') then
VEVENT.CREATED = self.to_datetime(k) 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) VEVENT.LAST_MODIFIED = self.to_datetime(k)
elseif v:match("DTSTAMP") then elseif v:match('DTSTAMP') then
VEVENT.DTSTAMP = self.to_datetime(k) VEVENT.DTSTAMP = self.to_datetime(k)
elseif v:match("UID") then elseif v:match('UID') then
VEVENT.UID = k VEVENT.UID = k
elseif v:match("SUMMARY") then elseif v:match('SUMMARY') then
VEVENT.SUMMARY = k VEVENT.SUMMARY = k
elseif v:match("STATUS") then elseif v:match('STATUS') then
VEVENT.STATUS = k VEVENT.STATUS = k
elseif v:match("RRULE") then elseif v:match('RRULE') then
VEVENT.RRULE = { VEVENT.RRULE = {
FREQ = k:match("FREQ=([A-Z]+)"), FREQ = k:match('FREQ=([A-Z]+)'),
UNTIL = self.to_datetime(k:match("UNTIL=([TZ0-9]+)")), UNTIL = self.to_datetime(k:match('UNTIL=([TZ0-9]+)')),
WKST = k:match("WKST=([A-Z]+)"), WKST = k:match('WKST=([A-Z]+)'),
COUNT = k:match("COUNT=([0-9]+)"), COUNT = k:match('COUNT=([0-9]+)'),
INTERVAL = k:match("INTERVAL=([0-9]+)") INTERVAL = k:match('INTERVAL=([0-9]+)'),
} }
elseif v:match("DTSTART") then elseif v:match('DTSTART') then
VEVENT.DTSTART = { VEVENT.DTSTART = {
DTSTART = self.to_datetime(k), DTSTART = self.to_datetime(k),
TZID = v:match("TZID=([a-zA-Z-\\/]+)"), TZID = v:match('TZID=([a-zA-Z-\\/]+)'),
VALUE = v:match("VALUE=([A-Z]+)") VALUE = v:match('VALUE=([A-Z]+)'),
} }
elseif v:match("DTEND") then elseif v:match('DTEND') then
VEVENT.DTEND = { VEVENT.DTEND = {
DTEND = self.to_datetime(k), DTEND = self.to_datetime(k),
TZID = v:match("TZID=([a-zA-Z-\\/]+)"), TZID = v:match('TZID=([a-zA-Z-\\/]+)'),
VALUE = v:match("VALUE=([A-Z]+)") VALUE = v:match('VALUE=([A-Z]+)'),
} }
elseif v:match("TRANSP") then elseif v:match('TRANSP') then
VEVENT.TRANSP = k VEVENT.TRANSP = k
elseif v:match("LOCATION") then elseif v:match('LOCATION') then
VEVENT.LOCATION = k VEVENT.LOCATION = k
elseif v:match("SEQUENCE") then elseif v:match('SEQUENCE') then
VEVENT.SEQUENCE = k VEVENT.SEQUENCE = k
elseif v:match("DESCRIPTION") then elseif v:match('DESCRIPTION') then
VEVENT.DESCRIPTION = k VEVENT.DESCRIPTION = k
elseif v:match("URL") then elseif v:match('URL') then
VEVENT.URL = { VEVENT.URL = {
URL = k, URL = k,
VALUE = v:match("VALUE=([A-Z]+)") VALUE = v:match('VALUE=([A-Z]+)'),
} }
elseif v:match("BEGIN") then elseif v:match('BEGIN') then
if k:match("VALARM") then if k:match('VALARM') then
VEVENT.VALARM = self:VALARM(handler) VEVENT.VALARM = self:VALARM(handler)
end end
elseif v:match("UID") then elseif v:match('UID') then
VEVENT.UID = k VEVENT.UID = k
end end
end end
@@ -235,8 +219,8 @@ end
function ical._private.parser.alarm_to_time(alarm) function ical._private.parser.alarm_to_time(alarm)
if not alarm then return end 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 --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 time = alarm:match('([-]?[0-9]+)[A-Z]')
local unit = alarm:match("[-]?[A-Z][A-Z][0-9]+([A-Z]*)") local unit = alarm:match('[-]?[A-Z][A-Z][0-9]+([A-Z]*)')
return time .. unit return time .. unit
end end
@@ -245,21 +229,21 @@ function ical._private.parser:VALARM(handler)
local VALARM = {} local VALARM = {}
while true do 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 break
end end
local v, k = line:match("(.*):(.*)") local v, k = line:match('(.*):(.*)')
if v:match("ACTION") then if v:match('ACTION') then
VALARM.ACTION = k VALARM.ACTION = k
elseif v:match("TRIGGER;VALUE=DURATION") then elseif v:match('TRIGGER;VALUE=DURATION') then
VALARM.TRIGGER = { VALARM.TRIGGER = {
VALUE = v:match("VALUE=(.*):"), VALUE = v:match('VALUE=(.*):'),
TRIGGER = self._private.parser.alarm_to_time(k) TRIGGER = self._private.parser.alarm_to_time(k),
} }
elseif v:match("DESCRIPTION") then elseif v:match('DESCRIPTION') then
VALARM.DESCRIPTION = k VALARM.DESCRIPTION = k
end end
end end
@@ -273,22 +257,22 @@ function ical._private.parser:VCALENDAR(handler)
VCALENDAR.VTIMEZONE = {} VCALENDAR.VTIMEZONE = {}
while true do 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 break
end end
local v, k = line:match("(.*):(.*)") local v, k = line:match('(.*):(.*)')
if v and k then if v and k then
if v:match("PRODID") then if v:match('PRODID') then
VCALENDAR.PRODID = k VCALENDAR.PRODID = k
elseif v:match("VERSION") then elseif v:match('VERSION') then
VCALENDAR.VERSION = k VCALENDAR.VERSION = k
elseif v:match("BEGIN") then elseif v:match('BEGIN') then
if k:match("VTIMEZONE") then if k:match('VTIMEZONE') then
VCALENDAR.VTIMEZONE = self:VTIMEZONE(handler) VCALENDAR.VTIMEZONE = self:VTIMEZONE(handler)
elseif k:match("VEVENT") then elseif k:match('VEVENT') then
table.insert(VCALENDAR.VEVENT, self:VEVENT(handler)) table.insert(VCALENDAR.VEVENT, self:VEVENT(handler))
end end
end end
@@ -303,20 +287,20 @@ function ical._private.parser:VTIMEZONE(handler)
local VTIMEZONE = {} local VTIMEZONE = {}
while true do 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 break
end end
local v, k = line:match("(.*):(.*)") local v, k = line:match('(.*):(.*)')
if v:match("TZID") then if v:match('TZID') then
VTIMEZONE.TZID = k VTIMEZONE.TZID = k
end end
if v:match("BEGIN") then if v:match('BEGIN') then
if k:match("DAYLIGHT") then if k:match('DAYLIGHT') then
VTIMEZONE.DAYLIGHT = self:DAYLIGHT(handler) VTIMEZONE.DAYLIGHT = self:DAYLIGHT(handler)
elseif k:match("STANDARD") then elseif k:match('STANDARD') then
VTIMEZONE.STANDARD = self:STANDARD(handler) VTIMEZONE.STANDARD = self:STANDARD(handler)
end end
end end
@@ -329,26 +313,26 @@ function ical._private.parser:DAYLIGHT(handler)
local DAYLIGHT = {} local DAYLIGHT = {}
while true do 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 break
end end
local v, k = line:match("(.*):(.*)") local v, k = line:match('(.*):(.*)')
if v:match("TZOFFSETFROM") then if v:match('TZOFFSETFROM') then
DAYLIGHT.TZOFFSETFROM = self.offset(k) DAYLIGHT.TZOFFSETFROM = self.offset(k)
elseif v:match("TZOFFSETTO") then elseif v:match('TZOFFSETTO') then
DAYLIGHT.TZOFFSETTO = self.offset(k) DAYLIGHT.TZOFFSETTO = self.offset(k)
elseif v:match("TZNAME") then elseif v:match('TZNAME') then
DAYLIGHT.TZNAME = k DAYLIGHT.TZNAME = k
elseif v:match("DTSTART") then elseif v:match('DTSTART') then
DAYLIGHT.DTSTART = self.to_datetime(k) DAYLIGHT.DTSTART = self.to_datetime(k)
elseif v:match("RRULE") then elseif v:match('RRULE') then
DAYLIGHT.RRULE = { DAYLIGHT.RRULE = {
FREQ = k:match("FREQ=([A-Z]+)"), FREQ = k:match('FREQ=([A-Z]+)'),
BYDAY = k:match("BYDAY=([%+%-0-9A-Z,]+)"), BYDAY = k:match('BYDAY=([%+%-0-9A-Z,]+)'),
BYMONTH = k:match("BYMONTH=([0-9]+)") BYMONTH = k:match('BYMONTH=([0-9]+)'),
} }
end end
end end
@@ -364,27 +348,27 @@ function ical._private.parser:STANDARD(handler)
-- Read each line until END:STANDARD is read -- Read each line until END:STANDARD is read
while true do 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 break
end end
-- Break down each line into the property:value -- Break down each line into the property:value
local v, k = line:match("(.*):(.*)") local v, k = line:match('(.*):(.*)')
if v:match("TZOFFSETFROM") then if v:match('TZOFFSETFROM') then
STANDARD.TZOFFSETFROM = self.offset(k) STANDARD.TZOFFSETFROM = self.offset(k)
elseif v:match("TZOFFSETTO") then elseif v:match('TZOFFSETTO') then
STANDARD.TZOFFSETTO = self.offset(k) STANDARD.TZOFFSETTO = self.offset(k)
elseif v:match("TZNAME") then elseif v:match('TZNAME') then
STANDARD.TZNAME = k STANDARD.TZNAME = k
elseif v:match("DTSTART") then elseif v:match('DTSTART') then
STANDARD.DTSTART = self.to_datetime(k) STANDARD.DTSTART = self.to_datetime(k)
elseif v:match("RRULE") then elseif v:match('RRULE') then
STANDARD.RRULE = { STANDARD.RRULE = {
FREQ = k:match("FREQ=([A-Z]+)"), FREQ = k:match('FREQ=([A-Z]+)'),
BYDAY = k:match("BYDAY=([%+%-0-9A-Z,]+)"), BYDAY = k:match('BYDAY=([%+%-0-9A-Z,]+)'),
BYMONTH = k:match("BYMONTH=([0-9]+)") BYMONTH = k:match('BYMONTH=([0-9]+)'),
} }
end end
end end
@@ -400,8 +384,8 @@ function ical._private.parser.to_datetime(datetime)
if not datetime then return end if not datetime then return end
local dt, utc = {}, nil local dt, utc = {}, nil
dt.year, dt.month, dt.day = datetime:match("^(%d%d%d%d)(%d%d)(%d%d)") 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.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 if (dt.hour == nil) or (dt.min == nil) or (dt.sec == nil) then
dt.hour, dt.min, dt.sec, utc = 0, 0, 0, nil dt.hour, dt.min, dt.sec, utc = 0, 0, 0, nil
@@ -412,8 +396,8 @@ function ical._private.parser.to_datetime(datetime)
end end
function ical._private.parser.offset(offset) function ical._private.parser.offset(offset)
local s, h, m = offset:match("([+-])(%d%d)(%d%d)") local s, h, m = offset:match('([+-])(%d%d)(%d%d)')
if s == "+" then s = 1 else s = -1 end if s == '+' then s = 1 else s = -1 end
return s * (tonumber(h) * 3600 + tonumber(m) * 60) return s * (tonumber(h) * 3600 + tonumber(m) * 60)
end end

View File

@@ -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

View File

@@ -1,13 +1,15 @@
------------------------------ local setmetatable = setmetatable
-- This is the audio widget -- local tonumber = tonumber
------------------------------
-- Awesome Libs -- Awesome Libs
local abutton = require('awful.button') local abutton = require('awful.button')
local apopup = require('awful.popup') 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 gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table') local gtable = require('gears.table')
local gtimer = require('gears.timer')
local wibox = require('wibox') local wibox = require('wibox')
-- Local libs -- Local libs
@@ -25,13 +27,17 @@ return setmetatable({}, { __call = function(_, screen)
local ac_popup = apopup { local ac_popup = apopup {
widget = audio_controller, widget = audio_controller,
ontop = true, ontop = true,
visible = false, visible = true,
screen = screen, screen = screen,
border_color = Theme_config.bluetooth_controller.container_border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.bluetooth_controller.container_border_width, border_width = dpi(2),
bg = Theme_config.bluetooth_controller.container_bg, bg = beautiful.colorscheme.bg,
} }
gtimer.delayed_call(function()
ac_popup.visible = false
end)
local w = wibox.widget { local w = wibox.widget {
{ {
{ {
@@ -63,14 +69,14 @@ return setmetatable({}, { __call = function(_, screen)
right = dpi(8), right = dpi(8),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.audio.bg, bg = beautiful.colorscheme.bg_yellow,
fg = Theme_config.audio.fg, fg = beautiful.colorscheme.fg_dark,
shape = Theme_config.audio.shape, shape = beautiful.shape[6],
widget = wibox.container.background, widget = wibox.container.background,
buttons = { gtable.join( buttons = { gtable.join(
abutton({}, 1, function() abutton({}, 1, function()
local geo = capi.mouse.coords() 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.x = geo.x - ac_popup.width / 2
ac_popup.visible = not ac_popup.visible ac_popup.visible = not ac_popup.visible
end) end)
@@ -84,7 +90,6 @@ return setmetatable({}, { __call = function(_, screen)
local audio_spacing = w:get_children_by_id('audio_layout')[1] local audio_spacing = w:get_children_by_id('audio_layout')[1]
audio_helper:connect_signal('sink::get', function(_, muted, volume) audio_helper:connect_signal('sink::get', function(_, muted, volume)
volume = tonumber(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 if w.volume == volume and w.muted == muted then return end
w.volume = volume w.volume = volume
@@ -92,7 +97,7 @@ return setmetatable({}, { __call = function(_, screen)
if muted then if muted then
audio_label.visible = false 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 else
if not volume then return end if not volume then return end
w.container:set_right(10) w.container:set_right(10)
@@ -111,7 +116,7 @@ return setmetatable({}, { __call = function(_, screen)
icon = icon .. '-high' icon = icon .. '-high'
end end
audio_label:set_text(volume .. '%') 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
end) end)

View File

@@ -1,13 +1,18 @@
-------------------------------- local ipairs = ipairs
-- This is the battery widget -- local mfloor = math.floor
-------------------------------- local setmetatable = setmetatable
-- Awesome Libs -- Awesome Libs
local awful = require('awful') local aspawn = require('awful.spawn')
local dpi = require('beautiful').xresources.apply_dpi local atooltip = require('awful.tooltip')
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 gsurface = require('gears.surface')
local gtimer = require('gears.timer')
local lgi = require('lgi') local lgi = require('lgi')
local naughty = require('naughty') local nnotification = require('naughty.notification')
local upower_glib = lgi.require('UPowerGlib') local upower_glib = lgi.require('UPowerGlib')
local wibox = require('wibox') local wibox = require('wibox')
@@ -19,13 +24,12 @@ local capi = {
} }
-- Icon directory path -- 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 local instance = nil
---@return wibox.widget if not instance then
return function(battery_kind) instance = setmetatable({}, {
__call = function(_, battery_kind)
-- Battery wibox.widget
local battery_widget = wibox.widget { local battery_widget = wibox.widget {
{ {
{ {
@@ -33,7 +37,7 @@ return function(battery_kind)
{ {
{ {
id = 'icon', id = 'icon',
image = gears.color.recolor_image(icondir .. 'battery-unknown.svg', Theme_config.battery.fg), image = gcolor.recolor_image(icondir .. 'battery-unknown.svg', beautiful.colorscheme.fg_dark),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -62,27 +66,18 @@ return function(battery_kind)
right = dpi(8), right = dpi(8),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.battery.bg, bg = beautiful.colorscheme.bg_purple,
fg = Theme_config.battery.fg, fg = beautiful.colorscheme.fg_dark,
shape = function(cr, width, height) shape = beautiful.shape[6],
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background, widget = wibox.container.background,
} }
-- Color change on mouse over
hover.bg_hover { widget = battery_widget } hover.bg_hover { widget = battery_widget }
-- Open an energy manager on click battery_widget:connect_signal('button::press', function()
battery_widget:connect_signal( aspawn(beautiful.user_config.energy_manager)
'button::press', end)
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 function get_device_path()
local paths = upower_glib.Client():get_devices() local paths = upower_glib.Client():get_devices()
local path_table = {} local path_table = {}
@@ -92,9 +87,6 @@ return function(battery_kind)
return path_table return path_table
end 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 function get_device_from_path(path)
local devices = upower_glib.Client():get_devices() local devices = upower_glib.Client():get_devices()
@@ -106,7 +98,7 @@ return function(battery_kind)
return nil return nil
end end
local tooltip = awful.tooltip { local tooltip = atooltip {
objects = { battery_widget }, objects = { battery_widget },
mode = 'inside', mode = 'inside',
preferred_alignments = 'middle', preferred_alignments = 'middle',
@@ -116,7 +108,7 @@ return function(battery_kind)
---Sets the battery information for the widget ---Sets the battery information for the widget
---@param device UPowerGlib.Device battery ---@param device UPowerGlib.Device battery
local function set_battery(device) local function set_battery(device)
local battery_percentage = math.floor(device.percentage + 0.5) local battery_percentage = mfloor(device.percentage + 0.5)
local battery_status = upower_glib.DeviceState[device.state]:lower() local battery_status = upower_glib.DeviceState[device.state]:lower()
local battery_temp = device.temperature local battery_temp = device.temperature
@@ -128,12 +120,12 @@ return function(battery_kind)
battery_time = device.time_to_full battery_time = device.time_to_full
end end
local battery_string = math.floor(battery_time / 3600) .. 'h, ' .. math.floor((battery_time / 60) % 60) .. 'm' local battery_string = mfloor(battery_time / 3600) .. 'h, ' .. mfloor((battery_time / 60) % 60) .. 'm'
if battery_temp == 0.0 then if battery_temp == 0.0 then
battery_temp = 'NaN' battery_temp = 'NaN'
else else
battery_temp = math.floor(battery_temp + 0.5) .. '°C' battery_temp = mfloor(battery_temp + 0.5) .. '°C'
end end
if not battery_percentage then if not battery_percentage then
@@ -144,35 +136,35 @@ return function(battery_kind)
battery_widget:get_children_by_id('label')[1].visible = true battery_widget:get_children_by_id('label')[1].visible = true
battery_widget:get_children_by_id('label')[1].text = battery_percentage .. '%' battery_widget:get_children_by_id('label')[1].text = battery_percentage .. '%'
tooltip.markup = "<span foreground='#64ffda'>Battery Status:</span> <span foreground='#90caf9'>" tooltip.markup = "<span foreground='" .. beautiful.colorscheme.bg_teal .. "'>Battery Status:</span> <span foreground='" .. beautiful.colorscheme.fg .. "'>"
.. battery_status .. "</span>\n<span foreground='#64ffda'>Remaining time:</span> <span foreground='#90caf9'>" .. battery_status .. "</span>\n<span foreground='" .. beautiful.colorscheme.bg_teal .. "'>Remaining time:</span> <span foreground='" .. beautiful.colorscheme.fg .. "'>"
.. battery_string .. "</span>\n<span foreground='#64ffda'>Temperature:</span> <span foreground='#90caf9'>" .. battery_string .. "</span>\n<span foreground='" .. beautiful.colorscheme.bg_teal .. "'>Temperature:</span> <span foreground='" .. beautiful.colorscheme.fg .. "'>"
.. battery_temp .. '</span>' .. battery_temp .. '</span>'
local icon = 'battery' local icon = 'battery'
if battery_status == 'fully-charged' or battery_status == 'charging' and battery_percentage == 100 then if battery_status == 'fully-charged' or battery_status == 'charging' and battery_percentage == 100 then
icon = icon .. '-' .. 'charging.svg' icon = icon .. '-' .. 'charging.svg'
naughty.notification { nnotification {
title = 'Battery notification', title = 'Battery notification',
message = 'Battery is fully charged', message = 'Battery is fully charged',
icon = icondir .. icon, icon = icondir .. icon,
timeout = 5, timeout = 5,
} }
battery_widget:get_children_by_id('icon')[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir battery_widget:get_children_by_id('icon')[1].image = gsurface.load_uncached(gcolor.recolor_image(icondir
.. icon, Theme_config.battery.fg)) .. icon, beautiful.colorscheme.fg_dark))
return return
elseif battery_percentage > 0 and battery_percentage < 10 and battery_status == 'discharging' then elseif battery_percentage > 0 and battery_percentage < 10 and battery_status == 'discharging' then
icon = icon .. '-' .. 'alert.svg' icon = icon .. '-' .. 'alert.svg'
naughty.notification { nnotification {
title = 'Battery warning', title = 'Battery warning',
message = 'Battery is running low!\n' .. battery_percentage .. '% left', message = 'Battery is running low!\n' .. battery_percentage .. '% left',
urgency = 'critical', urgency = 'critical',
icon = icondir .. icon, icon = icondir .. icon,
timeout = 60, timeout = 60,
} }
battery_widget:get_children_by_id('icon')[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir battery_widget:get_children_by_id('icon')[1].image = gsurface.load_uncached(gcolor.recolor_image(icondir
.. icon, Theme_config.battery.fg)) .. icon, beautiful.colorscheme.fg_dark))
return return
end end
@@ -198,20 +190,13 @@ return function(battery_kind)
icon = icon .. '-' .. battery_status .. '-' .. '90' icon = icon .. '-' .. battery_status .. '-' .. '90'
end end
battery_widget:get_children_by_id('icon')[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. battery_widget:get_children_by_id('icon')[1].image = gsurface.load_uncached(gcolor.recolor_image(icondir ..
icon .. '.svg', Theme_config.battery.fg)) icon .. '.svg', beautiful.colorscheme.fg_dark))
capi.awesome.emit_signal('update::battery_widget', battery_percentage, icondir .. icon .. '.svg') capi.awesome.emit_signal('update::battery_widget', battery_percentage, icondir .. icon .. '.svg')
end 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 function attach_to_device(path)
local device_path = User_config.battery_path or path or '' 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 = get_device_from_path(device_path) or upower_glib.Client():get_display_device()
@@ -219,28 +204,25 @@ return function(battery_kind)
battery_widget:emit_signal('upower::update', device) battery_widget:emit_signal('upower::update', device)
end 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 if upower_glib.DeviceKind[battery_widget.device.kind] == battery_kind then
set_battery(battery_widget.device) set_battery(battery_widget.device)
end end
-- The delayed call will fire every time awesome finishes its main event loop gtimer.delayed_call(battery_widget.emit_signal, battery_widget, 'upower::update', battery_widget.device)
gears.timer.delayed_call(battery_widget.emit_signal, battery_widget, 'upower::update', battery_widget.device)
end end
for _, device in ipairs(get_device_path()) do for _, device in ipairs(get_device_path()) do
attach_to_device(device) attach_to_device(device)
end end
battery_widget:connect_signal( battery_widget:connect_signal('upower::update', function(_, device)
'upower::update',
function(_, device)
if upower_glib.DeviceKind[battery_widget.device.kind] == battery_kind then if upower_glib.DeviceKind[battery_widget.device.kind] == battery_kind then
set_battery(device) set_battery(device)
end end
end end)
)
return battery_widget return battery_widget
end,
})
end end
return instance

View File

@@ -1,15 +1,16 @@
---------------------------------- local setmetatable = setmetatable
-- This is the bluetooth widget --
----------------------------------
-- Awesome libs -- Awesome libs
local awful = require('awful') local apopup = require('awful.popup')
local dpi = require('beautiful').xresources.apply_dpi local beautiful = require('beautiful')
local gears = require('gears') 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') local wibox = require('wibox')
-- Own libs -- Own libs
local bt_module = require('src.modules.bluetooth.init') local bt_module = require('src.modules.bluetooth')
local hover = require('src.tools.hover') local hover = require('src.tools.hover')
local capi = { local capi = {
@@ -18,11 +19,11 @@ local capi = {
} }
-- Icon directory path -- 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 -- Returns the bluetooth widget
return function(s) return setmetatable({}, {
__call = function(_, s)
-- Get the bluetooth module -- Get the bluetooth module
local bt_widget = bt_module { screen = s } local bt_widget = bt_module { screen = s }
-- Create the bluetooth widget -- Create the bluetooth widget
@@ -31,7 +32,7 @@ return function(s)
{ {
{ {
id = 'icon', id = 'icon',
image = gears.color.recolor_image(icondir .. 'bluetooth-off.svg', Theme_config.bluetooth.fg), image = gcolor.recolor_image(icondir .. 'bluetooth-off.svg', beautiful.colorscheme.bg),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -45,46 +46,42 @@ return function(s)
right = dpi(8), right = dpi(8),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.bluetooth.bg, bg = beautiful.colorscheme.bg_blue,
fg = Theme_config.bluetooth.fg, fg = beautiful.colorscheme.bg,
shape = function(cr, width, height) shape = beautiful.shape[6],
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background, widget = wibox.container.background,
} }
hover.bg_hover { widget = bluetooth_widget } hover.bg_hover { widget = bluetooth_widget }
-- 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 -- Create the awful.popup container for the module
local bluetooth_container = awful.popup { local bluetooth_container = apopup {
widget = bt_widget, widget = bt_widget,
ontop = true, ontop = true,
stretch = false, stretch = false,
visible = false, visible = true,
screen = s, screen = s,
border_color = Theme_config.bluetooth_controller.container_border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.bluetooth_controller.container_border_width, border_width = dpi(2),
bg = Theme_config.bluetooth_controller.container_bg, bg = beautiful.colorscheme.bg,
} }
gtimer.delayed_call(function()
bluetooth_container.visible = false
end)
-- When the status changes update the icon -- When the status changes update the icon
bt_widget:connect_signal('bluetooth::status', function(status) 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 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', Theme_config.bluetooth.fg) icondir .. 'bluetooth-on.svg' or icondir .. 'bluetooth-off.svg', beautiful.colorscheme.bg)
end) end)
-- On left click toggle the bluetooth container else toggle the bluetooth on/off -- On left click toggle the bluetooth container else toggle the bluetooth on/off
bluetooth_widget:connect_signal('button::press', function(_, _, _, key) bluetooth_widget:connect_signal('button::press', function(_, _, _, key)
if key == 1 then if key == 1 then
local geo = capi.mouse.current_wibox:geometry() local geo = capi.mouse.current_wibox:geometry()
bluetooth_container.x = geo.x bluetooth_container.x = capi.mouse.coords().x - (bluetooth_container:geometry().width / 2)
bluetooth_container.y = geo.y + dpi(55) bluetooth_container.y = dpi(70)
bluetooth_container.visible = not bluetooth_container.visible bluetooth_container.visible = not bluetooth_container.visible
else else
capi.awesome.emit_signal('toggle_bluetooth') capi.awesome.emit_signal('toggle_bluetooth')
@@ -92,4 +89,5 @@ return function(s)
end) end)
return bluetooth_widget return bluetooth_widget
end end,
})

View File

@@ -1,9 +1,8 @@
------------------------------ local setmetatable = setmetatable
-- This is the clock widget --
------------------------------
-- Awesome Libs -- 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 gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local wibox = require('wibox') local wibox = require('wibox')
@@ -15,13 +14,15 @@ local hover = require('src.tools.hover')
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/clock/' local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/clock/'
-- Returns the clock widget -- Returns the clock widget
return setmetatable({}, { __call = function() local instance = nil
if not instance then
instance = setmetatable({}, { __call = function()
local clock_widget = wibox.widget { local clock_widget = wibox.widget {
{ {
{ {
{ {
{ {
image = gcolor.recolor_image(icondir .. 'clock.svg', Theme_config.clock.fg), image = gcolor.recolor_image(icondir .. 'clock.svg', beautiful.colorscheme.bg),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -45,13 +46,15 @@ return setmetatable({}, { __call = function()
right = dpi(8), right = dpi(8),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.clock.bg, bg = beautiful.colorscheme.bg_yellow,
fg = Theme_config.clock.fg, fg = beautiful.colorscheme.bg,
shape = Theme_config.clock.shape, shape = beautiful.shape[6],
widget = wibox.container.background, widget = wibox.container.background,
} }
hover.bg_hover { widget = clock_widget } hover.bg_hover { widget = clock_widget }
return clock_widget return clock_widget
end, }) end, })
end
return instance

View File

@@ -1,25 +1,25 @@
--------------------------------- local mfloor = math.floor
-- This is the CPU Info widget -- local setmetatable = setmetatable
---------------------------------
-- Awesome Libs -- Awesome Libs
local base = require('wibox.widget.base') 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 gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table')
local wibox = require('wibox') local wibox = require('wibox')
-- Third Party Libs -- Third Party Libs
local color = require('src.lib.color') local color = require('src.lib.color')
local rubato = require('src.lib.rubato')
local hover = require('src.tools.hover') local hover = require('src.tools.hover')
local rubato = require('src.lib.rubato')
local icon_dir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/cpu/' local icon_dir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/cpu/'
local cpu_info = {} local instance = nil
if not instance then
local function cpu_temp_new() instance = setmetatable({}, { __call = function(_, widget)
if widget == 'temp' then
local cpu_temp_helper = require('src.tools.helpers.cpu_temp') 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 {
@@ -32,7 +32,7 @@ local function cpu_temp_new()
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
image = gcolor.recolor_image(icon_dir .. 'thermometer.svg', Theme_config.cpu_temp.fg), image = gcolor.recolor_image(icon_dir .. 'thermometer.svg', beautiful.colorscheme.bg),
resize = true, resize = true,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -55,21 +55,17 @@ local function cpu_temp_new()
right = dpi(5), right = dpi(5),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.cpu_temp.bg, bg = beautiful.colorscheme.bg_green,
fg = Theme_config.cpu_temp.fg, fg = beautiful.colorscheme.bg,
shape = Theme_config.cpu_temp.shape, shape = beautiful.shape[6],
widget = wibox.container.background, widget = wibox.container.background,
}) })
assert(w, 'Failed to create widget')
gtable.crush(w, cpu_info, true)
local r = rubato.timed { duration = 2.5 } local r = rubato.timed { duration = 2.5 }
local g = rubato.timed { duration = 2.5 } local g = rubato.timed { duration = 2.5 }
local b = rubato.timed { duration = 2.5 } local b = rubato.timed { duration = 2.5 }
r.pos, g.pos, b.pos = color.utils.hex_to_rgba(Theme_config.cpu_temp.bg_low) r.pos, g.pos, b.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_green)
-- Subscribable function to have rubato set the bg/fg color -- Subscribable function to have rubato set the bg/fg color
local function update_bg() local function update_bg()
@@ -90,24 +86,22 @@ local function cpu_temp_new()
local temp_color local temp_color
if temp < 50 then if temp < 50 then
temp_color = Theme_config.cpu_temp.bg_low temp_color = beautiful.colorscheme.bg_green
temp_icon = icon_dir .. 'thermometer-low.svg' temp_icon = icon_dir .. 'thermometer-low.svg'
elseif temp >= 50 and temp < 80 then elseif temp >= 50 and temp < 80 then
temp_color = Theme_config.cpu_temp.bg_mid temp_color = beautiful.colorscheme.bg_yellow
temp_icon = icon_dir .. 'thermometer.svg' temp_icon = icon_dir .. 'thermometer.svg'
elseif temp >= 80 then elseif temp >= 80 then
temp_color = Theme_config.cpu_temp.bg_high temp_color = beautiful.colorscheme.bg_red
temp_icon = icon_dir .. 'thermometer-high.svg' temp_icon = icon_dir .. 'thermometer-high.svg'
end end
w:get_children_by_id('icon_role')[1].image = temp_icon w:get_children_by_id('icon_role')[1].image = temp_icon
set_bg(temp_color) set_bg(temp_color)
w:get_children_by_id('text_role')[1].text = math.floor(temp) .. '°C' w:get_children_by_id('text_role')[1].text = mfloor(temp) .. '°C'
end) end)
return w return w
end elseif widget == 'usage' then
local function cpu_usage_new()
local cpu_usage_helper = require('src.tools.helpers.cpu_usage') local cpu_usage_helper = require('src.tools.helpers.cpu_usage')
local w = base.make_widget_from_value(wibox.widget { local w = base.make_widget_from_value(wibox.widget {
@@ -120,7 +114,7 @@ local function cpu_usage_new()
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
image = gcolor.recolor_image(icon_dir .. 'cpu.svg', Theme_config.cpu_usage.fg), image = gcolor.recolor_image(icon_dir .. 'cpu.svg', beautiful.colorscheme.bg),
resize = true, resize = true,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -144,26 +138,20 @@ local function cpu_usage_new()
right = dpi(5), right = dpi(5),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.cpu_usage.bg, bg = beautiful.colorscheme.bg_blue,
fg = Theme_config.cpu_usage.fg, fg = beautiful.colorscheme.bg,
shape = Theme_config.cpu_usage.shape, shape = beautiful.shape[6],
widget = wibox.container.background, widget = wibox.container.background,
}) })
assert(w, 'failed to create widget')
hover.bg_hover { widget = w } hover.bg_hover { widget = w }
gtable.crush(w, cpu_info, true)
cpu_usage_helper:connect_signal('update::cpu_usage', function(_, usage) cpu_usage_helper:connect_signal('update::cpu_usage', function(_, usage)
w:get_children_by_id('text_role')[1].text = usage .. '%' w:get_children_by_id('text_role')[1].text = usage .. '%'
end) end)
return w return w
end elseif widget == 'freq' then
local function cpu_freq_new()
local cpu_freq_helper = require('src.tools.helpers.cpu_freq') local cpu_freq_helper = require('src.tools.helpers.cpu_freq')
local w = base.make_widget_from_value(wibox.widget { local w = base.make_widget_from_value(wibox.widget {
@@ -176,7 +164,7 @@ local function cpu_freq_new()
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
image = gcolor.recolor_image(icon_dir .. 'cpu.svg', Theme_config.cpu_freq.fg), image = gcolor.recolor_image(icon_dir .. 'cpu.svg', beautiful.colorscheme.bg),
resize = true, resize = true,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -200,18 +188,14 @@ local function cpu_freq_new()
right = dpi(5), right = dpi(5),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.cpu_freq.bg, bg = beautiful.colorscheme.bg_blue,
fg = Theme_config.cpu_freq.fg, fg = beautiful.colorscheme.bg,
shape = Theme_config.cpu_freq.shape, shape = beautiful.shape[6],
widget = wibox.container.background, widget = wibox.container.background,
}) })
assert(w, 'failed to create widget')
hover.bg_hover { widget = w } hover.bg_hover { widget = w }
gtable.crush(w, cpu_info, true)
cpu_freq_helper:connect_signal('update::cpu_freq_average', function(_, average) cpu_freq_helper:connect_signal('update::cpu_freq_average', function(_, average)
w:get_children_by_id('text_role')[1].text = average .. 'Mhz' w:get_children_by_id('text_role')[1].text = average .. 'Mhz'
end) end)
@@ -221,16 +205,7 @@ local function cpu_freq_new()
end) end)
return w 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
end, }) end, })
end
return instance

View File

@@ -1,15 +1,15 @@
----------------------------- local setmetatable = setmetatable
-- This is the date widget --
-----------------------------
-- Awesome Libs -- Awesome Libs
local apopup = require('awful.popup')
local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox')
local abutton = require('awful.button') 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 gfilesystem = require('gears.filesystem')
local gtable = require('gears.table') local gtable = require('gears.table')
local gcolor = require('gears.color') local gtimer = require('gears.timer')
local wibox = require('wibox')
-- Local libs -- Local libs
local cal = require('src.modules.calendar.init') {} 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, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -51,9 +51,9 @@ return setmetatable({}, { __call = function(_, screen)
right = dpi(8), right = dpi(8),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.date.bg, bg = beautiful.colorscheme.bg_teal,
fg = Theme_config.date.fg, fg = beautiful.colorscheme.bg,
shape = Theme_config.date.shape, shape = beautiful.shape[6],
widget = wibox.container.background, widget = wibox.container.background,
} }
@@ -61,15 +61,20 @@ return setmetatable({}, { __call = function(_, screen)
widget = cal:get_widget(), widget = cal:get_widget(),
screen = screen, screen = screen,
ontop = true, 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 } hover.bg_hover { widget = date_widget }
date_widget:buttons { gtable.join( date_widget:buttons { gtable.join(
abutton({}, 1, function() abutton({}, 1, function()
local geo = capi.mouse.coords() 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 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 calendar_popup.x = capi.mouse.screen.geometry.x + capi.mouse.screen.geometry.width - calendar_popup.width
else else

View File

@@ -1,24 +1,29 @@
--------------------------------- local mmax = math.max
-- This is the gpu Info widget -- local setmetatable = setmetatable
--------------------------------- local tonumber = tonumber
local tostring = tostring
-- Awesome Libs -- Awesome Libs
local base = require('wibox.widget.base') 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 gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local wibox = require('wibox') local wibox = require('wibox')
-- Third Party Libs -- Third Party Libs
local color = require('src.lib.color') local color = require('src.lib.color')
local rubato = require('src.lib.rubato')
local hover = require('src.tools.hover') local hover = require('src.tools.hover')
local rubato = require('src.lib.rubato')
local icon_dir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/cpu/' local icon_dir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/cpu/'
local gpu_info = {} local gpu_info = {}
local function gpu_temp_new() 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 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 {
@@ -31,7 +36,7 @@ local function gpu_temp_new()
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
image = gcolor.recolor_image(icon_dir .. 'gpu.svg', Theme_config.gpu_temp.fg), image = gcolor.recolor_image(icon_dir .. 'gpu.svg', beautiful.colorscheme.bg),
resize = true, resize = true,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -55,24 +60,22 @@ local function gpu_temp_new()
right = dpi(5), right = dpi(5),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.gpu_temp.bg, bg = beautiful.colorscheme.bg_green,
fg = Theme_config.gpu_temp.fg, fg = beautiful.colorscheme.bg,
shape = Theme_config.gpu_temp.shape, shape = beautiful.shape[6],
widget = wibox.container.background, widget = wibox.container.background,
}) })
assert(w, 'Widget not created')
local r = rubato.timed { duration = 2.5 } local r = rubato.timed { duration = 2.5 }
local g = rubato.timed { duration = 2.5 } local g = rubato.timed { duration = 2.5 }
local b = rubato.timed { duration = 2.5 } local b = rubato.timed { duration = 2.5 }
r.pos, g.pos, b.pos = color.utils.hex_to_rgba(Theme_config.cpu_temp.bg_low) r.pos, g.pos, b.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_green)
-- Subscribable function to have rubato set the bg/fg color -- Subscribable function to have rubato set the bg/fg color
local function update_bg() local function update_bg()
w:set_bg('#' .. color.utils.rgba_to_hex { math.max(0, r.pos), math.max(0, g.pos), w:set_bg('#' .. color.utils.rgba_to_hex { mmax(0, r.pos), mmax(0, g.pos),
math.max(0, b.pos), }) mmax(0, b.pos), })
end end
r:subscribe(update_bg) r:subscribe(update_bg)
@@ -91,17 +94,17 @@ local function gpu_temp_new()
local temp_num = tonumber(stdout) or 0 local temp_num = tonumber(stdout) or 0
if temp_num then if temp_num then
if temp_num < 50 then if temp_num < 50 then
temp_color = Theme_config.gpu_temp.bg_low temp_color = beautiful.colorscheme.bg_green
temp_icon = icon_dir .. 'thermometer-low.svg' temp_icon = icon_dir .. 'thermometer-low.svg'
elseif temp_num >= 50 and temp_num < 80 then elseif temp_num >= 50 and temp_num < 80 then
temp_color = Theme_config.gpu_temp.bg_mid temp_color = beautiful.colorscheme.bg_yellow
temp_icon = icon_dir .. 'thermometer.svg' temp_icon = icon_dir .. 'thermometer.svg'
elseif temp_num >= 80 then elseif temp_num >= 80 then
temp_color = Theme_config.gpu_temp.bg_high temp_color = beautiful.colorscheme.bg_red
temp_icon = icon_dir .. 'thermometer-high.svg' temp_icon = icon_dir .. 'thermometer-high.svg'
end end
else else
temp_color = Theme_config.gpu_temp.bg_low temp_color = beautiful.colorscheme.bg_green
temp_icon = icon_dir .. 'thermometer-low.svg' temp_icon = icon_dir .. 'thermometer-low.svg'
end end
w:get_children_by_id('icon_role')[1]:set_image(temp_icon) w:get_children_by_id('icon_role')[1]:set_image(temp_icon)
@@ -110,9 +113,7 @@ local function gpu_temp_new()
end) end)
return w return w
end elseif widget == 'usage' then
local function gpu_usage_new()
local gpu_usage_helper = require('src.tools.helpers.gpu_usage') local gpu_usage_helper = require('src.tools.helpers.gpu_usage')
local w = base.make_widget_from_value(wibox.widget { local w = base.make_widget_from_value(wibox.widget {
@@ -125,7 +126,7 @@ local function gpu_usage_new()
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
image = gcolor.recolor_image(icon_dir .. 'gpu.svg', Theme_config.gpu_usage.fg), image = gcolor.recolor_image(icon_dir .. 'gpu.svg', beautiful.colorscheme.bg),
resize = true, resize = true,
}, },
widget = wibox.container.constraint, widget = wibox.container.constraint,
@@ -149,14 +150,12 @@ local function gpu_usage_new()
right = dpi(5), right = dpi(5),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.gpu_usage.bg, bg = beautiful.colorscheme.bg_green,
fg = Theme_config.gpu_usage.fg, fg = beautiful.colorscheme.bg,
shape = Theme_config.gpu_usage.shape, shape = beautiful.shape[6],
widget = wibox.container.background, 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) gpu_usage_helper:connect_signal('update::gpu_usage', function(_, stdout)
@@ -164,12 +163,7 @@ local function gpu_usage_new()
end) end)
return w return w
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
end, }) end, })
end
return instance

View File

@@ -1,19 +1,21 @@
------------------------------ local pairs = pairs
-- This is the audio widget -- local setmetatable = setmetatable
------------------------------ local tunpack = table.unpack
-- Awesome Libs -- Awesome Libs
local dpi = require('beautiful').xresources.apply_dpi local abutton = require('awful.button')
local wibox = require('wibox') local apopup = require('awful.popup')
local beautiful = require('beautiful')
local dpi = beautiful.xresources.apply_dpi
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table') local gtable = require('gears.table')
local abutton = require('awful.button') local gtimer = require('gears.timer')
local apopup = require('awful.popup') local wibox = require('wibox')
-- Local libs -- Local libs
local kb_helper = require('src.tools.helpers.kb_helper')
local hover = require('src.tools.hover') local hover = require('src.tools.hover')
local kb_helper = require('src.tools.helpers.kb_helper')
local capi = { local capi = {
mouse = mouse, mouse = mouse,
@@ -36,11 +38,11 @@ local function create_kb_layout_list()
margins = dpi(10), margins = dpi(10),
}, },
widget = wibox.container.background, widget = wibox.container.background,
bg = Theme_config.kblayout.bg_container, bg = beautiful.colorscheme.bg,
} }
local list = widget:get_children_by_id('list')[1] 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 -- TODO: Add more, too lazy rn
local xkeyboard_country_code = { local xkeyboard_country_code = {
['af'] = { 'أفغانيش(Afghanistan)', 'AFG' }, -- Afghanistan ['af'] = { 'أفغانيش(Afghanistan)', 'AFG' }, -- Afghanistan
@@ -136,23 +138,23 @@ local function create_kb_layout_list()
['za'] = { '', 'ZAF' }, -- South Africa ['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 { local kb_layout_item = wibox.widget {
{ {
{ {
{ {
id = 'shortname', id = 'shortname',
markup = '<span foreground="' .. Theme_config.kblayout.item.fg_short .. '">' .. shortname .. '</span>', markup = '<span foreground="' .. beautiful.colorscheme.bg_purple .. '">' .. shortname .. '</span>',
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
}, },
{ {
id = 'longname', id = 'longname',
markup = '<span foreground="' .. Theme_config.kblayout.item.fg_long .. '">' .. longname .. '</span>', markup = '<span foreground="' .. beautiful.colorscheme.bg_red .. '">' .. longname .. '</span>',
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
font = User_config.font.bold, font = beautiful.user_config.font.bold,
}, },
spacing = dpi(15), spacing = dpi(15),
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
@@ -161,38 +163,38 @@ local function create_kb_layout_list()
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
id = 'hover', id = 'hover',
shape = Theme_config.kblayout.item.shape, shape = beautiful.shape[6],
border_width = Theme_config.kblayout.item.border_width, border_width = dpi(2),
border_color = Theme_config.kblayout.item.border_color, border_color = beautiful.colorscheme.border_color,
bg = Theme_config.kblayout.item.bg, bg = beautiful.colorscheme.bg,
widget = wibox.container.background, widget = wibox.container.background,
} }
kb_helper:connect_signal('KB::layout_changed', function(_, k) kb_helper:connect_signal('KB::layout_changed', function(_, k)
if keymap == k then if keymap == k then
kb_layout_item.bg = Theme_config.kblayout.item.bg_selected kb_layout_item.bg = beautiful.colorscheme.bg_purple
kb_layout_item.border_color = Theme_config.kblayout.item.bg_selected kb_layout_item.border_color = beautiful.colorscheme.bg_purple
kb_layout_item:get_children_by_id('shortname')[1].markup = '<span foreground="' .. Theme_config.kblayout.item.fg_selected .. '">' .. shortname .. '</span>' kb_layout_item:get_children_by_id('shortname')[1].markup = '<span foreground="' .. beautiful.colorscheme.bg .. '">' .. shortname .. '</span>'
kb_layout_item:get_children_by_id('longname')[1].markup = '<span foreground="' .. Theme_config.kblayout.item.fg_selected .. '">' .. longname .. '</span>' kb_layout_item:get_children_by_id('longname')[1].markup = '<span foreground="' .. beautiful.colorscheme.bg .. '">' .. longname .. '</span>'
else else
kb_layout_item.bg = Theme_config.kblayout.item.bg kb_layout_item.bg = beautiful.colorscheme.bg
kb_layout_item.border_color = Theme_config.kblayout.item.border_color kb_layout_item.border_color = beautiful.colorscheme.border_color
kb_layout_item:get_children_by_id('shortname')[1].markup = '<span foreground="' .. Theme_config.kblayout.item.fg_short .. '">' .. shortname .. '</span>' kb_layout_item:get_children_by_id('shortname')[1].markup = '<span foreground="' .. beautiful.colorscheme.bg_purple .. '">' .. shortname .. '</span>'
kb_layout_item:get_children_by_id('longname')[1].markup = '<span foreground="' .. Theme_config.kblayout.item.fg_long .. '">' .. longname .. '</span>' kb_layout_item:get_children_by_id('longname')[1].markup = '<span foreground="' .. beautiful.colorscheme.bg_red .. '">' .. longname .. '</span>'
end end
end) end)
kb_helper:get_layout_async(function(k) kb_helper:get_layout_async(function(k)
if keymap == k then if keymap == k then
kb_layout_item.bg = Theme_config.kblayout.item.bg_selected kb_layout_item.bg = beautiful.colorscheme.bg_purple
kb_layout_item.border_color = Theme_config.kblayout.item.bg_selected kb_layout_item.border_color = beautiful.colorscheme.bg_purple
kb_layout_item:get_children_by_id('shortname')[1].markup = '<span foreground="' .. Theme_config.kblayout.item.fg_selected .. '">' .. shortname .. '</span>' kb_layout_item:get_children_by_id('shortname')[1].markup = '<span foreground="' .. beautiful.colorscheme.bg .. '">' .. shortname .. '</span>'
kb_layout_item:get_children_by_id('longname')[1].markup = '<span foreground="' .. Theme_config.kblayout.item.fg_selected .. '">' .. longname .. '</span>' kb_layout_item:get_children_by_id('longname')[1].markup = '<span foreground="' .. beautiful.colorscheme.bg .. '">' .. longname .. '</span>'
else else
kb_layout_item.bg = Theme_config.kblayout.item.bg kb_layout_item.bg = beautiful.colorscheme.bg
kb_layout_item.border_color = Theme_config.kblayout.item.border_color kb_layout_item.border_color = beautiful.colorscheme.border_color
kb_layout_item:get_children_by_id('shortname')[1].markup = '<span foreground="' .. Theme_config.kblayout.item.fg_short .. '">' .. shortname .. '</span>' kb_layout_item:get_children_by_id('shortname')[1].markup = '<span foreground="' .. beautiful.colorscheme.bg_purple .. '">' .. shortname .. '</span>'
kb_layout_item:get_children_by_id('longname')[1].markup = '<span foreground="' .. Theme_config.kblayout.item.fg_long .. '">' .. longname .. '</span>' kb_layout_item:get_children_by_id('longname')[1].markup = '<span foreground="' .. beautiful.colorscheme.bg_red .. '">' .. longname .. '</span>'
end end
end) end)
@@ -201,7 +203,6 @@ local function create_kb_layout_list()
kb_layout_item:buttons { gtable.join( kb_layout_item:buttons { gtable.join(
abutton({}, 1, function() abutton({}, 1, function()
kb_helper:set_layout(keymap) kb_helper:set_layout(keymap)
--kb_layout_popup.visible = not kb_layout_popup.visible
end) end)
), } ), }
@@ -221,7 +222,7 @@ return setmetatable({}, { __call = function(_, screen)
resize = true, resize = true,
valign = 'center', valign = 'center',
halign = '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, widget = wibox.container.constraint,
width = dpi(24), width = dpi(24),
@@ -241,9 +242,9 @@ return setmetatable({}, { __call = function(_, screen)
right = dpi(8), right = dpi(8),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.kblayout.bg, bg = beautiful.colorscheme.bg_green,
fg = Theme_config.kblayout.fg, fg = beautiful.colorscheme.bg,
shape = Theme_config.kblayout.shape, shape = beautiful.shape[6],
widget = wibox.container.background, widget = wibox.container.background,
} }
@@ -259,18 +260,24 @@ return setmetatable({}, { __call = function(_, screen)
kb_layout_popup = apopup { kb_layout_popup = apopup {
widget = create_kb_layout_list(), widget = create_kb_layout_list(),
border_color = Theme_config.kblayout.border_color, border_color = beautiful.colorscheme.border_color,
border_width = Theme_config.kblayout.border_width, border_width = dpi(2),
screen = screen, screen = screen,
ontop = true, ontop = true,
visible = false, visible = true,
bg = Theme_config.kblayout.bg_container, 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( kblayout_widget:buttons { gtable.join(
abutton({}, 1, function() abutton({}, 1, function()
local geo = capi.mouse.coords() 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.x = geo.x - kb_layout_popup.width / 2
kb_layout_popup.visible = not kb_layout_popup.visible kb_layout_popup.visible = not kb_layout_popup.visible
end) end)

View File

@@ -1,41 +1,19 @@
---------------------------------- local setmetatable = setmetatable
-- This is the layoutbox widget --
----------------------------------
-- Awesome Libs -- Awesome Libs
local abutton = require('awful.button') local abutton = require('awful.button')
local alayout = require('awful.layout') local alayout = require('awful.layout')
local awidget = require('awful.widget') 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 gtable = require('gears.table')
local wibox = require('wibox') local wibox = require('wibox')
-- Local libs -- Local libs
local hover = require('src.tools.hover') local hover = require('src.tools.hover')
--#region Layout icons return setmetatable({}, {
local layout_path = Theme_path .. '../assets/layout/' __call = function(_, screen)
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 { local layout = wibox.widget {
{ {
{ {
@@ -51,8 +29,8 @@ return function()
strategy = 'exact', strategy = 'exact',
width = dpi(40), width = dpi(40),
}, },
bg = Theme_config.layout_list.bg, bg = beautiful.colorscheme.bg_blue,
shape = Theme_config.layout_list.shape, shape = beautiful.shape[6],
widget = wibox.container.background, widget = wibox.container.background,
} }
@@ -60,18 +38,19 @@ return function()
layout:buttons(gtable.join( layout:buttons(gtable.join(
abutton({}, 1, function() abutton({}, 1, function()
alayout.inc(1) alayout.inc(1, screen)
end), end),
abutton({}, 3, function() abutton({}, 3, function()
alayout.inc(-1) alayout.inc(-1, screen)
end), end),
abutton({}, 4, function() abutton({}, 4, function()
alayout.inc(1) alayout.inc(1, screen)
end), end),
abutton({}, 5, function() abutton({}, 5, function()
alayout.inc(-1) alayout.inc(-1, screen)
end) end)
)) ))
return layout return layout
end end,
})

View File

@@ -1,40 +1,40 @@
-------------------------------- local setmetatable = setmetatable
-- This is the network widget -- local mfloor = math.floor
--------------------------------
-- Awesome Libs -- Awesome Libs
local abutton = require('awful.button') local abutton = require('awful.button')
local apopup = require('awful.popup') local apopup = require('awful.popup')
local atooltip = require('awful.tooltip') local atooltip = require('awful.tooltip')
local base = require('wibox.widget.base') local base = require('wibox.widget.base')
local dpi = require('beautiful').xresources.apply_dpi local beautiful = require('beautiful')
local gears = require('gears') local dpi = beautiful.xresources.apply_dpi
local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table') local gtable = require('gears.table')
local gtimer = require('gears.timer')
local wibox = require('wibox') local wibox = require('wibox')
-- Local Libs
local hover = require('src.tools.hover')
local nm_widget = require('src.modules.network_controller')
local capi = { local capi = {
awesome = awesome, awesome = awesome,
mouse = mouse, mouse = mouse,
} }
-- Icon directory path -- 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 {}
return setmetatable({}, {
__call = function(_, screen)
local w = base.make_widget_from_value { local w = base.make_widget_from_value {
{ {
{ {
{ {
{ {
id = 'wifi_icon', id = 'wifi_icon',
image = gears.color.recolor_image(icondir .. 'no-internet.svg', Theme_config.network.fg), image = gcolor.recolor_image(icondir .. 'no-internet.svg', beautiful.colorscheme.bg),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
resize = false, resize = false,
}, },
@@ -54,23 +54,19 @@ function network.new(args)
halign = 'center', halign = 'center',
valign = 'center', valign = 'center',
}, },
bg = Theme_config.network.bg, bg = beautiful.colorscheme.bg_red,
fg = Theme_config.network.fg, fg = beautiful.colorscheme.bg,
shape = Theme_config.network.shape, shape = beautiful.shape[6],
widget = wibox.container.background, widget = wibox.container.background,
} }
assert(w, 'Failed to create widget')
hover.bg_hover { widget = w } hover.bg_hover { widget = w }
gtable.crush(w, network, true)
capi.awesome.connect_signal('NM::AccessPointStrength', function(strength) capi.awesome.connect_signal('NM::AccessPointStrength', function(strength)
strength = math.floor(strength) strength = mfloor(strength)
w:get_children_by_id('wifi_strength')[1].text = 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 .. w:get_children_by_id('wifi_icon')[1].image = gcolor.recolor_image(icondir ..
'wifi-strength-' .. math.floor(strength / 25) + 1 .. '.svg', Theme_config.network.fg) 'wifi-strength-' .. mfloor(strength / 25) + 1 .. '.svg', beautiful.colorscheme.bg)
end) end)
capi.awesome.connect_signal('NM::EthernetStatus', function(connected, speed) capi.awesome.connect_signal('NM::EthernetStatus', function(connected, speed)
@@ -81,39 +77,38 @@ function network.new(args)
margins = dpi(10), margins = dpi(10),
} }
if connected then if connected then
w:get_children_by_id('wifi_icon')[1].image = gears.color.recolor_image(icondir .. 'ethernet.svg', w:get_children_by_id('wifi_icon')[1].image = gcolor.recolor_image(icondir .. 'ethernet.svg',
Theme_config.network.fg) beautiful.colorscheme.bg)
tt.text = 'Connected via Ethernet at ' .. math.floor(speed or 0) .. '/Mbps' tt.text = 'Connected via Ethernet at ' .. mfloor(speed or 0) .. '/Mbps'
else else
w:get_children_by_id('wifi_icon')[1].image = gears.color.recolor_image(icondir .. 'no-internet.svg', w:get_children_by_id('wifi_icon')[1].image = gcolor.recolor_image(icondir .. 'no-internet.svg',
Theme_config.network.fg) beautiful.colorscheme.bg)
tt.text = 'No connection found' tt.text = 'No connection found'
end end
end) end)
local nm = nm_widget { screen = args.screen } local nm = nm_widget { screen = screen }
local network_controler_popup = apopup { local network_controler_popup = apopup {
widget = nm, widget = nm,
visible = false, visible = true,
ontop = true, ontop = true,
screen = args.screen, screen = screen,
} }
gtimer.delayed_call(function()
network_controler_popup.visible = false
end)
w:buttons(gtable.join( w:buttons(gtable.join(
abutton({}, 1, function() abutton({}, 1, function()
--This gets the wrong wibox, get all wiboxed and find the correct widget --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.x = capi.mouse.coords().x - (network_controler_popup:geometry().width / 2)
network_controler_popup.y = dpi(65) network_controler_popup.y = dpi(70)
network_controler_popup.visible = not network_controler_popup.visible network_controler_popup.visible = not network_controler_popup.visible
end) end)
)) ))
return w return w
end end,
})
function network.mt:__call(...)
return network.new(...)
end
return setmetatable(network, network.mt)

View File

@@ -1,28 +1,29 @@
-------------------------------- local setmetatable = setmetatable
-- This is the power widget --
--------------------------------
-- Awesome Libs -- Awesome Libs
local abutton = require('awful.button') local abutton = require('awful.button')
local gtable = require('gears.table') local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local wibox = require('wibox')
local gfilesystem = require('gears.filesystem')
local gcolor = require('gears.color') local gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table')
local wibox = require('wibox')
-- Local libs -- Local libs
local powermenu = require('src.modules.powermenu.init')
local hover = require('src.tools.hover') local hover = require('src.tools.hover')
local powermenu = require('src.modules.powermenu')
-- Icon directory path -- Icon directory path
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/power/' 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), image = gcolor.recolor_image(icondir .. 'power.svg', beautiful.colorscheme.bg),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
@@ -32,9 +33,9 @@ return setmetatable({}, { __call = function()
right = dpi(8), right = dpi(8),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.power_button.bg, bg = beautiful.colorscheme.bg_red,
fg = Theme_config.power_button.fg, fg = beautiful.colorscheme.bg,
shape = Theme_config.power_button.shape, shape = beautiful.shape[6],
widget = wibox.container.background, widget = wibox.container.background,
} }
@@ -48,4 +49,6 @@ return setmetatable({}, { __call = function()
), } ), }
return power_widget return power_widget
end, }) end, })
end
return instance

View File

@@ -1,20 +1,24 @@
--------------------------------- local setmetatable = setmetatable
-- This is the RAM Info widget -- local string = string
--------------------------------- local tostring = tostring
-- Awesome Libs -- 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 gcolor = require('gears.color')
local gfilesystem = require('gears.filesystem') local gfilesystem = require('gears.filesystem')
local gshape = require('gears.shape')
local wibox = require('wibox') local wibox = require('wibox')
local ram_helper = require('src.tools.helpers.ram') -- Local Libs
local hover = require('src.tools.hover') 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/' local icon_dir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/cpu/'
return function() local instance = nil
if not instance then
instance = setmetatable({}, {
__call = function()
local ram_widget = wibox.widget { local ram_widget = wibox.widget {
{ {
{ {
@@ -25,7 +29,7 @@ return function()
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
valign = 'center', valign = 'center',
halign = 'center', halign = 'center',
image = gcolor.recolor_image(icon_dir .. 'ram.svg', Theme_config.ram_info.fg), image = gcolor.recolor_image(icon_dir .. 'ram.svg', beautiful.colorscheme.fg),
resize = false, resize = false,
}, },
id = 'icon_layout', id = 'icon_layout',
@@ -50,21 +54,22 @@ return function()
right = dpi(8), right = dpi(8),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = Theme_config.ram_info.bg, bg = beautiful.colorscheme.bg_red,
fg = Theme_config.ram_info.fg, fg = beautiful.colorscheme.bg,
shape = function(cr, width, height) shape = beautiful.shape[6],
gshape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background, widget = wibox.container.background,
} }
hover.bg_hover { widget = ram_widget } hover.bg_hover { widget = ram_widget }
ram_helper:connect_signal('update::ram_widget', function(_, MemTotal, MemFree, MemAvailable) ram_helper:connect_signal('update::ram_widget', function(_, MemTotal, _, MemAvailable)
local ram_string = tostring(string.format('%.1f', ((MemTotal - MemAvailable) / 1024 / 1024)) .. local ram_string = tostring(string.format('%.1f', ((MemTotal - MemAvailable) / 1024 / 1024)) ..
'/' .. string.format('%.1f', (MemTotal / 1024 / 1024)) .. 'GB'):gsub(',', '.') '/' .. string.format('%.1f', (MemTotal / 1024 / 1024)) .. 'GB'):gsub(',', '.')
ram_widget.container.ram_layout.label.text = ram_string ram_widget.container.ram_layout.label.text = ram_string
end) end)
return ram_widget return ram_widget
end,
})
end end
return instance

View File

@@ -3,48 +3,72 @@
-------------------------------- --------------------------------
-- Awesome Libs -- Awesome Libs
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox') 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 local instance = nil
Theme.bg_systray = Theme_config.systray.bg if not instance then
Theme.systray_icon_spacing = dpi(10) instance = setmetatable({}, {
__call = function()
return function()
local systray = wibox.widget { 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(), wibox.widget.systray(),
id = 'systray_margin', id = 'systray_margin',
margins = dpi(6),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
strategy = 'exact', strategy = 'exact',
widget = wibox.container.constraint, widget = wibox.container.constraint,
}, },
widget = wibox.container.place,
},
id = 'lay',
layout = wibox.layout.fixed.horizontal,
},
widget = wibox.container.background, widget = wibox.container.background,
shape = Theme_config.systray.shape, shape = beautiful.shape[6],
bg = Theme_config.systray.bg bg = beautiful.colorscheme.bg1,
} }
local systray_margin = systray:get_children_by_id('systray_margin')[1] systray:buttons {
abutton({}, 1, function()
local c = systray:get_children_by_id('lay')[1].children[2]
c.visible = not c.visible
-- Wait for an systray update if not c.visible then
capi.awesome.connect_signal('systray::update', function() systray:get_children_by_id('lay')[1].children[1].children[1].image = icondir .. 'chevron-left.svg'
-- Get the number of entries in the systray
local num_entries = capi.awesome.systray()
-- If its 0 remove the margins to hide the widget
if num_entries == 0 then
systray_margin:set_margins(0)
else else
systray_margin:set_margins(dpi(6)) systray:get_children_by_id('lay')[1].children[1].children[1].image = icondir .. 'chevron-right.svg'
end end
end) end),
}
-- Set the icon size -- Set the icon size
systray_margin.widget:set_base_size(dpi(24)) systray:get_children_by_id('systray_margin')[1].widget:set_base_size(dpi(24))
return systray return systray
end,
})
end end
return instance

View File

@@ -1,13 +1,13 @@
-------------------------------- local ipairs = ipairs
-- This is the taglist widget -- local setmetatable = setmetatable
--------------------------------
-- Awesome Libs -- Awesome Libs
local abutton = require('awful.button') local abutton = require('awful.button')
local ascreen = require('awful.screen') local ascreen = require('awful.screen')
local atag = require('awful.tag') local atag = require('awful.tag')
local awidget = require('awful.widget') 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 gtable = require('gears.table')
local wibox = require('wibox') local wibox = require('wibox')
@@ -16,7 +16,7 @@ local hover = require('src.tools.hover')
local capi = { client = client } local capi = { client = client }
local modkey = User_config.modkey local modkey = beautiful.user_config.modkey
local tag_text = { local tag_text = {
[1] = '', [1] = '',
@@ -40,7 +40,6 @@ return setmetatable({}, { __call = function(_, screen)
widget:reset() widget:reset()
-- Create a tag widget for each tag -- Create a tag widget for each tag
for _, tag in ipairs(tags) do for _, tag in ipairs(tags) do
local tag_widget = wibox.widget { local tag_widget = wibox.widget {
{ {
{ {
@@ -59,9 +58,9 @@ return setmetatable({}, { __call = function(_, screen)
right = dpi(10), right = dpi(10),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
fg = Theme_config.taglist.fg, fg = beautiful.colorscheme.fg,
bg = Theme_config.taglist.bg, bg = beautiful.colorscheme.bg1,
shape = Theme_config.taglist.shape, shape = beautiful.shape[6],
widget = wibox.container.background, widget = wibox.container.background,
} }
@@ -100,14 +99,14 @@ return setmetatable({}, { __call = function(_, screen)
-- Change the taglist colors depending on the state of the tag -- Change the taglist colors depending on the state of the tag
if tag == ascreen.focused().selected_tag then if tag == ascreen.focused().selected_tag then
tag_widget:set_bg(Theme_config.taglist.bg_focus) tag_widget:set_bg(beautiful.colorscheme.fg)
tag_widget:set_fg(Theme_config.taglist.fg_focus) tag_widget:set_fg(beautiful.colorscheme.bg)
elseif tag.urgent == true then elseif tag.urgent == true then
tag_widget:set_bg(Theme_config.taglist.bg_urgent) tag_widget:set_bg(beautiful.colorscheme.bg_red)
tag_widget:set_fg(Theme_config.taglist.fg_urgent) tag_widget:set_fg(beautiful.colorscheme.bg)
else else
tag_widget:set_bg(Theme_config.taglist.bg) tag_widget:set_bg(beautiful.colorscheme.bg1)
tag_widget:set_fg(Theme_config.taglist.fg) tag_widget:set_fg(beautiful.colorscheme.fg)
end end
-- Add the client icons to the tag widget -- Add the client icons to the tag widget

View File

@@ -1,12 +1,12 @@
--------------------------------- local ipairs = ipairs
-- This is the tasklist widget -- local setmetatable = setmetatable
---------------------------------
-- Awesome Libs -- Awesome Libs
local abutton = require('awful.button') local abutton = require('awful.button')
local atooltip = require('awful.tooltip') local atooltip = require('awful.tooltip')
local awidget = require('awful.widget') 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 gtable = require('gears.table')
local wibox = require('wibox') local wibox = require('wibox')
@@ -54,9 +54,9 @@ return setmetatable({}, { __call = function(_, screen)
left = dpi(10), left = dpi(10),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
fg = Theme_config.tasklist.fg, fg = beautiful.colorscheme.fg,
bg = Theme_config.tasklist.bg, bg = beautiful.colorscheme.bg1,
shape = Theme_config.tasklist.shape, shape = beautiful.shape[6],
widget = wibox.container.background, widget = wibox.container.background,
} }
@@ -79,7 +79,7 @@ return setmetatable({}, { __call = function(_, screen)
end) 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 the client is focused, show the tooltip and add a label
if client == capi.client.focus then if client == capi.client.focus then
@@ -93,10 +93,10 @@ return setmetatable({}, { __call = function(_, screen)
delay_show = 1, delay_show = 1,
} }
task_widget:get_children_by_id('text_role')[1].text = label:sub(1, 20) task_widget:get_children_by_id('text_role')[1].text = label:sub(1, 20)
task_widget.bg = Theme_config.tasklist.bg_focus task_widget.bg = beautiful.colorscheme.fg
task_widget.fg = Theme_config.tasklist.fg_focus task_widget.fg = beautiful.colorscheme.bg
else else
task_widget.bg = Theme_config.tasklist.bg task_widget.bg = beautiful.colorscheme.bg1
task_widget:get_children_by_id('text_role')[1].text = '' task_widget:get_children_by_id('text_role')[1].text = ''
end end

View File

@@ -8,17 +8,17 @@
-- @supermodule wibox.widget.textbox -- @supermodule wibox.widget.textbox
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
local base = require("wibox.widget.base") local base = require('wibox.widget.base')
local gdebug = require("gears.debug") local gdebug = require('gears.debug')
local gfs = require("gears.filesystem") local gfs = require('gears.filesystem')
local gobject = require("gears.object") local gobject = require('gears.object')
local gstring = require("gears.string") local gstring = require('gears.string')
local beautiful = require("beautiful") local beautiful = require('beautiful')
local keygrabber = require("awful.keygrabber") local keygrabber = require('awful.keygrabber')
local lgi = require("lgi") local lgi = require('lgi')
local gtable = require("gears.table") local gtable = require('gears.table')
local wibox = require("wibox") local wibox = require('wibox')
local abutton = require("awful.button") local abutton = require('awful.button')
local setmetatable = setmetatable local setmetatable = setmetatable
local capi = local capi =
@@ -33,30 +33,30 @@ local inputbox = { mt = {} }
local function text_with_cursor(text, cursor_pos, self) local function text_with_cursor(text, cursor_pos, self)
local char, spacer, text_start, text_end local char, spacer, text_start, text_end
local cursor_fg = beautiful.inputbox_cursor_fg or "#313131" local cursor_fg = beautiful.inputbox_cursor_fg or beautiful.colorscheme.bg1
local cursor_bg = beautiful.inputbox_cursor_bg or "#0dccfc" local cursor_bg = beautiful.inputbox_cursor_bg or beautiful.colorscheme.bg_blue
local text_color = beautiful.inputbox_fg or "#ffffff" local text_color = beautiful.inputbox_fg or beautiful.colorscheme.fg
local placeholder_text = beautiful.inputbox_placeholder_text or "Type here..." local placeholder_text = beautiful.inputbox_placeholder_text or 'Type here...'
local placeholder_fg = beautiful.inputbox_placeholder_fg or "#777777" local placeholder_fg = beautiful.inputbox_placeholder_fg or beautiful.colorscheme.bg2
local highlight_bg = beautiful.inputbox_highlight_bg or "#35ffe4" local highlight_bg = beautiful.inputbox_highlight_bg or beautiful.fg
local highlight_fg = beautiful.inputbox_highlight_fg or "#000000" local highlight_fg = beautiful.inputbox_highlight_fg or beautiful.bg
if text == "" then if text == '' then
return "<span foreground='" .. placeholder_fg .. "'>" .. placeholder_text .. "</span>" return "<span foreground='" .. placeholder_fg .. "'>" .. placeholder_text .. '</span>'
end end
if #text < cursor_pos then if #text < cursor_pos then
char = " " char = ' '
spacer = "" spacer = ''
text_start = gstring.xml_escape(text) text_start = gstring.xml_escape(text)
text_end = "" text_end = ''
else else
local offset = 0 local offset = 0
if #text:sub(cursor_pos, cursor_pos) == -1 then if #text:sub(cursor_pos, cursor_pos) == -1 then
offset = 1 offset = 1
end end
char = gstring.xml_escape(text:sub(cursor_pos, cursor_pos + offset)) 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_start = gstring.xml_escape(text:sub(1, cursor_pos - 1))
text_end = gstring.xml_escape(text:sub(cursor_pos + offset + 1)) text_end = gstring.xml_escape(text:sub(cursor_pos + offset + 1))
end end
@@ -68,34 +68,34 @@ local function text_with_cursor(text, cursor_pos, self)
self._private.highlight.cur_pos_end)) self._private.highlight.cur_pos_end))
local text_end_highlight = gstring.xml_escape(text:sub(self._private.highlight.cur_pos_end + 1)) local text_end_highlight = gstring.xml_escape(text:sub(self._private.highlight.cur_pos_end + 1))
return "<span foreground='" .. text_color .. "'>" .. text_start_highlight .. "</span>" .. return "<span foreground='" .. text_color .. "'>" .. text_start_highlight .. '</span>' ..
"<span foreground='" .. highlight_fg .. "' background='" .. highlight_bg .. "'>" .. "<span foreground='" .. highlight_fg .. "' background='" .. highlight_bg .. "'>" ..
text_highlighted .. text_highlighted ..
"</span>" .. "<span foreground='" .. text_color .. "'>" .. text_end_highlight .. "</span>" '</span>' .. "<span foreground='" .. text_color .. "'>" .. text_end_highlight .. '</span>'
else else
return "<span foreground='" .. text_color .. "'>" .. text_start .. "</span>" .. return "<span foreground='" .. text_color .. "'>" .. text_start .. '</span>' ..
"<span background='" .. cursor_bg .. "' foreground='" .. cursor_fg .. "'>" .. "<span background='" .. cursor_bg .. "' foreground='" .. cursor_fg .. "'>" ..
char .. "</span>" .. "<span foreground='" .. text_color .. "'>" .. text_end .. spacer .. "</span>" char .. '</span>' .. "<span foreground='" .. text_color .. "'>" .. text_end .. spacer .. '</span>'
end end
end end
--- Clears the current text --- Clears the current text
function inputbox:clear() function inputbox:clear()
self:set_text("") self:set_text('')
end end
function inputbox:get_text() function inputbox:get_text()
return self._private.text or "" return self._private.text or ''
end end
function inputbox:set_text(text) function inputbox:set_text(text)
self._private.text = text self._private.text = text
self:emit_signal("property::text", text) self:emit_signal('property::text', text)
end end
--- Stop the keygrabber and mousegrabber --- Stop the keygrabber and mousegrabber
function inputbox:stop() function inputbox:stop()
self:emit_signal("stopped") self:emit_signal('stopped')
keygrabber.stop() keygrabber.stop()
capi.mousegrabber.stop() capi.mousegrabber.stop()
end end
@@ -119,38 +119,38 @@ function inputbox:focus()
end, "left_ptr" end, "left_ptr"
) ]] ) ]]
self:connect_signal("button::press", function() self:connect_signal('button::press', function()
if capi.mouse.current_widget ~= self then if capi.mouse.current_widget ~= self then
self:emit_signal("keygrabber::stop", "") self:emit_signal('keygrabber::stop', '')
end end
end) end)
end end
function inputbox:run() 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 -- Init the cursor position, but causes on refocus the cursor to move to the left
local cursor_pos = #self:get_text() + 1 local cursor_pos = #self:get_text() + 1
self:emit_signal("started") self:emit_signal('started')
-- Init and reset(when refocused) the highlight -- Init and reset(when refocused) the highlight
self._private.highlight = {} self._private.highlight = {}
-- Emitted when the keygrabber is stopped -- Emitted when the keygrabber is stopped
self:connect_signal("cancel", function() self:connect_signal('cancel', function()
self:stop() self:stop()
self:emit_signal("stopped") self:emit_signal('stopped')
end) end)
-- Emitted when the keygrabber should submit the text -- Emitted when the keygrabber should submit the text
self:connect_signal("submit", function(text) self:connect_signal('submit', function(text)
self:stop() self:stop()
self:emit_signal("stopped", text) self:emit_signal('stopped', text)
end) end)
self:emit_signal("key_pressed", "B", "A") self:emit_signal('key_pressed', 'B', 'A')
keygrabber.run(function(mod, key, event) keygrabber.run(function(mod, key, event)
@@ -159,19 +159,19 @@ function inputbox:run()
mod_keys[v] = true mod_keys[v] = true
end end
if not (event == "press") then return end if not (event == 'press') then return end
--Escape cases --Escape cases
-- Just quit and leave the text as is -- Just quit and leave the text as is
if (not mod_keys.Control) and (key == "Escape") then if (not mod_keys.Control) and (key == 'Escape') then
self:emit_signal("cancel") self:emit_signal('cancel')
elseif (not mod_keys.Control and key == "KP_Enter") or (not mod_keys.Control and key == "Return") then 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:emit_signal('submit', self:get_text())
self:set_text("") self:set_text('')
end end
-- All shift, control or key cases -- All shift, control or key cases
if mod_keys.Shift then if mod_keys.Shift then
if key == "Left" then if key == 'Left' then
if cursor_pos > 1 then if cursor_pos > 1 then
if not self._private.highlight.cur_pos_start then if not self._private.highlight.cur_pos_start then
self._private.highlight.cur_pos_start = cursor_pos - 1 self._private.highlight.cur_pos_start = cursor_pos - 1
@@ -188,7 +188,7 @@ function inputbox:run()
cursor_pos = cursor_pos - 1 cursor_pos = cursor_pos - 1
end end
elseif key == "Right" then elseif key == 'Right' then
if #self._private.text >= cursor_pos then if #self._private.text >= cursor_pos then
if not self._private.highlight.cur_pos_end then if not self._private.highlight.cur_pos_end then
self._private.highlight.cur_pos_end = cursor_pos - 1 self._private.highlight.cur_pos_end = cursor_pos - 1
@@ -215,18 +215,18 @@ function inputbox:run()
end end
end end
elseif mod_keys.Control then elseif mod_keys.Control then
if key == "a" then if key == 'a' then
-- Mark the entire text -- Mark the entire text
self._private.highlight = { self._private.highlight = {
cur_pos_start = 1, 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 -- TODO: Copy the highlighted text when the selection setter gets implemented
elseif key == "v" then elseif key == 'v' then
local sel = capi.selection() local sel = capi.selection()
if sel then if sel then
sel = sel:gsub("\n", "") sel = sel:gsub('\n', '')
if self._private.highlight and self._private.highlight.cur_pos_start and if self._private.highlight and self._private.highlight.cur_pos_start and
self._private.highlight.cur_pos_end then self._private.highlight.cur_pos_end then
-- insert the text into the selected part -- insert the text into the selected part
@@ -241,18 +241,18 @@ function inputbox:run()
cursor_pos = cursor_pos + #sel cursor_pos = cursor_pos + #sel
end end
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. --TODO: "cut". Copy selected then clear text, this requires to add the c function first.
self._private.highlight = {} self._private.highlight = {}
elseif key == "Left" then elseif key == 'Left' then
-- Find all spaces -- Find all spaces
local spaces = {} local spaces = {}
local t, i = self._private.text, 0 local t, i = self._private.text, 0
while t:find("%s") do while t:find('%s') do
i = t:find("%s") i = t:find('%s')
table.insert(spaces, i) 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 end
local cp = 1 local cp = 1
@@ -262,8 +262,8 @@ function inputbox:run()
end end
end end
cursor_pos = cp cursor_pos = cp
elseif key == "Right" then elseif key == 'Right' then
local next_space = self._private.text:sub(cursor_pos):find("%s") local next_space = self._private.text:sub(cursor_pos):find('%s')
if next_space then if next_space then
cursor_pos = cursor_pos + next_space cursor_pos = cursor_pos + next_space
else else
@@ -271,7 +271,7 @@ function inputbox:run()
end end
end end
else else
if key == "BackSpace" then if key == 'BackSpace' then
-- If text is highlighted delete that, else just delete the character to the left -- 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 if self._private.highlight and self._private.highlight.cur_pos_start and
self._private.highlight.cur_pos_end then self._private.highlight.cur_pos_end then
@@ -287,7 +287,7 @@ function inputbox:run()
cursor_pos = cursor_pos - 1 cursor_pos = cursor_pos - 1
end end
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 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 if self._private.highlight and self._private.highlight.cur_pos_start and
self._private.highlight.cur_pos_end then self._private.highlight.cur_pos_end then
@@ -302,13 +302,13 @@ function inputbox:run()
self._private.text:sub(cursor_pos + 1)) self._private.text:sub(cursor_pos + 1))
end end
end end
elseif key == "Left" then elseif key == 'Left' then
-- Move cursor ro the left -- Move cursor ro the left
if cursor_pos > 1 then if cursor_pos > 1 then
cursor_pos = cursor_pos - 1 cursor_pos = cursor_pos - 1
end end
self._private.highlight = {} self._private.highlight = {}
elseif key == "Right" then elseif key == 'Right' then
-- Move cursor to the right -- Move cursor to the right
if cursor_pos <= #self._private.text then if cursor_pos <= #self._private.text then
cursor_pos = cursor_pos + 1 cursor_pos = cursor_pos + 1
@@ -335,14 +335,14 @@ function inputbox:run()
self.text = text_with_cursor(self:get_text(), cursor_pos, self) self.text = text_with_cursor(self:get_text(), cursor_pos, self)
-- using self:emit_signal... results in nil tables beeing send -- 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)
end end
function inputbox.new(args) function inputbox.new(args)
args = args or {} args = args or {}
local w = wibox.widget.textbox(args.text or "") local w = wibox.widget.textbox(args.text or '')
gtable.crush(w, inputbox, true) gtable.crush(w, inputbox, true)
@@ -354,33 +354,33 @@ function inputbox.new(args)
abutton({}, 3, function() abutton({}, 3, function()
-- TODO: Figure out how to paste with highlighted support -- TODO: Figure out how to paste with highlighted support
-- Maybe with a signal? -- Maybe with a signal?
end) end),
} }
) )
-- Change the cursor to "xterm" on hover over -- Change the cursor to "xterm" on hover over
local old_cursor, old_wibox local old_cursor, old_wibox
w:connect_signal( w:connect_signal(
"mouse::enter", 'mouse::enter',
function() function()
local wid = capi.mouse.current_wibox local wid = capi.mouse.current_wibox
if wid then if wid then
old_cursor, old_wibox = wid.cursor, wid old_cursor, old_wibox = wid.cursor, wid
wid.cursor = "xterm" wid.cursor = 'xterm'
end end
end end
) )
-- Change the cursor back once leaving the widget -- Change the cursor back once leaving the widget
w:connect_signal( w:connect_signal(
"mouse::leave", 'mouse::leave',
function() function()
old_wibox.cursor = old_cursor old_wibox.cursor = old_cursor
old_wibox = nil old_wibox = nil
end end
) )
w.text = text_with_cursor("", 1, w) w.text = text_with_cursor('', 1, w)
return w return w