converted all colors to theme_config.lua; fixed and added some bugs; rewrote some stuff and added some

This commit is contained in:
Kievits Rene
2022-06-27 01:08:45 +02:00
parent 0ccd38f03a
commit b2e22fdf8a
44 changed files with 1520 additions and 767 deletions

View File

@@ -55,15 +55,19 @@ return function(s)
widget = wibox.container.background
}
local get_volume = function()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh volume",
function(stdout)
awesome.connect_signal(
"audio::get",
function(muted, volume)
if muted then
audio_widget.container.audio_layout.label.visible = false
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", Theme_config.audio.fg))
else
audio_widget.container:set_right(10)
local icon = icondir .. "volume"
stdout = stdout:gsub("%%", "")
local volume = tonumber(stdout) or 0
audio_widget.container.audio_layout.spacing = dpi(5)
audio_widget.container.audio_layout.label.visible = true
volume = tonumber(volume)
if volume < 1 then
icon = icon .. "-mute"
audio_widget.container.audio_layout.spacing = dpi(0)
@@ -78,29 +82,9 @@ return function(s)
audio_widget.container.audio_layout.label:set_text(volume .. "%")
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
gears.color.recolor_image(icon .. ".svg", Theme_config.audio.fg))
awesome.emit_signal("get::volume", volume)
awesome.emit_signal("update::volume_widget", volume, icon .. ".svg")
end
)
end
local check_muted = function()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh mute",
function(stdout)
if stdout:match("yes") then
audio_widget.container.audio_layout.label.visible = false
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", Theme_config.audio.fg))
awesome.emit_signal("get::volume_mute", true)
else
audio_widget.container:set_right(10)
awesome.emit_signal("get::volume_mute", false)
get_volume()
end
end
)
end
end
)
-- Signals
Hover_signal(audio_widget, Theme_config.audio.bg, Theme_config.audio.fg)
@@ -108,19 +92,10 @@ return function(s)
audio_widget:connect_signal(
"button::press",
function()
awesome.emit_signal("module::slider:update")
awesome.emit_signal("volume_controller::toggle", s)
awesome.emit_signal("volume_controller::toggle:keygrabber")
end
)
gears.timer {
timeout = 0.5,
call_now = true,
autostart = true,
callback = check_muted
}
check_muted()
return audio_widget
end

View File

@@ -4,16 +4,14 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local watch = awful.widget.watch
local wibox = require("wibox")
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
--TODO: Add tooltip with more CPU and per core information
return function(widget, clock_mode)
return function(widget, _)
local cpu_usage_widget = wibox.widget {
{
@@ -93,7 +91,7 @@ return function(widget, clock_mode)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Green200"],
bg = Theme_config.cpu_temp.bg_low,
fg = Theme_config.cpu_temp.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
@@ -157,13 +155,13 @@ return function(widget, clock_mode)
local temp_icon
local temp_color
if temp < 50 then
temp_color = color["Green200"]
temp_color = Theme_config.cpu_temp.bg_low
temp_icon = icon_dir .. "thermometer-low.svg"
elseif temp >= 50 and temp < 80 then
temp_color = color["Orange200"]
temp_color = Theme_config.cpu_temp.bg_mid
temp_icon = icon_dir .. "thermometer.svg"
elseif temp >= 80 then
temp_color = color["Red200"]
temp_color = Theme_config.cpu_temp.bg_high
temp_icon = icon_dir .. "thermometer-high.svg"
end
Hover_signal(cpu_temp, temp_color, Theme_config.cpu_temp.fg)

View File

@@ -40,7 +40,8 @@ return function()
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
format = "%a, %b %d",
widget = wibox.widget.textclock
},
id = "date_layout",
layout = wibox.layout.fixed.horizontal
@@ -58,36 +59,8 @@ return function()
widget = wibox.container.background
}
local set_date = function()
date_widget.container.date_layout.label:set_text(os.date("%a, %b %d"))
end
-- Updates the date every minute, dont blame me if you miss silvester
gears.timer {
timeout = 60,
autostart = true,
call_now = true,
callback = function()
set_date()
end
}
-- Signals
Hover_signal(date_widget, Theme_config.date.bg, Theme_config.date.fg)
date_widget:connect_signal(
"mouse::enter",
function()
awesome.emit_signal("widget::calendar_osd:stop", true)
end
)
date_widget:connect_signal(
"mouse::leave",
function()
awesome.emit_signal("widget::calendar_osd:rerun", true)
end
)
return date_widget
end

View File

@@ -4,10 +4,8 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local watch = awful.widget.watch
local wibox = require("wibox")
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
@@ -92,7 +90,7 @@ return function(widget)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Green200"],
bg = Theme_config.gpu_temp.bg_low,
fg = Theme_config.gpu_temp.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
@@ -120,18 +118,18 @@ return function(widget)
if temp_num then
if temp_num < 50 then
temp_color = color["Green200"]
temp_color = Theme_config.gpu_temp.bg_low
temp_icon = icon_dir .. "thermometer-low.svg"
elseif temp_num >= 50 and temp_num < 80 then
temp_color = color["Orange200"]
temp_color = Theme_config.gpu_temp.bg_mid
temp_icon = icon_dir .. "thermometer.svg"
elseif temp_num >= 80 then
temp_color = color["Red200"]
temp_color = Theme_config.gpu_temp.bg_high
temp_icon = icon_dir .. "thermometer-high.svg"
end
else
temp_num = "NaN"
temp_color = color["Green200"]
temp_color = Theme_config.gpu_temp.bg_low
temp_icon = icon_dir .. "thermometer-low.svg"
end
gpu_temp_widget.container.gpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)

View File

@@ -58,7 +58,7 @@ return function()
Hover_signal(ram_widget, Theme_config.ram_info.bg, Theme_config.ram_info.fg)
awesome.connect_signal(
"update::ram",
"update::ram_widget",
function(MemTotal, MemFree, MemAvailable)
local ram_string = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) ..
"/" .. string.format("%.1f", (MemTotal / 1024 / 1024)) .. "GB"):gsub(",", ".")

View File

@@ -82,6 +82,7 @@ local list_update = function(widget, buttons, _, _, objects)
id = "icon_container",
{
id = "icon",
image = client.icon,
resize = true,
valign = "center",
halign = "center",
@@ -94,7 +95,7 @@ local list_update = function(widget, buttons, _, _, objects)
widget = wibox.container.margin
}
icon.icon_container.icon:set_image(xdg_icon_lookup:find_icon(client.class, 64))
icon.icon_container.icon:set_image(xdg_icon_lookup:find_icon(client.class, 64) or client.icon)
tag_widget.container:setup({
icon,

View File

@@ -22,6 +22,7 @@ local list_update = function(widget, buttons, label, _, objects)
valign = "center",
halign = "center",
resize = true,
image = object.icon,
widget = wibox.widget.imagebox
},
nil,
@@ -113,7 +114,8 @@ local list_update = function(widget, buttons, label, _, objects)
task_widget:set_bg(Theme_config.tasklist.bg)
task_widget.container.layout_it.title:set_text('')
end
task_widget.container.layout_it.margin.layout_icon.icon:set_image(xdg_icon_lookup:find_icon(object.class, 64))
task_widget:get_children_by_id("icon")[1]:set_image(xdg_icon_lookup:find_icon(object.class, 64) or
object.icon)
widget:add(task_widget)
widget:set_spacing(dpi(6))