Reworked a whole lot. New config file and theme config file for easier changes. Did #19. And much more

This commit is contained in:
Kievits Rene
2022-06-14 06:33:33 +02:00
parent fd74ab9fb4
commit 521d392769
60 changed files with 2216 additions and 1450 deletions

View File

@@ -3,11 +3,9 @@
------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
require("src.core.signals")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/"
@@ -23,6 +21,8 @@ return function(s)
{
id = "icon",
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -47,10 +47,10 @@ return function(s)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Yellow200"],
fg = color["Grey900"],
bg = Theme_config.audio.bg,
fg = Theme_config.audio.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -77,7 +77,7 @@ return function(s)
end
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", color["Grey900"]))
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
@@ -90,9 +90,8 @@ return function(s)
function(stdout)
if stdout:match("yes") then
audio_widget.container.audio_layout.label.visible = false
audio_widget.container:set_right(0)
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", color["Grey900"]))
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)
@@ -104,13 +103,12 @@ return function(s)
end
-- Signals
Hover_signal(audio_widget, color["Yellow200"], color["Grey900"])
Hover_signal(audio_widget, Theme_config.audio.bg, Theme_config.audio.fg)
audio_widget:connect_signal(
"button::press",
function()
awesome.emit_signal("module::slider:update")
awesome.emit_signal("widget::volume_osd:rerun")
awesome.emit_signal("volume_controller::toggle", s)
awesome.emit_signal("volume_controller::toggle:keygrabber")
end

View File

@@ -5,7 +5,6 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local lgi = require("lgi")
@@ -30,8 +29,10 @@ return function(battery_kind)
{
{
id = "icon",
image = gears.color.recolor_image(icondir .. "battery-unknown.svg", "#212121"),
image = gears.color.recolor_image(icondir .. "battery-unknown.svg", Theme_config.battery.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -57,22 +58,22 @@ return function(battery_kind)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Purple200"],
fg = color["Grey900"],
bg = Theme_config.battery.bg,
fg = Theme_config.battery.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
-- Color change on mouse over
Hover_signal(battery_widget, color["Purple200"], color["Grey900"])
Hover_signal(battery_widget, Theme_config.battery.bg, Theme_config.battery.fg)
-- Open an energy manager on click
battery_widget:connect_signal(
'button::press',
function()
awful.spawn(user_vars.energy_manager)
awful.spawn(User_config.energy_manager)
end
)
@@ -153,7 +154,8 @@ return function(battery_kind)
icon = icondir .. icon,
timeout = 5
}
battery_widget:get_children_by_id("icon")[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon, "#212121"))
battery_widget:get_children_by_id("icon")[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir
.. icon, Theme_config.battery.fg))
return
elseif battery_percentage > 0 and battery_percentage < 10 and battery_status == 'discharging' then
icon = icon .. '-' .. 'alert.svg'
@@ -164,7 +166,8 @@ return function(battery_kind)
icon = icondir .. icon,
timeout = 60
}
battery_widget:get_children_by_id("icon")[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon, "#212121"))
battery_widget:get_children_by_id("icon")[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir
.. icon, Theme_config.battery.fg))
return
end
@@ -190,7 +193,8 @@ return function(battery_kind)
icon = icon .. '-' .. battery_status .. '-' .. '90'
end
battery_widget:get_children_by_id("icon")[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121"))
battery_widget:get_children_by_id("icon")[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir ..
icon .. '.svg', Theme_config.battery.fg))
awesome.emit_signal("update::battery_widget", battery_percentage, icondir .. icon .. ".svg")
end
@@ -202,7 +206,7 @@ return function(battery_kind)
---Will report to the bluetooth widget.
---@param path string device path /org/freedesktop/...
local function attach_to_device(path)
local device_path = user_vars.battery_path or path or ""
local device_path = User_config.battery_path or path or ""
battery_widget.device = get_device_from_path(device_path) or upower_glib.Client():get_display_device()
@@ -226,7 +230,7 @@ return function(battery_kind)
battery_widget:connect_signal(
"upower::update",
function(widget, device)
function(_, device)
if upower_glib.DeviceKind[battery_widget.device.kind] == battery_kind then
set_battery(device)
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 naughty = require("naughty")
local wibox = require("wibox")
-- Icon directory path
@@ -20,8 +18,10 @@ return function(s)
{
{
id = "icon",
image = gears.color.recolor_image(icondir .. "bluetooth-off.svg"),
image = gears.color.recolor_image(icondir .. "bluetooth-off.svg", Theme_config.bluetooth.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -32,27 +32,29 @@ return function(s)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Blue200"],
fg = color["Grey900"],
bg = Theme_config.bluetooth.bg,
fg = Theme_config.bluetooth.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
-- Hover signal to change color when mouse is over
Hover_signal(bluetooth_widget, color["Blue200"], color["Grey900"])
Hover_signal(bluetooth_widget, Theme_config.bluetooth.bg, Theme_config.bluetooth.fg)
awesome.connect_signal("state", function(state)
if state then
bluetooth_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icondir .. "bluetooth-on.svg", color["Grey900"]))
bluetooth_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icondir .. "bluetooth-on.svg",
Theme_config.bluetooth.fg))
else
bluetooth_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icondir .. "bluetooth-off.svg", color["Grey900"]))
bluetooth_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icondir .. "bluetooth-off.svg",
Theme_config.bluetooth.fg))
end
end)
bluetooth_widget:connect_signal(
"button::press",
function(c, d, e, key)
function(_, _, _, key)
if key == 1 then
awesome.emit_signal("bluetooth_controller::toggle", s)
else

View File

@@ -4,11 +4,9 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
require("src.core.signals")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/clock/"
@@ -23,8 +21,10 @@ return function()
{
{
id = "icon",
image = gears.color.recolor_image(icondir .. "clock.svg", color["Grey900"]),
image = gears.color.recolor_image(icondir .. "clock.svg", Theme_config.clock.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -50,15 +50,15 @@ return function()
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Orange200"],
fg = color["Grey900"],
bg = Theme_config.clock.bg,
fg = Theme_config.clock.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
Hover_signal(clock_widget, color["Orange200"], color["Grey900"])
Hover_signal(clock_widget, Theme_config.clock.bg, Theme_config.clock.fg)
return clock_widget
end

View File

@@ -9,7 +9,6 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local watch = awful.widget.watch
local wibox = require("wibox")
require("src.core.signals")
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
@@ -24,7 +23,9 @@ return function(widget, clock_mode)
{
id = "icon",
widget = wibox.widget.imagebox,
image = gears.color.recolor_image(icon_dir .. "cpu.svg", color["Grey900"]),
valign = "center",
halign = "center",
image = gears.color.recolor_image(icon_dir .. "cpu.svg", Theme_config.cpu_usage.fg),
resize = false
},
id = "icon_layout",
@@ -49,10 +50,10 @@ return function(widget, clock_mode)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Blue200"],
fg = color["Grey900"],
bg = Theme_config.cpu_usage.bg,
fg = Theme_config.cpu_usage.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -64,7 +65,10 @@ return function(widget, clock_mode)
{
{
id = "icon",
image = gears.color.recolor_image(icon_dir .. "thermometer.svg", Theme_config.cpu_temp.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -90,9 +94,9 @@ return function(widget, clock_mode)
widget = wibox.container.margin
},
bg = color["Green200"],
fg = color["Grey900"],
fg = Theme_config.cpu_temp.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -105,7 +109,9 @@ return function(widget, clock_mode)
{
id = "icon",
widget = wibox.widget.imagebox,
image = icon_dir .. "cpu.svg",
valign = "center",
halign = "center",
image = gears.color.recolor_image(icon_dir .. "cpu.svg", Theme_config.cpu_freq.fg),
resize = false
},
id = "icon_layout",
@@ -130,10 +136,10 @@ return function(widget, clock_mode)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Purple200"],
fg = color["Grey900"],
bg = Theme_config.cpu_freq.bg,
fg = Theme_config.cpu_freq.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -182,7 +188,7 @@ return function(widget, clock_mode)
temp_color = color["Red200"]
temp_icon = icon_dir .. "thermometer-high.svg"
end
Hover_signal(cpu_temp, temp_color, color["Grey900"])
Hover_signal(cpu_temp, temp_color, Theme_config.cpu_temp.fg)
cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
cpu_temp:set_bg(temp_color)
cpu_temp.container.cpu_layout.label.text = math.floor(temp_num) .. "°C"
@@ -214,8 +220,8 @@ return function(widget, clock_mode)
end
)
Hover_signal(cpu_usage_widget, color["Blue200"], color["Grey900"])
Hover_signal(cpu_clock, color["Purple200"], color["Grey900"])
Hover_signal(cpu_usage_widget, Theme_config.cpu_usage.bg, Theme_config.cpu_usage.fg)
Hover_signal(cpu_clock, Theme_config.cpu_freq.bg, Theme_config.cpu_freq.bg)
if widget == "usage" then
return cpu_usage_widget

View File

@@ -4,7 +4,6 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -23,8 +22,10 @@ return function()
{
{
id = "icon",
image = gears.color.recolor_image(icondir .. "calendar.svg", color["Grey900"]),
image = gears.color.recolor_image(icondir .. "calendar.svg", Theme_config.date.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -49,10 +50,10 @@ return function()
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Teal200"],
fg = color["Grey900"],
bg = Theme_config.date.bg,
fg = Theme_config.date.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -72,7 +73,7 @@ return function()
}
-- Signals
Hover_signal(date_widget, color["Teal200"], color["Grey900"])
Hover_signal(date_widget, Theme_config.date.bg, Theme_config.date.fg)
date_widget:connect_signal(
"mouse::enter",

View File

@@ -9,7 +9,6 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local watch = awful.widget.watch
local wibox = require("wibox")
require("src.core.signals")
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
@@ -22,7 +21,53 @@ return function(widget)
{
id = "icon",
widget = wibox.widget.imagebox,
image = gears.color.recolor_image(icon_dir .. "gpu.svg", color["Grey900"]),
valign = "center",
halign = "center",
image = gears.color.recolor_image(icon_dir .. "gpu.svg", Theme_config.gpu_usage.fg),
resize = false
},
id = "icon_layout",
widget = wibox.container.place
},
top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
},
spacing = dpi(10),
{
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "gpu_layout",
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(8),
right = dpi(8),
widget = wibox.container.margin
},
bg = Theme_config.gpu_usage.bg,
fg = Theme_config.gpu_usage.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
Hover_signal(gpu_usage_widget, Theme_config.gpu_usage.bg, Theme_config.gpu_usage.fg)
local gpu_temp_widget = wibox.widget {
{
{
{
{
{
id = "icon",
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icon_dir .. "cpu.svg", Theme_config.gpu_temp.fg),
resize = false
},
id = "icon_layout",
@@ -48,51 +93,9 @@ return function(widget)
widget = wibox.container.margin
},
bg = color["Green200"],
fg = color["Grey900"],
fg = Theme_config.gpu_temp.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.container.background
}
Hover_signal(gpu_usage_widget, color["Green200"], color["Grey900"])
local gpu_temp_widget = wibox.widget {
{
{
{
{
{
id = "icon",
widget = wibox.widget.imagebox,
image = gears.color.recolor_image(icon_dir .. "cpu.svg", color["Grey900"]),
resize = false
},
id = "icon_layout",
widget = wibox.container.place
},
top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
},
spacing = dpi(10),
{
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "gpu_layout",
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(8),
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Blue200"],
fg = color["Grey900"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -117,22 +120,29 @@ return function(widget)
local temp_color
local temp_num = tonumber(stdout)
if temp_num < 50 then
if temp_num then
if temp_num < 50 then
temp_color = color["Green200"]
temp_icon = icon_dir .. "thermometer-low.svg"
elseif temp_num >= 50 and temp_num < 80 then
temp_color = color["Orange200"]
temp_icon = icon_dir .. "thermometer.svg"
elseif temp_num >= 80 then
temp_color = color["Red200"]
temp_icon = icon_dir .. "thermometer-high.svg"
end
else
temp_num = "NaN"
temp_color = color["Green200"]
temp_icon = icon_dir .. "thermometer-low.svg"
elseif temp_num >= 50 and temp_num < 80 then
temp_color = color["Orange200"]
temp_icon = icon_dir .. "thermometer.svg"
elseif temp_num >= 80 then
temp_color = color["Red200"]
temp_icon = icon_dir .. "thermometer-high.svg"
end
Hover_signal(gpu_temp_widget, temp_color, color["Grey900"])
Hover_signal(gpu_temp_widget, temp_color, Theme_config.gpu_temp.fg)
gpu_temp_widget.container.gpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
gpu_temp_widget:set_bg(temp_color)
gpu_temp_widget.container.gpu_layout.label.text = tostring(temp_num) .. "°C"
awesome.emit_signal("update::gpu_temp_widget", temp_num, temp_icon)
end
)

View File

@@ -4,11 +4,9 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
require("src.core.signals")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/kblayout/"
@@ -23,7 +21,9 @@ return function(s)
id = "icon",
widget = wibox.widget.imagebox,
resize = false,
image = gears.color.recolor_image(icondir .. "keyboard.svg", color["Grey900"])
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "keyboard.svg", Theme_config.kblayout.fg)
},
id = "icon_layout",
widget = wibox.container.place
@@ -47,10 +47,10 @@ return function(s)
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Green200"],
fg = color["Grey900"],
bg = Theme_config.kblayout.bg,
fg = Theme_config.kblayout.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -179,10 +179,10 @@ return function(s)
{
text = shortname,
widget = wibox.widget.textbox,
font = user_vars.font.extrabold,
font = User_config.font.extrabold,
id = "shortname"
},
fg = color["Red200"],
fg = Theme_config.kblayout.item.fg_short,
widget = wibox.container.background,
id = "background2"
},
@@ -190,10 +190,10 @@ return function(s)
{
text = longname,
widget = wibox.widget.textbox,
font = user_vars.font.bold,
font = User_config.font.bold,
id = "longname",
},
fg = color["Purple200"],
fg = Theme_config.kblayout.item.fg_long,
widget = wibox.container.background,
id = "background1"
},
@@ -206,10 +206,9 @@ return function(s)
id = "margin"
},
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 8)
gears.shape.rounded_rect(cr, width, height, dpi(8))
end,
bg = color["Grey800"],
fg = color["White"],
bg = Theme_config.kblayout.item.bg,
widget = wibox.container.background,
id = "background",
keymap = keymap
@@ -224,13 +223,13 @@ return function(s)
function(stdout)
local layout = stdout:gsub("\n", "")
if kb_layout_item.keymap == layout then
kb_layout_item.bg = color["DeepPurple200"]
kb_layout_item:get_children_by_id("background2")[1].fg = color["Grey900"]
kb_layout_item:get_children_by_id("background1")[1].fg = color["Grey900"]
kb_layout_item.bg = Theme_config.kblayout.item.bg_selected
kb_layout_item:get_children_by_id("background2")[1].fg = Theme_config.kblayout.item.fg_selected
kb_layout_item:get_children_by_id("background1")[1].fg = Theme_config.kblayout.item.fg_selected
else
kb_layout_item.bg = color["Grey800"]
kb_layout_item:get_children_by_id("background2")[1].fg = color["Red200"]
kb_layout_item:get_children_by_id("background1")[1].fg = color["Purple200"]
kb_layout_item.bg = Theme_config.kblayout.item.bg
kb_layout_item:get_children_by_id("background2")[1].fg = Theme_config.kblayout.item.fg_short
kb_layout_item:get_children_by_id("background1")[1].fg = Theme_config.kblayout.item.fg_long
end
end
)
@@ -260,7 +259,7 @@ return function(s)
layout = wibox.layout.fixed.vertical,
spacing = dpi(10)
}
for i, keymap in pairs(user_vars.kblayout) do
for i, keymap in pairs(User_config.kblayout) do
kb_layout_items[i] = create_kb_layout_item(keymap)
end
local cont = {
@@ -277,18 +276,19 @@ return function(s)
local kb_menu_widget = awful.popup {
screen = s,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
widget = wibox.container.background,
bg = color["Grey900"],
fg = color["White"],
bg = Theme_config.kblayout.bg_container,
border_width = dpi(4),
border_color = color["Grey800"],
border_color = Theme_config.kblayout.border_color_container,
width = dpi(100),
max_height = dpi(600),
visible = false,
ontop = true,
placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(255), top = dpi(60) } }) end
placement = function(c) awful.placement.align(c,
{ position = "top_right", margins = { right = dpi(255), top = dpi(60) } })
end
}
kb_menu_widget:connect_signal(
@@ -296,7 +296,7 @@ return function(s)
function()
mousegrabber.run(
function()
kblayout_widget.bg = color["Green200"]
kblayout_widget.bg = Theme_config.kblayout.bg
awesome.emit_signal("kblayout::hide:kbmenu")
mousegrabber.stop()
return true
@@ -321,18 +321,18 @@ return function(s)
awful.spawn.easy_async_with_shell(
"setxkbmap -query | grep layout: | awk '{print $2}'",
function(stdout)
for j, n in ipairs(user_vars.kblayout) do
for j, n in ipairs(User_config.kblayout) do
if stdout:match(n) then
if j == #user_vars.kblayout then
if j == #User_config.kblayout then
awful.spawn.easy_async_with_shell(
"setxkbmap " .. user_vars.kblayout[1],
"setxkbmap " .. User_config.kblayout[1],
function()
get_kblayout()
end
)
else
awful.spawn.easy_async_with_shell(
"setxkbmap " .. user_vars.kblayout[j + 1],
"setxkbmap " .. User_config.kblayout[j + 1],
function()
get_kblayout()
end
@@ -352,7 +352,7 @@ return function(s)
)
-- Signals
Hover_signal(kblayout_widget, color["Green200"], color["Grey900"])
Hover_signal(kblayout_widget, Theme_config.kblayout.bg, Theme_config.kblayout.fg)
local kblayout_keygrabber = awful.keygrabber {
autostart = false,

View File

@@ -4,11 +4,25 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
require("src.core.signals")
--#region Layout icons
local layout_path = Theme_path .. "../assets/layout/"
Theme.layout_floating = layout_path .. "floating.svg"
Theme.layout_tile = layout_path .. "tile.svg"
Theme.layout_dwindle = layout_path .. "dwindle.svg"
Theme.layout_fairh = layout_path .. "fairh.svg"
Theme.layout_fairv = layout_path .. "fairv.svg"
Theme.layout_fullscreen = layout_path .. "fullscreen.svg"
Theme.layout_max = layout_path .. "max.svg"
Theme.layout_cornerne = layout_path .. "cornerne.svg"
Theme.layout_cornernw = layout_path .. "cornernw.svg"
Theme.layout_cornerse = layout_path .. "cornerse.svg"
Theme.layout_cornersw = layout_path .. "cornersw.svg"
--#endregion
-- Returns the layoutbox widget
return function()
@@ -25,15 +39,15 @@ return function()
forced_width = dpi(40),
widget = wibox.container.margin
},
bg = color["LightBlue200"],
bg = Theme_config.layout_list.bg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
-- Signals
Hover_signal(layout, color["LightBlue200"], color["Grey900"])
Hover_signal(layout, Theme_config.layout_list.bg, Theme_config.layout_list.fg)
layout:connect_signal(
"button::press",

View File

@@ -4,20 +4,18 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local naughty = require("naughty")
local wibox = require("wibox")
require("src.core.signals")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/network/"
-- Insert your interfaces here, get the from ip a
local interfaces = {
wlan_interface = user_vars.network.wlan,
lan_interface = user_vars.network.ethernet
wlan_interface = User_config.network.wlan,
lan_interface = User_config.network.ethernet
}
local network_mode = nil
@@ -34,8 +32,10 @@ return function()
{
{
id = 'icon',
image = gears.color.recolor_image(icondir .. "no-internet" .. ".svg", color["Grey900"]),
image = gears.color.recolor_image(icondir .. "no-internet" .. ".svg", Theme_config.network.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -61,10 +61,10 @@ return function()
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Red200"],
fg = color["Grey900"],
bg = Theme_config.network.bg,
fg = Theme_config.network.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -111,7 +111,7 @@ return function()
text = message,
title = title,
app_name = app_name,
icon = gears.color.recolor_image(icon, color["White"]),
icon = gears.color.recolor_image(icon, Theme_config.network.notify_icon_color),
timeout = 3
}
end
@@ -133,7 +133,10 @@ return function()
function(stdout)
local essid = stdout:match("SSID: (.-)\n") or "N/A"
local bitrate = stdout:match("tx bitrate: (.+/s)") or "N/A"
local message = "Connected to <b>" .. essid .. "</b>\nSignal strength <b>" .. tostring(wifi_strength) .. "%</b>\n" .. "Bit rate <b>" .. tostring(bitrate) .. "</b>"
local message = "Connected to <b>" ..
essid ..
"</b>\nSignal strength <b>" ..
tostring(wifi_strength) .. "%</b>\n" .. "Bit rate <b>" .. tostring(bitrate) .. "</b>"
if healthy then
update_tooltip(message)
@@ -165,7 +168,8 @@ return function()
update_wireless_data(false)
end
network_widget.container.network_layout.spacing = dpi(8)
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color["Grey900"]))
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir
.. icon .. ".svg", Theme_config.network.fg))
end
)
end
@@ -222,7 +226,7 @@ return function()
update_reconnect_startup(false)
end
network_widget.container.network_layout.label.visible = false
network_widget.container.network_layout.spacing = dpi(0)
network_widget.container.network_layout.spacing = 0
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(icondir .. icon .. ".svg")
end
)
@@ -230,14 +234,14 @@ return function()
end
local update_disconnected = function()
local notify_wireless_disconnected = function(essid)
local notify_wireless_disconnected = function()
local message = "WiFi has been disconnected"
local title = "Connection lost"
local app_name = "System Notification"
local icon = icondir .. "wifi-strength-off-outline.svg"
network_notify(message, title, app_name, icon)
end
local notify_wired_disconnected = function(essid)
local notify_wired_disconnected = function()
local message = "Ethernet has been unplugged"
local title = "Connection lost"
local app_name = "System Notification"
@@ -260,8 +264,9 @@ return function()
end
network_widget.container.network_layout.label.visible = false
update_tooltip("Network unreachable")
network_widget.container.network_layout.spacing = dpi(0)
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color["Grey900"]))
network_widget.container.network_layout.spacing = 0
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir ..
icon .. ".svg", Theme_config.network.fg))
end
local check_network_mode = function()
@@ -302,7 +307,6 @@ return function()
print_network_mode
]=],
function(stdout)
local mode = stdout:gsub("%\n", "")
if stdout:match("No internet connected") then
update_disconnected()
elseif stdout:match("wireless") then
@@ -324,7 +328,7 @@ return function()
}
-- Signals
Hover_signal(network_widget, color["Red200"], color["Grey900"])
Hover_signal(network_widget, Theme_config.network.bg, Theme_config.network.fg)
network_widget:connect_signal(
"button::press",

View File

@@ -4,11 +4,9 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
require("src.core.signals")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/power/"
@@ -22,8 +20,10 @@ return function()
{
{
id = "icon",
image = gears.color.recolor_image(icondir .. "power.svg", color["Grey900"]),
image = gears.color.recolor_image(icondir .. "power.svg", Theme_config.power_button.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
@@ -41,16 +41,16 @@ return function()
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Red200"],
fg = color["Grey800"],
bg = Theme_config.power_button.bg,
fg = Theme_config.power_button.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
-- Signals
Hover_signal(power_widget, color["Red200"], color["Grey900"])
Hover_signal(power_widget, Theme_config.power_button.bg, Theme_config.power_button.fg)
power_widget:connect_signal(
"button::release",

View File

@@ -4,12 +4,10 @@
-- 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")
require("src.core.signals")
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
@@ -22,7 +20,9 @@ return function()
{
id = "icon",
widget = wibox.widget.imagebox,
image = gears.color.recolor_image(icon_dir .. "ram.svg", color["Grey900"]),
valign = "center",
halign = "center",
image = gears.color.recolor_image(icon_dir .. "ram.svg", Theme_config.ram_info.fg),
resize = false
},
id = "icon_layout",
@@ -47,15 +47,15 @@ return function()
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Red200"],
fg = color["Grey900"],
bg = Theme_config.ram_info.bg,
fg = Theme_config.ram_info.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
Hover_signal(ram_widget, color["Red200"], color["Grey900"])
Hover_signal(ram_widget, Theme_config.ram_info.bg, Theme_config.ram_info.fg)
watch(
[[ bash -c "cat /proc/meminfo| grep Mem | awk '{print $2}'" ]],
@@ -64,7 +64,8 @@ return function()
local MemTotal, MemFree, MemAvailable = stdout:match("(%d+)\n(%d+)\n(%d+)\n")
local ram_string = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) .. "/" .. string.format("%.1f", (MemTotal / 1024 / 1024)) .. "GB"):gsub(",", ".")
local ram_string = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) ..
"/" .. string.format("%.1f", (MemTotal / 1024 / 1024)) .. "GB"):gsub(",", ".")
ram_widget.container.ram_layout.label.text = ram_string
awesome.emit_signal("update::ram_widget", math.floor(((MemTotal - MemAvailable) / MemTotal * 100) + 0.5))

View File

@@ -3,13 +3,12 @@
--------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
require("src.core.signals")
Theme.bg_systray = Theme_config.systray.bg
Theme.systray_icon_spacing = dpi(10)
return function(s)
local systray = wibox.widget {
@@ -25,12 +24,12 @@ return function(s)
},
widget = wibox.container.background,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
bg = color["BlueGrey800"]
bg = Theme_config.systray.bg
}
-- Signals
Hover_signal(systray.container, color["Red200"], color["Grey900"])
Hover_signal(systray.container, Theme_config.systray.bg, Theme_config.systray.bg)
awesome.connect_signal("systray::update", function()
local num_entries = awesome.systray()
@@ -42,7 +41,7 @@ return function(s)
end
end)
systray.container.st.widget:set_base_size(dpi(20))
systray.container.st.widget:set_base_size(dpi(24))
return systray
end

View File

@@ -7,10 +7,8 @@ local wibox = require("wibox")
local awful = require("awful")
local gears = require("gears")
local dpi = require("beautiful").xresources.apply_dpi
local color = require("src.theme.colors")
require("src.tools.icon_handler")
local list_update = function(widget, buttons, label, data, objects)
local list_update = function(widget, buttons, _, _, objects)
widget:reset()
for _, object in ipairs(objects) do
@@ -23,7 +21,7 @@ local list_update = function(widget, buttons, label, data, objects)
align = "center",
valign = "center",
visible = true,
font = user_vars.font.extrabold,
font = User_config.font.extrabold,
forced_width = dpi(25),
id = "label",
widget = wibox.widget.textbox
@@ -36,25 +34,25 @@ local list_update = function(widget, buttons, label, data, objects)
id = "container",
layout = wibox.layout.fixed.horizontal
},
fg = color["White"],
fg = Theme_config.taglist.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
local function create_buttons(buttons, object)
if buttons then
local function create_buttons(buttons_t, object_t)
if buttons_t then
local btns = {}
for _, b in ipairs(buttons) do
for _, b in ipairs(buttons_t) do
local btn = awful.button {
modifiers = b.modifiers,
button = b.button,
on_press = function()
b:emit_signal('press', object)
b:emit_signal('press', object_t)
end,
on_release = function()
b:emit_signal('release', object)
b:emit_signal('release', object_t)
end
}
btns[#btns + 1] = btn
@@ -67,13 +65,13 @@ local list_update = function(widget, buttons, label, data, objects)
tag_widget.container.margin.label:set_text(object.index)
if object.urgent == true then
tag_widget:set_bg(color["RedA200"])
tag_widget:set_fg(color["Grey900"])
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(color["White"])
tag_widget:set_fg(color["Grey900"])
tag_widget:set_bg(Theme_config.taglist.bg_focus)
tag_widget:set_fg(Theme_config.taglist.fg_focus)
else
tag_widget:set_bg("#3A475C")
tag_widget:set_bg(Theme_config.taglist.bg)
end
-- Set the icon for each client
@@ -85,6 +83,8 @@ local list_update = function(widget, buttons, label, data, objects)
{
id = "icon",
resize = true,
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
widget = wibox.container.place
@@ -93,7 +93,9 @@ local list_update = function(widget, buttons, label, data, objects)
margins = dpi(6),
widget = wibox.container.margin
}
icon.icon_container.icon:set_image(Get_icon(user_vars.icon_theme, client))
icon.icon_container.icon:set_image(xdg_icon_lookup:find_icon(client.class, 64))
tag_widget.container:setup({
icon,
strategy = "exact",
@@ -102,15 +104,14 @@ local list_update = function(widget, buttons, label, data, objects)
end
--#region Hover_signal
local old_wibox, old_cursor, old_bg
local old_wibox, old_cursor
tag_widget:connect_signal(
"mouse::enter",
function()
old_bg = tag_widget.bg
if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#dddddd' .. 'dd'
tag_widget.bg = Theme_config.taglist.bg_focus_hover .. 'dd'
else
tag_widget.bg = '#3A475C' .. 'dd'
tag_widget.bg = Theme_config.taglist.bg .. 'dd'
end
local w = mouse.current_wibox
if w then
@@ -124,9 +125,9 @@ local list_update = function(widget, buttons, label, data, objects)
"button::press",
function()
if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#bbbbbb' .. 'dd'
tag_widget.bg = Theme_config.taglist.bg_focus_pressed .. 'dd'
else
tag_widget.bg = '#3A475C' .. 'dd'
tag_widget.bg = Theme_config.taglist.bg .. 'dd'
end
end
)
@@ -135,9 +136,9 @@ local list_update = function(widget, buttons, label, data, objects)
"button::release",
function()
if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#dddddd' .. 'dd'
tag_widget.bg = Theme_config.taglist.bg_focus_hover .. 'dd'
else
tag_widget.bg = '#3A475C' .. 'dd'
tag_widget.bg = Theme_config.taglist.bg .. 'dd'
end
end
)
@@ -145,7 +146,11 @@ local list_update = function(widget, buttons, label, data, objects)
tag_widget:connect_signal(
"mouse::leave",
function()
tag_widget.bg = old_bg
if object == awful.screen.focused().selected_tag then
tag_widget.bg = Theme_config.taglist.bg_focus
else
tag_widget.bg = Theme_config.taglist.bg
end
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil

View File

@@ -7,9 +7,8 @@ local awful = require('awful')
local wibox = require('wibox')
local dpi = require('beautiful').xresources.apply_dpi
local gears = require('gears')
local color = require('src.theme.colors')
local list_update = function(widget, buttons, label, data, objects)
local list_update = function(widget, buttons, label, _, objects)
widget:reset()
for _, object in ipairs(objects) do
local task_widget = wibox.widget {
@@ -20,6 +19,8 @@ local list_update = function(widget, buttons, label, data, objects)
nil,
{
id = "icon",
valign = "center",
halign = "center",
resize = true,
widget = wibox.widget.imagebox
},
@@ -48,10 +49,9 @@ local list_update = function(widget, buttons, label, data, objects)
widget = wibox.container.margin,
id = "container"
},
bg = color["White"],
fg = color["Grey900"],
fg = Theme_config.tasklist.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
}
@@ -66,18 +66,18 @@ local list_update = function(widget, buttons, label, data, objects)
delay_show = 1
}
local function create_buttons(buttons, object)
if buttons then
local function create_buttons(buttons_t, object_t)
if buttons_t then
local btns = {}
for _, b in ipairs(buttons) do
for _, b in ipairs(buttons_t) do
local btn = awful.button {
modifiers = b.modifiers,
button = b.button,
on_press = function()
b:emit_signal('press', object)
b:emit_signal('press', object_t)
end,
on_release = function()
b:emit_signal('release', object)
b:emit_signal('release', object_t)
end
}
btns[#btns + 1] = btn
@@ -106,27 +106,26 @@ local list_update = function(widget, buttons, label, data, objects)
task_tool_tip:remove_from_object(task_widget)
end
end
task_widget:set_bg(color["White"])
task_widget:set_fg(color["Grey900"])
task_widget:set_bg(Theme_config.tasklist.bg_focus)
task_widget:set_fg(Theme_config.tasklist.fg_focus)
task_widget.container.layout_it.title:set_text(text)
else
task_widget:set_bg("#3A475C")
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(Get_icon(user_vars.icon_theme, object))
task_widget.container.layout_it.margin.layout_icon.icon:set_image(xdg_icon_lookup:find_icon(object.class, 64))
widget:add(task_widget)
widget:set_spacing(dpi(6))
--#region Hover_signal
local old_wibox, old_cursor, old_bg
local old_wibox, old_cursor
task_widget:connect_signal(
"mouse::enter",
function()
old_bg = task_widget.bg
if object == client.focus then
task_widget.bg = '#dddddddd'
task_widget.bg = Theme_config.tasklist.bg_focus_hover .. "dd"
else
task_widget.bg = '#3A475Cdd'
task_widget.bg = Theme_config.tasklist.bg .. 'dd'
end
local w = mouse.current_wibox
if w then
@@ -140,9 +139,9 @@ local list_update = function(widget, buttons, label, data, objects)
"button::press",
function()
if object == client.focus then
task_widget.bg = "#ffffffaa"
task_widget.bg = Theme_config.tasklist.bg_focus_pressed .. "dd"
else
task_widget.bg = '#3A475Caa'
task_widget.bg = Theme_config.tasklist.bg .. "dd"
end
end
)
@@ -151,9 +150,9 @@ local list_update = function(widget, buttons, label, data, objects)
"button::release",
function()
if object == client.focus then
task_widget.bg = "#ffffffdd"
task_widget.bg = Theme_config.tasklist.bg_focus_hover .. "dd"
else
task_widget.bg = '#3A475Cdd'
task_widget.bg = Theme_config.tasklist.bg .. "dd"
end
end
)
@@ -161,7 +160,11 @@ local list_update = function(widget, buttons, label, data, objects)
task_widget:connect_signal(
"mouse::leave",
function()
task_widget.bg = old_bg
if object == client.focus then
task_widget.bg = Theme_config.tasklist.bg_focus
else
task_widget.bg = Theme_config.tasklist.bg
end
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil