Big rewrite part 1
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
-------------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
local beautiful = require('beautiful')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local gfilesystem = require('gears.filesystem')
|
||||
local base = require('wibox.widget.base')
|
||||
@@ -81,7 +82,7 @@ function info_center.new(args)
|
||||
{
|
||||
{
|
||||
{
|
||||
bg = Theme_config.notification_center.spacing_line.color,
|
||||
bg = beautiful.colorscheme.bg1,
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
widget = wibox.container.constraint,
|
||||
@@ -152,8 +153,8 @@ function info_center.new(args)
|
||||
{
|
||||
dnd_widget {
|
||||
text = 'Do not disturb',
|
||||
color = Theme_config.notification_center.dnd_color,
|
||||
fg = Theme_config.notification_center.dnd_fg,
|
||||
color = beautiful.colorscheme.bg_purple,
|
||||
fg = beautiful.colorscheme.bg_red,
|
||||
size = dpi(40),
|
||||
},
|
||||
id = 'dnd',
|
||||
@@ -171,11 +172,9 @@ function info_center.new(args)
|
||||
widget = wibox.widget.textbox,
|
||||
id = 'clear',
|
||||
},
|
||||
fg = Theme_config.notification_center.clear_all_button.fg,
|
||||
bg = Theme_config.notification_center.clear_all_button.bg,
|
||||
shape = function(cr, width, height)
|
||||
gshape.rounded_rect(cr, width, height, 12)
|
||||
end,
|
||||
fg = beautiful.colorscheme.bg,
|
||||
bg = beautiful.colorscheme.bg_blue,
|
||||
shape = beautiful.shape[12],
|
||||
id = 'clear_all_bg',
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
@@ -200,7 +199,7 @@ function info_center.new(args)
|
||||
},
|
||||
spacing_widget = {
|
||||
thickness = dpi(2),
|
||||
color = Theme_config.notification_center.spacing_color,
|
||||
color = beautiful.colorscheme.bg1,
|
||||
span_ratio = 0.9,
|
||||
widget = wibox.widget.separator,
|
||||
},
|
||||
@@ -243,14 +242,14 @@ function info_center.new(args)
|
||||
end)
|
||||
|
||||
w:get_children_by_id('dnd')[1]:get_widget():connect_signal('dnd::toggle', function(enabled)
|
||||
User_config.dnd = enabled
|
||||
beautiful.user_config.dnd = enabled
|
||||
end)
|
||||
|
||||
w.container = apopup {
|
||||
widget = w,
|
||||
bg = Theme_config.notification_center.bg,
|
||||
border_color = Theme_config.notification_center.border_color,
|
||||
border_width = Theme_config.notification_center.border_width,
|
||||
bg = beautiful.colorscheme.bg,
|
||||
border_color = beautiful.colorscheme.border_color,
|
||||
border_width = dpi(2),
|
||||
placement = function(c)
|
||||
aplacement.top(c, { margins = dpi(10) })
|
||||
end,
|
||||
|
||||
@@ -7,9 +7,16 @@ local dpi = require('beautiful').xresources.apply_dpi
|
||||
local wibox = require('wibox')
|
||||
local naughty = require('naughty')
|
||||
local gtimer = require('gears.timer')
|
||||
local beautiful = require('beautiful')
|
||||
local gcolor = require('gears.color')
|
||||
local gfilesystem = require('gears.filesystem')
|
||||
local gtable = require('gears.table')
|
||||
local abutton = require('awful.button')
|
||||
|
||||
local hover = require('src.tools.hover')
|
||||
|
||||
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/notifications/'
|
||||
|
||||
return setmetatable({}, {
|
||||
__call = function()
|
||||
local ret = wibox.widget {
|
||||
@@ -19,35 +26,203 @@ return setmetatable({}, {
|
||||
spacing = dpi(20),
|
||||
}
|
||||
|
||||
--!No, :get_children_by_id() does not work here for some reason, yes I hate it too
|
||||
--[[ naughty.connect_signal('notification_surface', function(b)
|
||||
naughty.connect_signal('request::display', function(n)
|
||||
local start_time = os.time()
|
||||
local w = wibox.template.make_from_value(b)
|
||||
w = w:get_widget()
|
||||
assert(type(w) == 'table', 'w is not a wibox.widget.base')
|
||||
|
||||
-- Change the clock to a timer how long ago the notification was created
|
||||
w.children[1].children[1].children[1].children[1].children[1].children[2].children[1].children[1] = wibox.widget {
|
||||
text = 'now',
|
||||
font = 'JetBrainsMono Nerd Font, Bold 12',
|
||||
halign = 'center',
|
||||
valign = 'center',
|
||||
widget = wibox.widget.textbox,
|
||||
local color = beautiful.colorscheme.bg_blue
|
||||
local w = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{ -- Title
|
||||
{
|
||||
{
|
||||
{ -- Icon
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
notification = n,
|
||||
widget = naughty.widget.icon,
|
||||
image = n.icon,
|
||||
resize = true,
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
shape = beautiful.shape[4],
|
||||
},
|
||||
widget = wibox.container.place,
|
||||
},
|
||||
widget = wibox.container.constraint,
|
||||
strategy = 'exact',
|
||||
width = dpi(20),
|
||||
height = dpi(20),
|
||||
},
|
||||
{ -- Title
|
||||
{
|
||||
notification = n,
|
||||
widget = naughty.widget.title,
|
||||
markup = [[<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',
|
||||
fg = beautiful.colorscheme.bg,
|
||||
halign = 'center',
|
||||
valign = 'center',
|
||||
id = 'timer',
|
||||
},
|
||||
{ -- Close button
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
widget = wibox.widget.imagebox,
|
||||
image = gcolor.recolor_image(icondir .. 'close.svg', beautiful.colorscheme.bg),
|
||||
resize = true,
|
||||
halign = 'center',
|
||||
valign = 'center',
|
||||
},
|
||||
start_angle = 4.71239,
|
||||
thickness = dpi(2),
|
||||
min_value = 0,
|
||||
max_value = 1,
|
||||
value = 1,
|
||||
widget = wibox.container.arcchart,
|
||||
id = 'arc',
|
||||
},
|
||||
fg = beautiful.colorscheme.bg,
|
||||
bg = color,
|
||||
widget = wibox.container.background,
|
||||
id = 'arc_bg',
|
||||
},
|
||||
strategy = 'exact',
|
||||
width = dpi(18),
|
||||
height = dpi(18),
|
||||
widget = wibox.container.constraint,
|
||||
},
|
||||
id = 'close',
|
||||
visible = false,
|
||||
left = dpi(5),
|
||||
widget = wibox.container.margin,
|
||||
},
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
},
|
||||
right = dpi(5),
|
||||
widget = wibox.container.margin,
|
||||
},
|
||||
layout = wibox.layout.align.horizontal,
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
bg = color,
|
||||
fg = beautiful.colorscheme.bg,
|
||||
shape = beautiful.shape[8],
|
||||
},
|
||||
{ -- Main body
|
||||
{ -- Image
|
||||
{
|
||||
{
|
||||
notification = n,
|
||||
image = n.icon,
|
||||
valign = 'center',
|
||||
halign = 'center',
|
||||
upscale = true,
|
||||
resize_strategy = 'scale',
|
||||
widget = naughty.widget.icon,
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
shape = beautiful.shape[10],
|
||||
},
|
||||
widget = wibox.container.constraint,
|
||||
strategy = 'exact',
|
||||
height = dpi(96),
|
||||
width = dpi(96),
|
||||
},
|
||||
{
|
||||
{
|
||||
notification = n,
|
||||
widget = naughty.widget.message,
|
||||
font = 'JetBrainsMono Nerd Font, Regular 10',
|
||||
halign = 'left',
|
||||
valign = 'center',
|
||||
},
|
||||
widget = wibox.container.constraint,
|
||||
strategy = 'exact',
|
||||
height = dpi(96),
|
||||
},
|
||||
spacing = dpi(15),
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
},
|
||||
{ -- Spacer
|
||||
{
|
||||
widget = wibox.container.background,
|
||||
bg = beautiful.colorscheme.bg,
|
||||
},
|
||||
widget = wibox.container.constraint,
|
||||
strategy = 'exact',
|
||||
height = dpi(2),
|
||||
},
|
||||
spacing = dpi(15),
|
||||
id = 'main_layout',
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
},
|
||||
widget = wibox.container.margin,
|
||||
margins = dpi(15),
|
||||
},
|
||||
bg = beautiful.colorscheme.bg,
|
||||
border_color = beautiful.colorscheme.border_color,
|
||||
border_width = dpi(2),
|
||||
shape = beautiful.shape[8],
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
widget = wibox.container.constraint,
|
||||
strategy = 'exact',
|
||||
width = dpi(600),
|
||||
}
|
||||
|
||||
hover.bg_hover { widget = w.children[1].children[1].children[1].children[1].children[1].children[2].children[1].children[2].children[1].children[1] }
|
||||
w.children[1].children[1].children[1].children[1].children[1].children[2].children[1].children[2]:connect_signal('button::press', function()
|
||||
ret:remove_widgets(w)
|
||||
ret:emit_signal('new_children')
|
||||
local close = w:get_children_by_id('close')[1]
|
||||
w:connect_signal('mouse::enter', function()
|
||||
close.visible = true
|
||||
--w:get_children_by_id('timer')[1].visible = false
|
||||
end)
|
||||
|
||||
w:connect_signal('mouse::leave', function()
|
||||
close.visible = false
|
||||
--w:get_children_by_id('timer')[1].visible = true
|
||||
end)
|
||||
|
||||
hover.bg_hover(close.children[1])
|
||||
|
||||
close:buttons(gtable.join(
|
||||
abutton({}, 1, function()
|
||||
ret:remove_widgets(w)
|
||||
ret:emit_signal('new_children')
|
||||
end)
|
||||
))
|
||||
|
||||
gtimer {
|
||||
timeout = 1,
|
||||
autostart = true,
|
||||
call_now = true,
|
||||
callback = function()
|
||||
local time_ago = math.floor(os.time() - start_time)
|
||||
local timer_text = w.children[1].children[1].children[1].children[1].children[1].children[2].children[1].children[1]
|
||||
local timer_text = w:get_children_by_id('timer')[1]
|
||||
if time_ago < 5 then
|
||||
timer_text:set_text('now')
|
||||
elseif time_ago < 60 then
|
||||
@@ -64,7 +239,7 @@ return setmetatable({}, {
|
||||
|
||||
ret:add(w)
|
||||
ret:emit_signal('new_children')
|
||||
end) ]]
|
||||
end)
|
||||
|
||||
return ret
|
||||
end,
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
-- Awesome Libs
|
||||
local aspawn = require('awful.spawn')
|
||||
local beautiful = require('beautiful')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local gcolor = require('gears.color')
|
||||
local gfilesystem = require('gears.filesystem')
|
||||
@@ -30,9 +31,7 @@ if not instance then
|
||||
image = gsurface.load_uncached(gfilesystem.get_configuration_dir() .. 'src/assets/userpfp/userpfp.png'),
|
||||
valign = 'center',
|
||||
halign = 'center',
|
||||
clip_shape = function(cr, width, height)
|
||||
gshape.rounded_rect(cr, width, height, dpi(12))
|
||||
end,
|
||||
clip_shape = beautiful.shape[12],
|
||||
widget = wibox.widget.imagebox,
|
||||
},
|
||||
strategy = 'exact',
|
||||
@@ -46,10 +45,11 @@ if not instance then
|
||||
{
|
||||
{ -- Username
|
||||
image = gcolor.recolor_image(icondir .. 'user.svg',
|
||||
Theme_config.notification_center.profile.username_icon_color),
|
||||
beautiful.colorscheme.bg_blue),
|
||||
valign = 'center',
|
||||
halign = 'left',
|
||||
resize = false,
|
||||
resize = true,
|
||||
width = dpi(20),
|
||||
widget = wibox.widget.imagebox,
|
||||
},
|
||||
{ -- Username
|
||||
@@ -64,10 +64,11 @@ if not instance then
|
||||
{
|
||||
{
|
||||
image = gcolor.recolor_image(icondir .. 'laptop.svg',
|
||||
Theme_config.notification_center.profile.os_prefix_icon_color),
|
||||
beautiful.colorscheme.bg_blue),
|
||||
valign = 'center',
|
||||
halign = 'left',
|
||||
resize = false,
|
||||
resize = true,
|
||||
width = dpi(20),
|
||||
widget = wibox.widget.imagebox,
|
||||
},
|
||||
{ -- OS
|
||||
@@ -82,10 +83,11 @@ if not instance then
|
||||
{
|
||||
{
|
||||
image = gcolor.recolor_image(icondir .. 'penguin.svg',
|
||||
Theme_config.notification_center.profile.kernel_icon_color),
|
||||
beautiful.colorscheme.bg_blue),
|
||||
valign = 'center',
|
||||
halign = 'left',
|
||||
resize = false,
|
||||
resize = true,
|
||||
width = dpi(20),
|
||||
widget = wibox.widget.imagebox,
|
||||
},
|
||||
{ -- Kernel
|
||||
@@ -100,10 +102,11 @@ if not instance then
|
||||
{
|
||||
{
|
||||
image = gcolor.recolor_image(icondir .. 'clock.svg',
|
||||
Theme_config.notification_center.profile.uptime_icon_color),
|
||||
beautiful.colorscheme.bg_blue),
|
||||
valign = 'center',
|
||||
halign = 'left',
|
||||
resize = false,
|
||||
resize = true,
|
||||
width = dpi(20),
|
||||
widget = wibox.widget.imagebox,
|
||||
},
|
||||
{ -- Uptime
|
||||
@@ -124,10 +127,10 @@ if not instance then
|
||||
},
|
||||
widget = wibox.layout.fixed.vertical,
|
||||
},
|
||||
fg = Theme_config.notification_center.profile.fg,
|
||||
border_color = Theme_config.notification_center.profile.border_color,
|
||||
border_width = Theme_config.notification_center.profile.border_width,
|
||||
shape = Theme_config.notification_center.profile.shape,
|
||||
fg = beautiful.colorscheme.bg_green,
|
||||
border_color = beautiful.colorscheme.border_color,
|
||||
border_width = dpi(2),
|
||||
shape = beautiful.shape[12],
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
strategy = 'exact',
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
---------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
local beautiful = require('beautiful')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local wibox = require('wibox')
|
||||
local gfilesystem = require('gears.filesystem')
|
||||
@@ -29,9 +30,7 @@ return setmetatable({}, { __call = function()
|
||||
{
|
||||
image = icondir .. 'default_image.svg',
|
||||
resize = true,
|
||||
clip_shape = function(cr, width, height)
|
||||
gshape.rounded_rect(cr, width, height, dpi(8))
|
||||
end,
|
||||
clip_shape = beautiful.shape[8],
|
||||
valign = 'center',
|
||||
halign = 'center',
|
||||
widget = wibox.widget.imagebox,
|
||||
@@ -53,7 +52,7 @@ return setmetatable({}, { __call = function()
|
||||
id = 'title',
|
||||
widget = wibox.widget.textbox,
|
||||
},
|
||||
fg = Theme_config.notification_center.song_info.title_fg,
|
||||
fg = beautiful.colorscheme.bg_red,
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
strategy = 'max',
|
||||
@@ -72,7 +71,7 @@ return setmetatable({}, { __call = function()
|
||||
text = 'Unknown Artist',
|
||||
widget = wibox.widget.textbox,
|
||||
},
|
||||
fg = Theme_config.notification_center.song_info.artist_fg,
|
||||
fg = beautiful.colorscheme.bg_blue,
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
strategy = 'max',
|
||||
@@ -86,7 +85,7 @@ return setmetatable({}, { __call = function()
|
||||
{
|
||||
resize = false,
|
||||
image = gcolor.recolor_image(icondir .. 'shuffle.svg',
|
||||
Theme_config.notification_center.song_info.shuffle_disabled),
|
||||
beautiful.colorscheme.bg1),
|
||||
valign = 'center',
|
||||
halign = 'center',
|
||||
id = 'shuffle',
|
||||
@@ -97,7 +96,7 @@ return setmetatable({}, { __call = function()
|
||||
valign = 'center',
|
||||
halign = 'center',
|
||||
id = 'prev',
|
||||
image = gcolor.recolor_image(icondir .. 'skip-prev.svg', Theme_config.notification_center.song_info.prev_enabled),
|
||||
image = gcolor.recolor_image(icondir .. 'skip-prev.svg', beautiful.colorscheme.bg_teal),
|
||||
widget = wibox.widget.imagebox,
|
||||
},
|
||||
{
|
||||
@@ -106,7 +105,7 @@ return setmetatable({}, { __call = function()
|
||||
halign = 'center',
|
||||
id = 'play_pause',
|
||||
image = gcolor.recolor_image(icondir .. 'play-pause.svg',
|
||||
Theme_config.notification_center.song_info.play_enabled),
|
||||
beautiful.colorscheme.bg_teal),
|
||||
widget = wibox.widget.imagebox,
|
||||
},
|
||||
{
|
||||
@@ -114,12 +113,12 @@ return setmetatable({}, { __call = function()
|
||||
valign = 'center',
|
||||
halign = 'center',
|
||||
id = 'next',
|
||||
image = gcolor.recolor_image(icondir .. 'skip-next.svg', Theme_config.notification_center.song_info.next_enabled),
|
||||
image = gcolor.recolor_image(icondir .. 'skip-next.svg', beautiful.colorscheme.bg_teal),
|
||||
widget = wibox.widget.imagebox,
|
||||
},
|
||||
{
|
||||
resize = false,
|
||||
image = gcolor.recolor_image(icondir .. 'repeat.svg', Theme_config.notification_center.song_info.repeat_disabled),
|
||||
image = gcolor.recolor_image(icondir .. 'repeat.svg', beautiful.colorscheme.bg1),
|
||||
widget = wibox.widget.imagebox,
|
||||
valign = 'center',
|
||||
halign = 'center',
|
||||
@@ -146,7 +145,7 @@ return setmetatable({}, { __call = function()
|
||||
valign = 'center',
|
||||
halign = 'center',
|
||||
},
|
||||
fg = Theme_config.notification_center.song_info.duration_fg,
|
||||
fg = beautiful.colorscheme.bg_teal,
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
right = dpi(10),
|
||||
@@ -154,15 +153,13 @@ return setmetatable({}, { __call = function()
|
||||
},
|
||||
{ -- Progressbar
|
||||
{
|
||||
color = Theme_config.notification_center.song_info.progress_color,
|
||||
background_color = Theme_config.notification_center.song_info.progress_background_color,
|
||||
color = beautiful.colorscheme.bg_purple,
|
||||
background_color = beautiful.colorscheme.bg1,
|
||||
max_value = 100,
|
||||
value = 0,
|
||||
id = 'progress',
|
||||
forced_height = dpi(5),
|
||||
shape = function(cr, width)
|
||||
gshape.rounded_bar(cr, width, dpi(5))
|
||||
end,
|
||||
shape = beautiful.shape[4],
|
||||
widget = wibox.widget.progressbar,
|
||||
},
|
||||
widget = wibox.container.place,
|
||||
@@ -176,7 +173,7 @@ return setmetatable({}, { __call = function()
|
||||
valign = 'center',
|
||||
halign = 'center',
|
||||
},
|
||||
fg = Theme_config.notification_center.song_info.duration_fg,
|
||||
fg = beautiful.colorscheme.bg_teal,
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
left = dpi(10),
|
||||
@@ -189,9 +186,9 @@ return setmetatable({}, { __call = function()
|
||||
widget = wibox.container.margin,
|
||||
margins = dpi(10),
|
||||
},
|
||||
border_color = Theme_config.notification_center.song_info.border_color,
|
||||
border_width = Theme_config.notification_center.song_info.border_width,
|
||||
shape = Theme_config.notification_center.song_info.shape,
|
||||
border_color = beautiful.colorscheme.border_color,
|
||||
border_width = dpi(2),
|
||||
shape = beautiful.shape[12],
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
widget = wibox.container.margin,
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
-- Awesome Libs
|
||||
local awful = require('awful')
|
||||
local beautiful = require('beautiful')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local gears = require('gears')
|
||||
local wibox = require('wibox')
|
||||
@@ -39,8 +40,8 @@ return setmetatable({}, { __call = function()
|
||||
{
|
||||
{
|
||||
{ --Bar
|
||||
color = Theme_config.notification_center.status_bar.cpu_usage_color,
|
||||
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
|
||||
color = beautiful.colorscheme.bg_teal,
|
||||
background_color = beautiful.colorscheme.bg1,
|
||||
max_value = 100,
|
||||
value = 0,
|
||||
forced_height = dpi(8),
|
||||
@@ -99,13 +100,15 @@ return setmetatable({}, { __call = function()
|
||||
|
||||
if widget == 'cpu_usage' then
|
||||
cpu_usage:connect_signal('update::cpu_usage', function(_, v)
|
||||
if not v then return nil end
|
||||
tooltip.text = 'CPU Usage: ' .. v .. '%'
|
||||
rubato_timer.target = v
|
||||
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icondir .. 'cpu/cpu.svg',
|
||||
Theme_config.notification_center.status_bar.cpu_usage_color)
|
||||
beautiful.colorscheme.bg_teal)
|
||||
end)
|
||||
elseif widget == 'cpu_temp' then
|
||||
cpu_temp:connect_signal('update::cpu_temp', function(_, v)
|
||||
if not v then return nil end
|
||||
local temp_icon
|
||||
if v < 50 then
|
||||
temp_icon = icondir .. 'cpu/thermometer-low.svg'
|
||||
@@ -115,29 +118,31 @@ return setmetatable({}, { __call = function()
|
||||
temp_icon = icondir .. 'cpu/thermometer-high.svg'
|
||||
end
|
||||
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(temp_icon,
|
||||
Theme_config.notification_center.status_bar.cpu_temp_color)
|
||||
beautiful.colorscheme.bg_blue)
|
||||
tooltip.text = 'CPU Temp: ' .. v .. '°C'
|
||||
rubato_timer.target = v
|
||||
end)
|
||||
elseif widget == 'ram_usage' then
|
||||
ram:connect_signal('update::ram_widget', function(_, MemTotal, _, MemAvailable)
|
||||
if not MemTotal and MemAvailable then return nil end
|
||||
if not MemTotal or not MemAvailable then return end
|
||||
local ram_usage = math.floor(((MemTotal - MemAvailable) / MemTotal * 100) + 0.5)
|
||||
tooltip.text = 'RAM Usage: ' .. ram_usage .. '%'
|
||||
rubato_timer.target = ram_usage
|
||||
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icondir .. 'cpu/ram.svg',
|
||||
Theme_config.notification_center.status_bar.ram_usage_color)
|
||||
beautiful.colorscheme.bg_red)
|
||||
end)
|
||||
elseif widget == 'gpu_usage' then
|
||||
gpu_usage:connect_signal('update::gpu_usage', function(_, v)
|
||||
if not v then return end
|
||||
if not v then return nil end
|
||||
tooltip.text = 'GPU Usage: ' .. v .. '%'
|
||||
rubato_timer.target = tonumber(v)
|
||||
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icondir .. 'cpu/gpu.svg',
|
||||
Theme_config.notification_center.status_bar.gpu_usage_color)
|
||||
beautiful.colorscheme.bg_green)
|
||||
end)
|
||||
elseif widget == 'gpu_temp' then
|
||||
gpu_temp:connect_signal('update::gpu_temp', function(_, v)
|
||||
if not v then return nil end
|
||||
local temp_icon, temp_num
|
||||
|
||||
if v then
|
||||
@@ -154,12 +159,13 @@ return setmetatable({}, { __call = function()
|
||||
temp_icon = icondir .. 'cpu/thermometer-low.svg'
|
||||
end
|
||||
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(temp_icon,
|
||||
Theme_config.notification_center.status_bar.gpu_temp_color)
|
||||
beautiful.colorscheme.bg_green)
|
||||
tooltip.text = 'GPU Temp: ' .. temp_num .. '°C'
|
||||
rubato_timer.target = temp_num
|
||||
end)
|
||||
elseif widget == 'volume' then
|
||||
audio:connect_signal('sink::get', function(_, muted, volume)
|
||||
if not volume and muted then return nil end
|
||||
local icon = icondir .. 'audio/volume'
|
||||
volume = tonumber(volume)
|
||||
if not volume then
|
||||
@@ -179,12 +185,13 @@ return setmetatable({}, { __call = function()
|
||||
end
|
||||
end
|
||||
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icon .. '.svg',
|
||||
Theme_config.notification_center.status_bar.volume_color)
|
||||
beautiful.colorscheme.bg_yellow)
|
||||
tooltip.text = 'Volume: ' .. volume .. '%'
|
||||
rubato_timer.target = volume
|
||||
end)
|
||||
elseif widget == 'microphone' then
|
||||
audio:connect_signal('source::get', function(_, muted, volume)
|
||||
if not volume and muted then return nil end
|
||||
if not volume then
|
||||
return
|
||||
end
|
||||
@@ -197,12 +204,13 @@ return setmetatable({}, { __call = function()
|
||||
icon = icon .. '-off'
|
||||
end
|
||||
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(icon .. '.svg',
|
||||
Theme_config.notification_center.status_bar.microphone_color)
|
||||
beautiful.colorscheme.bg_blue)
|
||||
tooltip.text = 'Microphone: ' .. volume .. '%'
|
||||
rubato_timer.target = volume
|
||||
end)
|
||||
elseif widget == 'backlight' then
|
||||
backlight:connect_signal('brightness::get', function(_, v)
|
||||
if not v then return nil end
|
||||
local icon = icondir .. 'brightness'
|
||||
if v >= 0 and v < 34 then
|
||||
icon = icon .. '-low'
|
||||
@@ -212,18 +220,19 @@ return setmetatable({}, { __call = function()
|
||||
icon = icon .. '-high'
|
||||
end
|
||||
w:get_children_by_id('image_role')[1]:set_image(gears.color.recolor_image(icon .. '.svg',
|
||||
Theme_config.notification_center.status_bar.backlight_color))
|
||||
beautiful.colorscheme.bg_purple))
|
||||
tooltip.text = 'Backlight: ' .. v .. '%'
|
||||
rubato_timer.target = v
|
||||
end)
|
||||
elseif widget == 'battery' then
|
||||
--[[ battery:connect_signal('update::battery_widget', function(battery, battery_icon)
|
||||
w:get_children_by_id('image_role')[1].image = gears.color.recolor_image(battery_icon,
|
||||
Theme_config.notification_center.status_bar.battery_color)
|
||||
beautiful.colorscheme.bg_purple)
|
||||
tooltip.text = 'Battery: ' .. battery .. '%'
|
||||
rubato_timer.target = battery
|
||||
end) ]]
|
||||
end
|
||||
|
||||
table.insert(bar_layout, w)
|
||||
end
|
||||
|
||||
@@ -236,7 +245,7 @@ return setmetatable({}, { __call = function()
|
||||
{
|
||||
{
|
||||
{
|
||||
create_bar_layout(User_config.status_bar_widgets),
|
||||
create_bar_layout(beautiful.user_config.status_bar_widgets),
|
||||
width = dpi(480),
|
||||
strategy = 'exact',
|
||||
widget = wibox.container.constraint,
|
||||
@@ -246,9 +255,9 @@ return setmetatable({}, { __call = function()
|
||||
magins = dpi(10),
|
||||
layout = wibox.container.margin,
|
||||
},
|
||||
border_color = Theme_config.notification_center.status_bar.border_color,
|
||||
border_width = Theme_config.notification_center.status_bar.border_width,
|
||||
shape = Theme_config.notification_center.status_bar.shape,
|
||||
border_color = beautiful.colorscheme.border_color,
|
||||
border_width = dpi(2),
|
||||
shape = beautiful.shape[12],
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
widget = wibox.container.constraint,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
--------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
local beautiful = require('beautiful')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local wibox = require('wibox')
|
||||
local gfilesystem = require('gears.filesystem')
|
||||
@@ -82,12 +83,12 @@ if not instance then
|
||||
widget = wibox.widget.textbox,
|
||||
id = 'description',
|
||||
},
|
||||
fg = Theme_config.notification_center.weather.description_fg,
|
||||
fg = beautiful.colorscheme.bg_blue,
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
{ -- line
|
||||
{
|
||||
bg = Theme_config.notification_center.weather.line_color,
|
||||
bg = beautiful.colorscheme.bg1,
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
widget = wibox.container.constraint,
|
||||
@@ -99,7 +100,7 @@ if not instance then
|
||||
{ -- Speed
|
||||
{
|
||||
image = gcolor.recolor_image(icondir .. 'weather-windy.svg',
|
||||
Theme_config.notification_center.weather.speed_icon_color),
|
||||
beautiful.colorscheme.bg_red),
|
||||
valign = 'center',
|
||||
halign = 'center',
|
||||
widget = wibox.widget.imagebox,
|
||||
@@ -127,7 +128,7 @@ if not instance then
|
||||
valign = 'center',
|
||||
halign = 'center',
|
||||
image = gcolor.recolor_image(icondir .. 'humidity.svg',
|
||||
Theme_config.notification_center.weather.humidity_icon_color),
|
||||
beautiful.colorscheme.bg_red),
|
||||
},
|
||||
widget = wibox.container.constraint,
|
||||
width = dpi(24),
|
||||
@@ -154,9 +155,9 @@ if not instance then
|
||||
},
|
||||
widget = wibox.container.place,
|
||||
},
|
||||
border_color = Theme_config.notification_center.weather.border_color,
|
||||
border_width = Theme_config.notification_center.weather.border_width,
|
||||
shape = Theme_config.notification_center.weather.shape,
|
||||
border_color = beautiful.colorscheme.border_color,
|
||||
border_width = dpi(2),
|
||||
shape = beautiful.shape[12],
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
top = dpi(20),
|
||||
@@ -176,7 +177,7 @@ if not instance then
|
||||
call_now = true,
|
||||
callback = function()
|
||||
aspawn.easy_async_with_shell("curl -sf 'http://api.openweathermap.org/data/2.5/weather?id=" ..
|
||||
User_config.weather_secrets.city_id .. '&units=' .. User_config.weather_secrets.unit .. '&appid=' .. User_config.weather_secrets.key .. "'",
|
||||
beautiful.user_config.weather_secrets.city_id .. '&units=' .. beautiful.user_config.weather_secrets.unit .. '&appid=' .. beautiful.user_config.weather_secrets.key .. "'",
|
||||
function(stdout)
|
||||
if not stdout:match('error') then
|
||||
local weather_metadata = json_lua:decode(stdout)
|
||||
|
||||
Reference in New Issue
Block a user