Forgot what I did, probably some stuff
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
---@diagnostic disable: undefined-field
|
||||
--------------------------------
|
||||
-- This is the battery widget --
|
||||
--------------------------------
|
||||
|
||||
@@ -8,6 +8,9 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local color = require("src.lib.color")
|
||||
local rubato = require("src.lib.rubato")
|
||||
|
||||
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
|
||||
|
||||
--TODO: Add tooltip with more CPU and per core information
|
||||
@@ -149,11 +152,32 @@ return function(widget, _)
|
||||
end
|
||||
)
|
||||
|
||||
local r_timed_cpu_bg = rubato.timed { duration = 2.5 }
|
||||
local g_timed_cpu_bg = rubato.timed { duration = 2.5 }
|
||||
local b_timed_cpu_bg = rubato.timed { duration = 2.5 }
|
||||
|
||||
r_timed_cpu_bg.pos, g_timed_cpu_bg.pos, b_timed_cpu_bg.pos = color.utils.hex_to_rgba(Theme_config.cpu_temp.bg_low)
|
||||
|
||||
-- Subscribable function to have rubato set the bg/fg color
|
||||
local function update_bg()
|
||||
cpu_temp:set_bg("#" .. color.utils.rgba_to_hex { r_timed_cpu_bg.pos, g_timed_cpu_bg.pos, b_timed_cpu_bg.pos })
|
||||
end
|
||||
|
||||
r_timed_cpu_bg:subscribe(update_bg)
|
||||
g_timed_cpu_bg:subscribe(update_bg)
|
||||
b_timed_cpu_bg:subscribe(update_bg)
|
||||
|
||||
-- Both functions to set a color, if called they take a new color
|
||||
local function set_bg(newbg)
|
||||
r_timed_cpu_bg.target, g_timed_cpu_bg.target, b_timed_cpu_bg.target = color.utils.hex_to_rgba(newbg)
|
||||
end
|
||||
|
||||
awesome.connect_signal(
|
||||
"update::cpu_temp",
|
||||
function(temp)
|
||||
local temp_icon
|
||||
local temp_color
|
||||
|
||||
if temp < 50 then
|
||||
temp_color = Theme_config.cpu_temp.bg_low
|
||||
temp_icon = icon_dir .. "thermometer-low.svg"
|
||||
@@ -165,7 +189,7 @@ return function(widget, _)
|
||||
temp_icon = icon_dir .. "thermometer-high.svg"
|
||||
end
|
||||
cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
|
||||
cpu_temp:set_bg(temp_color)
|
||||
set_bg(temp_color)
|
||||
cpu_temp.container.cpu_layout.label.text = math.floor(temp) .. "°C"
|
||||
awesome.emit_signal("update::cpu_temp_widget", temp, temp_icon)
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---------------------------------
|
||||
-- This is the CPU Info widget --
|
||||
-- This is the gpu Info widget --
|
||||
---------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
@@ -8,6 +8,9 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local color = require("src.lib.color")
|
||||
local rubato = require("src.lib.rubato")
|
||||
|
||||
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
|
||||
|
||||
return function(widget)
|
||||
@@ -64,7 +67,7 @@ return function(widget)
|
||||
widget = wibox.widget.imagebox,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
image = gears.color.recolor_image(icon_dir .. "cpu.svg", Theme_config.gpu_temp.fg),
|
||||
image = gears.color.recolor_image(icon_dir .. "gpu.svg", Theme_config.gpu_temp.fg),
|
||||
resize = false
|
||||
},
|
||||
id = "icon_layout",
|
||||
@@ -108,6 +111,28 @@ return function(widget)
|
||||
end
|
||||
)
|
||||
|
||||
local r_timed_gpu_bg = rubato.timed { duration = 2.5 }
|
||||
local g_timed_gpu_bg = rubato.timed { duration = 2.5 }
|
||||
local b_timed_gpu_bg = rubato.timed { duration = 2.5 }
|
||||
|
||||
r_timed_gpu_bg.pos, g_timed_gpu_bg.pos, b_timed_gpu_bg.pos = color.utils.hex_to_rgba(Theme_config.cpu_temp.bg_low)
|
||||
|
||||
-- Subscribable function to have rubato set the bg/fg color
|
||||
local function update_bg()
|
||||
gpu_temp_widget:set_bg("#" ..
|
||||
color.utils.rgba_to_hex { math.max(0, r_timed_gpu_bg.pos), math.max(0, g_timed_gpu_bg.pos),
|
||||
math.max(0, b_timed_gpu_bg.pos) })
|
||||
end
|
||||
|
||||
r_timed_gpu_bg:subscribe(update_bg)
|
||||
g_timed_gpu_bg:subscribe(update_bg)
|
||||
b_timed_gpu_bg:subscribe(update_bg)
|
||||
|
||||
-- Both functions to set a color, if called they take a new color
|
||||
local function set_bg(newbg)
|
||||
r_timed_gpu_bg.target, g_timed_gpu_bg.target, b_timed_gpu_bg.target = color.utils.hex_to_rgba(newbg)
|
||||
end
|
||||
|
||||
-- GPU Temperature
|
||||
awesome.connect_signal(
|
||||
"update::gpu_temp",
|
||||
@@ -135,7 +160,7 @@ return function(widget)
|
||||
temp_icon = icon_dir .. "thermometer-low.svg"
|
||||
end
|
||||
gpu_temp_widget.container.gpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
|
||||
gpu_temp_widget:set_bg(temp_color)
|
||||
set_bg(temp_color)
|
||||
gpu_temp_widget.container.gpu_layout.label.text = tostring(temp_num) .. "°C"
|
||||
end
|
||||
)
|
||||
|
||||
@@ -8,6 +8,9 @@ local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
|
||||
local color = require("src.lib.color")
|
||||
local rubato = require("src.lib.rubato")
|
||||
|
||||
local list_update = function(widget, buttons, _, _, objects)
|
||||
widget:reset()
|
||||
|
||||
@@ -35,6 +38,7 @@ local list_update = function(widget, buttons, _, _, objects)
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
fg = Theme_config.taglist.fg,
|
||||
bg = Theme_config.taglist.bg,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
@@ -63,17 +67,67 @@ local list_update = function(widget, buttons, _, _, objects)
|
||||
|
||||
tag_widget:buttons(create_buttons(buttons, object))
|
||||
|
||||
tag_widget.container.margin.label:set_text(object.index)
|
||||
if object.urgent == true then
|
||||
tag_widget:set_bg(Theme_config.taglist.bg_urgent)
|
||||
tag_widget:set_fg(Theme_config.taglist.fg_urgent)
|
||||
elseif object == awful.screen.focused().selected_tag then
|
||||
tag_widget:set_bg(Theme_config.taglist.bg_focus)
|
||||
tag_widget:set_fg(Theme_config.taglist.fg_focus)
|
||||
else
|
||||
tag_widget:set_bg(Theme_config.taglist.bg)
|
||||
--#region Rubato and Color animation
|
||||
|
||||
-- Background rubato init
|
||||
local r_timed_bg = rubato.timed { duration = 0.5 }
|
||||
local g_timed_bg = rubato.timed { duration = 0.5 }
|
||||
local b_timed_bg = rubato.timed { duration = 0.5 }
|
||||
|
||||
-- starting color
|
||||
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(Theme_config.taglist.bg)
|
||||
|
||||
|
||||
-- Foreground rubato init
|
||||
local r_timed_fg = rubato.timed { duration = 0.5 }
|
||||
local g_timed_fg = rubato.timed { duration = 0.5 }
|
||||
local b_timed_fg = rubato.timed { duration = 0.5 }
|
||||
|
||||
-- starting color
|
||||
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(Theme_config.taglist.fg)
|
||||
|
||||
-- Subscribable function to have rubato set the bg/fg color
|
||||
local function update_bg()
|
||||
tag_widget:set_bg("#" ..
|
||||
color.utils.rgba_to_hex { math.max(0, r_timed_bg.pos), math.max(0, g_timed_bg.pos), math.max(0, b_timed_bg.pos) })
|
||||
end
|
||||
|
||||
local function update_fg()
|
||||
tag_widget:set_fg("#" ..
|
||||
color.utils.rgba_to_hex { math.max(0, r_timed_fg.pos), math.max(0, g_timed_fg.pos), math.max(0, b_timed_fg.pos) })
|
||||
end
|
||||
|
||||
-- Subscribe to the function bg and fg
|
||||
r_timed_bg:subscribe(update_bg)
|
||||
g_timed_bg:subscribe(update_bg)
|
||||
b_timed_bg:subscribe(update_bg)
|
||||
r_timed_fg:subscribe(update_fg)
|
||||
g_timed_fg:subscribe(update_fg)
|
||||
b_timed_fg:subscribe(update_fg)
|
||||
|
||||
-- Both functions to set a color, if called they take a new color
|
||||
local function set_bg(newbg)
|
||||
r_timed_bg.target, g_timed_bg.target, b_timed_bg.target = color.utils.hex_to_rgba(newbg)
|
||||
end
|
||||
|
||||
local function set_fg(newfg)
|
||||
r_timed_fg.target, g_timed_fg.target, b_timed_fg.target = color.utils.hex_to_rgba(newfg)
|
||||
end
|
||||
|
||||
tag_widget.container.margin.label:set_text(object.index)
|
||||
-- Use the wraper function to call the set_bg and set_fg based on the client state
|
||||
if object.urgent == true then
|
||||
set_bg(Theme_config.taglist.bg_urgent)
|
||||
set_fg(Theme_config.taglist.fg_urgent)
|
||||
elseif object == awful.screen.focused().selected_tag then
|
||||
set_bg(Theme_config.taglist.bg_focus)
|
||||
set_fg(Theme_config.taglist.fg_focus)
|
||||
else
|
||||
set_fg(Theme_config.taglist.fg)
|
||||
set_bg(Theme_config.taglist.bg)
|
||||
end
|
||||
--#endregion
|
||||
|
||||
-- Set the icon for each client
|
||||
for _, client in ipairs(object:clients()) do
|
||||
tag_widget.container.margin:set_right(0)
|
||||
|
||||
@@ -8,6 +8,9 @@ local wibox = require('wibox')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local gears = require('gears')
|
||||
|
||||
local color = require("src.lib.color")
|
||||
local rubato = require("src.lib.rubato")
|
||||
|
||||
local list_update = function(widget, buttons, label, _, objects)
|
||||
widget:reset()
|
||||
for _, object in ipairs(objects) do
|
||||
@@ -90,6 +93,55 @@ local list_update = function(widget, buttons, label, _, objects)
|
||||
task_widget:buttons(create_buttons(buttons, object))
|
||||
|
||||
local text, _ = label(object, task_widget.container.layout_it.title)
|
||||
|
||||
|
||||
--#region Rubato and Color animation
|
||||
|
||||
-- Background rubato init
|
||||
local r_timed_bg = rubato.timed { duration = 0.5 }
|
||||
local g_timed_bg = rubato.timed { duration = 0.5 }
|
||||
local b_timed_bg = rubato.timed { duration = 0.5 }
|
||||
|
||||
-- starting color
|
||||
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(Theme_config.tasklist.bg)
|
||||
|
||||
|
||||
-- Foreground rubato init
|
||||
local r_timed_fg = rubato.timed { duration = 0.5 }
|
||||
local g_timed_fg = rubato.timed { duration = 0.5 }
|
||||
local b_timed_fg = rubato.timed { duration = 0.5 }
|
||||
|
||||
-- starting color
|
||||
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(Theme_config.tasklist.fg)
|
||||
|
||||
-- Subscribable function to have rubato set the bg/fg color
|
||||
local function update_bg()
|
||||
task_widget:set_bg("#" .. color.utils.rgba_to_hex { r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos })
|
||||
end
|
||||
|
||||
local function update_fg()
|
||||
task_widget:set_fg("#" .. color.utils.rgba_to_hex { r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos })
|
||||
end
|
||||
|
||||
-- Subscribe to the function bg and fg
|
||||
r_timed_bg:subscribe(update_bg)
|
||||
g_timed_bg:subscribe(update_bg)
|
||||
b_timed_bg:subscribe(update_bg)
|
||||
r_timed_fg:subscribe(update_fg)
|
||||
g_timed_fg:subscribe(update_fg)
|
||||
b_timed_fg:subscribe(update_fg)
|
||||
|
||||
-- Both functions to set a color, if called they take a new color
|
||||
local function set_bg(newbg)
|
||||
r_timed_bg.target, g_timed_bg.target, b_timed_bg.target = color.utils.hex_to_rgba(newbg)
|
||||
end
|
||||
|
||||
local function set_fg(newfg)
|
||||
r_timed_fg.target, g_timed_fg.target, b_timed_fg.target = color.utils.hex_to_rgba(newfg)
|
||||
end
|
||||
|
||||
--#endregion
|
||||
|
||||
if object == client.focus then
|
||||
if text == nil or text == '' then
|
||||
task_widget.container.layout_it.title:set_margins(0)
|
||||
@@ -107,11 +159,11 @@ local list_update = function(widget, buttons, label, _, objects)
|
||||
task_tool_tip:remove_from_object(task_widget)
|
||||
end
|
||||
end
|
||||
task_widget:set_bg(Theme_config.tasklist.bg_focus)
|
||||
task_widget:set_fg(Theme_config.tasklist.fg_focus)
|
||||
set_bg(Theme_config.tasklist.bg_focus)
|
||||
set_fg(Theme_config.tasklist.fg_focus)
|
||||
task_widget.container.layout_it.title:set_text(text)
|
||||
else
|
||||
task_widget:set_bg(Theme_config.tasklist.bg)
|
||||
set_bg(Theme_config.tasklist.bg)
|
||||
task_widget.container.layout_it.title:set_text('')
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user