Reworked a whole lot. New config file and theme config file for easier changes. Did #19. And much more
This commit is contained in:
@@ -149,13 +149,13 @@ return function(s)
|
||||
right_button.visible = false
|
||||
toggle_button.active = not toggle_button.active
|
||||
toggle_button.border_color = color["Grey800"]
|
||||
user_vars.dnd = false
|
||||
User_config.dnd = false
|
||||
else
|
||||
left_button.visible = false
|
||||
right_button.visible = true
|
||||
toggle_button.active = not toggle_button.active
|
||||
toggle_button.border_color = color["Purple200"]
|
||||
user_vars.dnd = true
|
||||
User_config.dnd = true
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
|
||||
|
||||
local nl = {}
|
||||
|
||||
nl.notification_list = { layout = require("src.lib.overflow_widget.overflow").vertical, scrollbar_width = 0, scroll_speed = 10, spacing = dpi(20) }
|
||||
nl.notification_list = { layout = wibox.layout.overflow.vertical, scrollbar_width = 0, step = dpi(10), spacing = dpi(20) }
|
||||
|
||||
-- @param {table} notification
|
||||
-- @return {widget} notifications_list
|
||||
@@ -66,7 +66,7 @@ function nl.create_notification(n)
|
||||
{
|
||||
{
|
||||
{
|
||||
font = user_vars.font.specify .. ", 10",
|
||||
font = User_config.font.specify .. ", 10",
|
||||
text = "✕",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
@@ -110,6 +110,8 @@ function nl.create_notification(n)
|
||||
{
|
||||
image = gears.color.recolor_image(icondir .. "notification-outline.svg", color["Teal200"]),
|
||||
resize = false,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
right = dpi(5),
|
||||
@@ -151,6 +153,8 @@ function nl.create_notification(n)
|
||||
image = n.icon,
|
||||
resize = true,
|
||||
widget = wibox.widget.imagebox,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
clip_shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
end
|
||||
|
||||
@@ -44,6 +44,8 @@ return function(s)
|
||||
local shuffle_button = wibox.widget {
|
||||
resize = false,
|
||||
image = gears.color.recolor_image(icondir .. "shuffle.svg", color["Grey800"]),
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
widget = wibox.widget.imagebox,
|
||||
}
|
||||
|
||||
@@ -81,6 +83,8 @@ return function(s)
|
||||
resize = false,
|
||||
image = gears.color.recolor_image(icondir .. "repeat.svg", color["Grey800"]),
|
||||
widget = wibox.widget.imagebox,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
id = "imagebox"
|
||||
}
|
||||
|
||||
@@ -108,6 +112,8 @@ return function(s)
|
||||
|
||||
local prev_button = wibox.widget {
|
||||
resize = false,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
image = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Teal200"]),
|
||||
widget = wibox.widget.imagebox
|
||||
}
|
||||
@@ -126,6 +132,8 @@ return function(s)
|
||||
|
||||
local pause_play_button = wibox.widget {
|
||||
resize = false,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
image = gears.color.recolor_image(icondir .. "play-pause.svg", color["Teal200"]),
|
||||
widget = wibox.widget.imagebox
|
||||
}
|
||||
@@ -139,6 +147,8 @@ return function(s)
|
||||
|
||||
local next_button = wibox.widget {
|
||||
resize = false,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
image = gears.color.recolor_image(icondir .. "skip-next.svg", color["Teal200"]),
|
||||
widget = wibox.widget.imagebox
|
||||
}
|
||||
@@ -192,11 +202,13 @@ return function(s)
|
||||
{
|
||||
{ -- Album art
|
||||
{
|
||||
image = icondir .. "spotify.svg",
|
||||
image = "default image",
|
||||
resize = true,
|
||||
clip_shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(8))
|
||||
end,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
widget = wibox.widget.imagebox,
|
||||
id = "imagebox"
|
||||
},
|
||||
@@ -211,7 +223,6 @@ return function(s)
|
||||
{
|
||||
{
|
||||
{ --Title
|
||||
markup = "Title",
|
||||
halign = "center",
|
||||
align = "center",
|
||||
widget = wibox.widget.textbox,
|
||||
@@ -234,7 +245,6 @@ return function(s)
|
||||
{
|
||||
{
|
||||
{ --Artist
|
||||
markup = "Artist",
|
||||
halign = "center",
|
||||
align = "center",
|
||||
widget = wibox.widget.textbox,
|
||||
@@ -304,7 +314,7 @@ return function(s)
|
||||
color = color["Purple200"],
|
||||
background_color = color["Grey800"],
|
||||
max_value = 100,
|
||||
value = 0,
|
||||
value = 50,
|
||||
forced_height = dpi(5),
|
||||
shape = function(cr, width)
|
||||
gears.shape.rounded_bar(cr, width, dpi(5))
|
||||
@@ -380,7 +390,7 @@ return function(s)
|
||||
function(stdout2)
|
||||
local tit = stdout2:gsub("\n", "")
|
||||
title = tit
|
||||
music_widget:get_children_by_id("textbox4")[1].text = tit or "Title"
|
||||
music_widget:get_children_by_id("textbox4")[1].text = tit
|
||||
end
|
||||
)
|
||||
|
||||
@@ -390,7 +400,7 @@ return function(s)
|
||||
function(stdout2)
|
||||
local art = stdout2:gsub("\n", "")
|
||||
artist = art
|
||||
music_widget:get_children_by_id("textbox3")[1].text = art or "Artist"
|
||||
music_widget:get_children_by_id("textbox3")[1].text = art
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ return function()
|
||||
|
||||
---Creates a layout with bar widgets based on the given table
|
||||
---@param widget_table string{}
|
||||
---@return table @{layout}
|
||||
---@return table
|
||||
local function create_bar_layout(widget_table)
|
||||
local bar_layout = { layout = wibox.layout.flex.horizontal, spacing = dpi(10) }
|
||||
|
||||
@@ -105,7 +105,7 @@ return function()
|
||||
color = color["Blue200"],
|
||||
background_color = color["Grey800"],
|
||||
max_value = 100,
|
||||
value = 50,
|
||||
value = 0,
|
||||
forced_height = dpi(8),
|
||||
shape = function(cr, width, heigth)
|
||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||
@@ -177,7 +177,7 @@ return function()
|
||||
color = color["Red200"],
|
||||
background_color = color["Grey800"],
|
||||
max_value = 100,
|
||||
value = 50,
|
||||
value = 0,
|
||||
forced_height = dpi(8),
|
||||
shape = function(cr, width, heigth)
|
||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||
@@ -246,7 +246,7 @@ return function()
|
||||
color = color["Green200"],
|
||||
background_color = color["Grey800"],
|
||||
max_value = 100,
|
||||
value = 50,
|
||||
value = 0,
|
||||
forced_height = dpi(8),
|
||||
shape = function(cr, width, heigth)
|
||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||
@@ -315,7 +315,7 @@ return function()
|
||||
color = color["Green200"],
|
||||
background_color = color["Grey800"],
|
||||
max_value = 100,
|
||||
value = 50,
|
||||
value = 0,
|
||||
forced_height = dpi(8),
|
||||
shape = function(cr, width, heigth)
|
||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||
@@ -387,7 +387,7 @@ return function()
|
||||
color = color["Yellow200"],
|
||||
background_color = color["Grey800"],
|
||||
max_value = 100,
|
||||
value = 50,
|
||||
value = 0,
|
||||
forced_height = dpi(8),
|
||||
shape = function(cr, width, heigth)
|
||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||
@@ -459,7 +459,7 @@ return function()
|
||||
color = color["Purple200"],
|
||||
background_color = color["Grey800"],
|
||||
max_value = 100,
|
||||
value = 50,
|
||||
value = 0,
|
||||
forced_height = dpi(8),
|
||||
shape = function(cr, width, heigth)
|
||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||
@@ -531,7 +531,7 @@ return function()
|
||||
color = color["Pink200"],
|
||||
background_color = color["Grey800"],
|
||||
max_value = 100,
|
||||
value = 50,
|
||||
value = 0,
|
||||
forced_height = dpi(8),
|
||||
shape = function(cr, width, heigth)
|
||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||
@@ -603,7 +603,7 @@ return function()
|
||||
color = color["Purple200"],
|
||||
background_color = color["Grey800"],
|
||||
max_value = 100,
|
||||
value = 50,
|
||||
value = 0,
|
||||
forced_height = dpi(8),
|
||||
shape = function(cr, width, heigth)
|
||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||
@@ -679,7 +679,7 @@ return function()
|
||||
{
|
||||
{
|
||||
{
|
||||
create_bar_layout({ "cpu_usage", "cpu_temp", "ram_usage", "battery", "microphone", "backlight", "volume", "gpu_temp", "gpu_usage" }),
|
||||
create_bar_layout(User_config.status_bar_widgets),
|
||||
width = dpi(480),
|
||||
strategy = "exact",
|
||||
widget = wibox.container.constraint
|
||||
|
||||
@@ -28,7 +28,7 @@ return function()
|
||||
id = "label",
|
||||
align = "left",
|
||||
valign = "bottom",
|
||||
format = "<span foreground='#69F0AE' font='JetBrainsMono Nerd Font, Regular 18'><b>%e</b></span><span foreground='#18FFFF' font='JetBrainsMono Nerd Font, Regular 18'><b> %b %Y</b></span>",
|
||||
format = "<span foreground='#69F0AE' font='JetBrainsMono Nerd Font, Regular 18'><b>%d</b></span><span foreground='#18FFFF' font='JetBrainsMono Nerd Font, Regular 18'><b> %b %Y</b></span>",
|
||||
widget = wibox.widget.textclock
|
||||
},
|
||||
widget = wibox.container.margin
|
||||
|
||||
@@ -18,9 +18,9 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/weather/"
|
||||
return function()
|
||||
|
||||
local api_secrets = {
|
||||
key = user_vars.weather_secrets.key,
|
||||
city_id = user_vars.weather_secrets.city_id,
|
||||
unit = user_vars.weather_secrets.unit
|
||||
key = User_config.weather_secrets.key,
|
||||
city_id = User_config.weather_secrets.city_id,
|
||||
unit = User_config.weather_secrets.unit
|
||||
}
|
||||
|
||||
local weather_widget = wibox.widget {
|
||||
@@ -83,6 +83,8 @@ return function()
|
||||
resize = true,
|
||||
forced_width = dpi(24),
|
||||
forced_height = dpi(24),
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
{
|
||||
@@ -107,6 +109,8 @@ return function()
|
||||
forced_width = dpi(24),
|
||||
forced_height = dpi(24),
|
||||
widget = wibox.widget.imagebox,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
image = gears.color.recolor_image(icondir .. "humidity.svg", color["OrangeA200"]),
|
||||
id = "humidity_icon"
|
||||
},
|
||||
@@ -156,7 +160,8 @@ return function()
|
||||
|
||||
local function fetch_weather_data()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"curl -sf 'http://api.openweathermap.org/data/2.5/weather?id=" .. api_secrets.city_id .. "&units=" .. api_secrets.unit .. "&appid=" .. api_secrets.key .. "'",
|
||||
"curl -sf 'http://api.openweathermap.org/data/2.5/weather?id=" ..
|
||||
api_secrets.city_id .. "&units=" .. api_secrets.unit .. "&appid=" .. api_secrets.key .. "'",
|
||||
function(stdout)
|
||||
if not stdout:match('error') then
|
||||
local weather_metadata = json_lua:decode(stdout)
|
||||
@@ -193,7 +198,8 @@ return function()
|
||||
weather_widget:get_children_by_id("icon")[1].image = icondir .. icon_table[weather_icon] .. ".svg"
|
||||
weather_widget:get_children_by_id("temp")[1].text = math.floor(temp + 0.5) .. "°C"
|
||||
weather_widget:get_children_by_id("city_country")[1].text = city .. ", " .. country
|
||||
weather_widget:get_children_by_id("description")[1].text = description:sub(1, 1):upper() .. description:sub(2)
|
||||
weather_widget:get_children_by_id("description")[1].text = description:sub(1, 1):upper() ..
|
||||
description:sub(2)
|
||||
weather_widget:get_children_by_id("line")[1].bg = color["Grey800"]
|
||||
weather_widget:get_children_by_id("speed")[1].text = speed .. " m/s"
|
||||
weather_widget:get_children_by_id("humidity")[1].text = humidity .. "%"
|
||||
|
||||
Reference in New Issue
Block a user