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

@@ -0,0 +1,25 @@
--------------------------------------
-- This is the application launcher --
--------------------------------------
-- 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")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/application_launcher/"
return function(s)
local applicaton_launcher = wibox.widget {
}
local application_container = awful.popup {
}
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")
local rubato = require("src.lib.rubato")
@@ -24,7 +22,8 @@ return function(s)
{
{
{
image = gears.color.recolor_image(icondir .. icon .. ".svg", color["Purple200"]),
image = gears.color.recolor_image(
icondir .. icon .. ".svg", Theme_config.bluetooth_controller.icon_color),
id = "icon",
resize = false,
valign = "center",
@@ -50,7 +49,7 @@ return function(s)
text = "Connecting...",
id = "connecting",
visible = false,
font = user_vars.font.specify .. ", regular 10",
font = User_config.font.specify .. ", regular 10",
widget = wibox.widget.textbox
},
id = "alias_container",
@@ -95,7 +94,7 @@ return function(s)
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
bg = color["Blue200"],
bg = Theme_config.bluetooth_controller.con_button_color,
widget = wibox.container.background
},
id = "margin0",
@@ -109,23 +108,24 @@ return function(s)
margins = dpi(5),
widget = wibox.container.margin
},
bg = color["Grey900"],
fg = color["LightBlue200"],
border_color = color["Grey800"],
border_width = dpi(2),
bg = Theme_config.bluetooth_controller.device_bg,
fg = Theme_config.bluetooth_controller.device_fg,
border_color = Theme_config.bluetooth_controller.device_border_color,
border_width = Theme_config.bluetooth_controller.device_border_width,
id = "background",
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
}
--! using :Connect freezes awesome, either find a solution or switch to console commands
if device.Connected then
device_widget:get_children_by_id("con")[1].image = gears.color.recolor_image(icondir .. "link-off.svg", color["Grey900"])
device_widget:get_children_by_id("con")[1].image = gears.color.recolor_image(icondir .. "link-off.svg",
Theme_config.bluetooth_controller.icon_color_dark)
device_widget:connect_signal(
"button::press",
function(c, d, e, key)
function(_, _, _, key)
if key == 1 then
device:Disconnect()
awesome.emit_signal("bluetooth::connect", device)
@@ -133,10 +133,11 @@ return function(s)
end
)
else
device_widget:get_children_by_id("con")[1].image = gears.color.recolor_image(icondir .. "link.svg", color["Grey900"])
device_widget:get_children_by_id("con")[1].image = gears.color.recolor_image(icondir .. "link.svg",
Theme_config.bluetooth_controller.icon_color_dark)
device_widget:connect_signal(
"button::press",
function(c, d, e, key)
function(_, _, _, key)
if key == 1 then
device:Connect()
awesome.emit_signal("bluetooth::disconnect", device)
@@ -144,7 +145,8 @@ return function(s)
end
)
end
Hover_signal(device_widget, '#313131', color["LightBlue100"])
Hover_signal(device_widget, Theme_config.bluetooth_controller.device_bg_hover,
Theme_config.bluetooth_controller.device_fg_hover)
return device_widget
end
@@ -168,10 +170,10 @@ return function(s)
widget = wibox.container.constraint
},
id = "connected_device_background",
border_color = color["Grey800"],
border_width = dpi(2),
border_color = Theme_config.bluetooth_controller.con_device_border_color,
border_width = Theme_config.bluetooth_controller.con_device_border_width,
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background
}
@@ -196,10 +198,10 @@ return function(s)
widget = wibox.container.constraint
},
id = "discovered_device_background",
border_color = color["Grey800"],
border_width = dpi(2),
border_color = Theme_config.bluetooth_controller.con_device_border_color,
border_width = Theme_config.bluetooth_controller.con_device_border_width,
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background
}
@@ -214,8 +216,11 @@ return function(s)
{
{
resize = false,
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]),
image = gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.bluetooth_controller.connected_icon_color),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
id = "icon"
},
id = "center",
@@ -225,7 +230,7 @@ return function(s)
},
{
{
text = "Coupled Devices",
text = "Paired Devices",
widget = wibox.widget.textbox,
id = "device_name"
},
@@ -236,10 +241,10 @@ return function(s)
layout = wibox.layout.fixed.horizontal
},
id = "connected_bg",
bg = color["Grey800"],
fg = color["Purple200"],
bg = Theme_config.bluetooth_controller.connected_bg,
fg = Theme_config.bluetooth_controller.connected_fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
},
@@ -257,8 +262,11 @@ return function(s)
{
{
resize = false,
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["LightBlueA200"]),
image = gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.bluetooth_controller.discovered_icon_color),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
id = "icon",
},
id = "center",
@@ -279,10 +287,10 @@ return function(s)
layout = wibox.layout.fixed.horizontal
},
id = "discovered_bg",
bg = color["Grey800"],
fg = color["Blue200"],
bg = Theme_config.bluetooth_controller.discovered_bg,
fg = Theme_config.bluetooth_controller.discovered_fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
},
@@ -305,9 +313,9 @@ return function(s)
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(8))
end,
border_color = color["Grey800"],
border_width = dpi(4),
bg = color["Grey900"],
border_color = Theme_config.bluetooth_controller.container_border_color,
border_width = Theme_config.bluetooth_controller.container_border_width,
bg = Theme_config.bluetooth_controller.container_bg,
id = "background",
widget = wibox.container.background
},
@@ -320,13 +328,15 @@ return function(s)
local bluetooth_controller_container = awful.popup {
widget = wibox.container.background,
ontop = true,
bg = color["Grey900"],
bg = Theme_config.bluetooth_controller.container_bg,
stretch = false,
visible = false,
screen = s,
placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(380), top = dpi(60) } }) end,
placement = function(c) awful.placement.align(c,
{ position = "top_right", margins = { right = dpi(380), top = dpi(60) } })
end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end
}
@@ -404,15 +414,17 @@ return function(s)
rubato_timer.target = dpi(210)
end
connected_margin.connected_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
connected.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Purple200"]))
connected.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg",
Theme_config.bluetooth_controller.connected_icon_color))
else
rubato_timer.target = 0
connected_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
end
connected.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]))
connected.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.bluetooth_controller.connected_icon_color))
end
end
)
@@ -446,15 +458,17 @@ return function(s)
rubato_timer.target = dpi(20)
end
discovered_margin.discovered_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
discovered.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["LightBlue200"]))
discovered.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg",
Theme_config.bluetooth_controller.discovered_icon_color))
else
rubato_timer.target = dpi(0)
rubato_timer.target = 0
discovered_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
end
discovered.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["LightBlue200"]))
discovered.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.bluetooth_controller.discovered_icon_color))
end
end
)

View File

@@ -28,159 +28,91 @@ return function(s)
local brightness_osd_widget = wibox.widget {
{
{
{
{
nil,
{
nil,
{
id = "icon",
forced_height = dpi(220),
image = icondir .. "brightness-high.svg",
widget = wibox.widget.imagebox
},
nil,
expand = "none",
id = "icon_margin2",
layout = wibox.layout.align.vertical
},
nil,
id = "icon_margin1",
expand = "none",
layout = wibox.layout.align.horizontal
},
{ -- Brightness Icon
image = gears.color.recolor_image(icondir .. "brightness-high.svg", Theme_config.brightness_osd.icon_color),
valign = "center",
halign = "center",
resize = false,
id = "icon",
widget = wibox.widget.imagebox
},
{ -- Brightness Bar
{
{
id = "label",
text = "Brightness",
align = "left",
valign = "center",
widget = wibox.widget.textbox
id = "progressbar1",
color = Theme_config.brightness_osd.bar_bg_active,
background_color = Theme_config.brightness_osd.bar_bg,
max_value = 100,
value = 50,
forced_height = dpi(6),
shape = function(cr, width, height)
gears.shape.rounded_bar(cr, width, height, dpi(6))
end,
widget = wibox.widget.progressbar
},
nil,
{
id = "value",
text = "0%",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "label_value_layout",
forced_height = dpi(48),
layout = wibox.layout.align.horizontal,
},
{
{
id = "brightness_slider",
bar_shape = gears.shape.rounded_rect,
bar_height = dpi(10),
bar_color = color["Grey800"] .. "88",
bar_active_color = "#ffffff",
handle_color = "#ffffff",
handle_shape = gears.shape.circle,
handle_width = dpi(10),
handle_border_color = color["White"],
maximum = 100,
widget = wibox.widget.slider
},
id = "slider_layout",
forced_height = dpi(24),
id = "progressbar_container2",
halign = "center",
valign = "center",
widget = wibox.container.place
},
id = "icon_slider_layout",
spacing = dpi(0),
layout = wibox.layout.align.vertical
id = "progressbar_container",
width = dpi(240),
heigth = dpi(20),
stragety = "max",
widget = wibox.container.constraint
},
id = "osd_layout",
layout = wibox.layout.align.vertical
id = "layout1",
spacing = dpi(10),
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(24),
right = dpi(24),
id = "margin",
margins = dpi(10),
widget = wibox.container.margin
},
bg = color["Grey900"] .. "88",
widget = wibox.container.background,
ontop = true,
visible = true,
type = "notification",
forced_height = dpi(300),
forced_width = dpi(300),
offset = dpi(5),
forced_height = dpi(80),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
border_color = Theme_config.brightness_osd.border_color,
border_width = Theme_config.brightness_osd.border_width,
fg = Theme_config.brightness_osd.fg,
bg = Theme_config.brightness_osd.bg,
widget = wibox.container.background
}
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:connect_signal(
"property::value",
function()
awful.spawn.easy_async_with_shell(
"pkexec xfpm-power-backlight-helper --get-brightness",
function(stdout)
local brightness_value = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
brightness_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text(tostring(brightness_value) .. "%")
awesome.emit_signal(
"widget::brightness:update",
brightness_value
)
if awful.screen.focused().show_brightness_osd then
awesome.emit_signal(
"module::brightness_osd:show",
true
)
end
local icon = icondir .. "brightness"
if brightness_value >= 0 and brightness_value < 34 then
icon = icon .. "-low"
elseif brightness_value >= 34 and brightness_value < 67 then
icon = icon .. "-medium"
elseif brightness_value >= 67 then
icon = icon .. "-high"
end
brightness_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icon .. ".svg")
awesome.emit_signal("update::backlight_widget", brightness_value, icon .. ".svg")
end
)
end
)
local update_slider = function()
awful.spawn.easy_async_with_shell(
[[ pkexec xfpm-power-backlight-helper --get-brightness ]],
function(stdout)
stdout = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(stdout)
local brightness_value = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
brightness_osd_widget:get_children_by_id("progressbar")[1].value = stdout
local icon = icondir .. "brightness"
if brightness_value >= 0 and brightness_value < 34 then
icon = icon .. "-low"
elseif brightness_value >= 34 and brightness_value < 67 then
icon = icon .. "-medium"
elseif brightness_value >= 67 then
icon = icon .. "-high"
end
brightness_osd_widget:get_children_by_id("icon"):set_image(gears.color.recolor_image(icon .. ".svg",
Theme_config.brightness_osd.icon_color))
end
)
end
awesome.connect_signal(
"module::brightness_slider:update",
function()
update_slider()
end
)
awesome.connect_signal(
"widget::brightness:update",
function(value)
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(tonumber(value))
end
)
update_slider()
local brightness_container = awful.popup {
widget = wibox.container.background,
widget = {},
ontop = true,
bg = color["Grey900"] .. "00",
stretch = false,
visible = false,
screen = s,
placement = function(c) awful.placement.centered(c, { margins = { top = dpi(200) } }) end,
placement = function(c) awful.placement.bottom_left(c, { margins = dpi(20) }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 15)
gears.shape.rounded_rect(cr, width, height, dpi(14))
end
}
@@ -200,36 +132,14 @@ return function(s)
awesome.connect_signal(
"widget::brightness_osd:rerun",
function()
brightness_container.visible = true
if hide_brightness_osd.started then
hide_brightness_osd:again()
update_slider()
else
hide_brightness_osd:start()
update_slider()
end
end
)
awesome.connect_signal(
"module::brightness_osd:show",
function()
if s == mouse.screen then
brightness_container.visible = true
end
end
)
brightness_container:connect_signal(
"mouse::enter",
function()
brightness_container.visible = true
hide_brightness_osd:stop()
end
)
brightness_container:connect_signal(
"mouse::leave",
function()
brightness_container.visible = true
hide_brightness_osd:again()
end
)
end

View File

@@ -19,7 +19,7 @@ return function(s, widgets)
maximum_width = dpi(500),
placement = function(c) awful.placement.top(c, { margins = dpi(10) }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end
}
@@ -27,42 +27,42 @@ return function(s, widgets)
top = 55
}
local function prepare_widgets(widgets)
local function prepare_widgets(w)
local layout = {
forced_height = 45,
forced_height = dpi(50),
layout = wibox.layout.fixed.horizontal
}
for i, widget in pairs(widgets) do
for i, widget in pairs(w) do
if i == 1 then
table.insert(layout,
{
widget,
left = dpi(6),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
elseif i == #widgets then
widget,
left = dpi(6),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
elseif i == #w then
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
else
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
end
end
return layout
@@ -78,45 +78,45 @@ return function(s, widgets)
client.connect_signal(
"manage",
function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end
end
)
client.connect_signal(
"unmanage",
function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end
end
)
client.connect_signal(
"tag::switched",
"property::selected",
function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end
end
)
awesome.connect_signal(
"refresh",
function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end
end
)
end

View File

@@ -8,31 +8,38 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local desktop_parser = require("src.tools.desktop_parser")
return function(screen, programs)
local function create_dock_element(class, program, name, user_icon, is_steam, size)
if program == nil or class == nil then
local function create_dock_element(program, size)
if not program then
return
end
is_steam = is_steam or false
user_icon = user_icon or nil
local dock_element = wibox.widget {
{
{
{
resize = true,
forced_width = size,
forced_height = size,
image = user_icon or Get_icon(user_vars.icon_theme, nil, program, class, is_steam),
widget = wibox.widget.imagebox,
id = "icon",
{
resize = true,
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
id = "icon",
},
id = "icon_container",
strategy = "exact",
width = size,
height = size,
widget = wibox.container.constraint
},
margins = dpi(5),
widget = wibox.container.margin,
id = "margin"
},
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
gears.shape.rounded_rect(cr, width, height, dpi(10))
end,
bg = color["Grey900"],
widget = wibox.container.background,
@@ -44,8 +51,10 @@ return function(screen, programs)
widget = wibox.container.margin
}
dock_element.background.margin.icon_container.icon.image = xdg_icon_lookup:find_icon(program["Icon"], 64)
for _, c in ipairs(client.get()) do
if string.lower(c.class):match(program) and c == client.focus then
if string.lower(c.class):match(program["Icon"]) and c == client.focus then
dock_element.background.bg = color["Grey800"]
end
end
@@ -54,18 +63,16 @@ return function(screen, programs)
dock_element:connect_signal(
"button::press",
function()
if is_steam then
awful.spawn("steam steam://rungameid/" .. program)
else
awful.spawn(program)
function(_, _, _, button)
if button == 1 then
awful.spawn(program["Exec"])
end
end
)
awful.tooltip {
objects = { dock_element },
text = name,
text = program["Name"],
mode = "outside",
preferred_alignments = "middle",
margins = dpi(10)
@@ -81,10 +88,10 @@ return function(screen, programs)
visible = true,
screen = screen,
type = "dock",
height = user_vars.dock_icon_size + 10,
height = User_config.dock_icon_size + 10,
placement = function(c) awful.placement.bottom(c, { margins = dpi(10) }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 15)
gears.shape.rounded_rect(cr, width, height, dpi(16))
end
}
@@ -97,14 +104,14 @@ return function(screen, programs)
type = "dock",
id = "fakedock",
height = dpi(10),
placement = function(c) awful.placement.bottom(c, { margins = dpi(0) }) end,
placement = function(c) awful.placement.bottom(c) end,
}
local function get_dock_elements(pr)
local dock_elements = { layout = wibox.layout.fixed.horizontal }
for i, p in ipairs(pr) do
dock_elements[i] = create_dock_element(p[1], p[2], p[3], p[4], p[5], user_vars.dock_icon_size)
dock_elements[i] = create_dock_element(desktop_parser(p), User_config.dock_icon_size)
end
return dock_elements
@@ -118,7 +125,7 @@ return function(screen, programs)
for i = 0, amount, 1 do
fake_elements[i] = wibox.widget {
bg = '00000000',
forced_width = user_vars.dock_icon_size + dpi(20),
forced_width = User_config.dock_icon_size + dpi(20),
forced_height = dpi(10),
id = "fake",
widget = wibox.container.background
@@ -134,27 +141,31 @@ return function(screen, programs)
local indicators = { layout = wibox.layout.flex.horizontal, spacing = dpi(5) }
local col = color["Grey600"]
for i, c in ipairs(clients) do
if string.lower(c.class or c.name):match(string.lower(pr[1]) or string.lower(pr[2])) then
if c == client.focus then
col = color["YellowA200"]
elseif c.urgent then
col = color["RedA200"]
elseif c.maximized then
col = color["GreenA200"]
elseif c.minimized then
col = color["BlueA200"]
elseif c.fullscreen then
col = color["PinkA200"]
else
col = color["Grey600"]
local icon = desktop_parser(pr)
if icon then
local icon_name = icon["Icon"] or ""
if icon_name:match(string.lower(c.class or c.name or nil)) then
if c == client.focus then
col = color["YellowA200"]
elseif c.urgent then
col = color["RedA200"]
elseif c.maximized then
col = color["GreenA200"]
elseif c.minimized then
col = color["BlueA200"]
elseif c.fullscreen then
col = color["PinkA200"]
else
col = color["Grey600"]
end
indicators[i] = wibox.widget {
widget = wibox.container.background,
shape = gears.shape.rounded_rect,
forced_height = dpi(3),
bg = col,
forced_width = dpi(5),
}
end
indicators[i] = wibox.widget {
widget = wibox.container.background,
shape = gears.shape.rounded_rect,
forced_height = dpi(3),
bg = col,
forced_width = dpi(5),
}
end
end
container[index] = wibox.widget {
@@ -206,7 +217,7 @@ return function(screen, programs)
if not c.minimized then
local y = c:geometry().y
local h = c.height
if (y + h) >= s.geometry.height - user_vars.dock_icon_size - 35 then
if (y + h) >= s.geometry.height - User_config.dock_icon_size - 35 then
dock.visible = false
return
else
@@ -304,10 +315,4 @@ return function(screen, programs)
dock_intelligent_hide:again()
end
)
dock:setup {
get_dock_elements(programs),
create_incicator_widget(programs),
layout = wibox.layout.fixed.vertical
}
end

View File

@@ -3,50 +3,71 @@
--------------------------------------------------------------------------------------------------------------
return function(s)
xdg_icon_lookup = require("src.tools.xdg_icon_lookup")()
-- Every Widget
--[[
If you are going to use a widget on a single screen only, put it inside the s.index == X where X is the screen number.
This will lead to better performance and prevent widgets to be loaded but not used
--]]
s.audio = require("src.widgets.audio")(s)
s.date = require("src.widgets.date")()
s.clock = require("src.widgets.clock")()
s.layoutlist = require("src.widgets.layout_list")()
s.powerbutton = require("src.widgets.power")()
s.kblayout = require("src.widgets.kblayout")(s)
s.taglist = require("src.widgets.taglist")(s)
s.tasklist = require("src.widgets.tasklist")(s)
-- s.battery = require("src.widgets.battery")()
-- s.bluetooth = require("src.widgets.bluetooth")()
-- s.cpu_freq = require("src.widgets.cpu_info")("freq", "average")
-- s.systray = require("src.widgets.systray")(s)
-- s.cpu_usage = require("src.widgets.cpu_info")("usage")
-- s.cpu_temp = require("src.widgets.cpu_info")("temp")
-- s.gpu_usage = require("src.widgets.gpu_info")("usage")
-- s.gpu_temp = require("src.widgets.gpu_info")("temp")
-- s.network = require("src.widgets.network")()
-- s.ram_info = require("src.widgets.ram_info")()
if s.index == 1 then
s.systray = require("src.widgets.systray")(s)
s.cpu_usage = require("src.widgets.cpu_info")("usage")
s.cpu_temp = require("src.widgets.cpu_info")("temp")
s.gpu_usage = require("src.widgets.gpu_info")("usage")
s.gpu_temp = require("src.widgets.gpu_info")("temp")
require("src.modules.crylia_bar.left_bar")(s, { s.layoutlist, s.systray, s.taglist })
require("src.modules.crylia_bar.center_bar")(s, { s.tasklist })
require("src.modules.crylia_bar.right_bar")(s, { s.gpu_usage, s.gpu_temp, s.cpu_usage, s.cpu_temp, s.audio, s.kblayout, s.date, s.clock, s.powerbutton })
require("src.modules.crylia_bar.dock")(s, user_vars.dock_programs)
---Lookup function to return the widget from its easy name string
---@param widgets table
---@return widget
local function get_widgets(widgets)
local widget_table = {}
if widgets then
for _, widget in ipairs(widgets) do
if widget == "Audio" then
table.insert(widget_table, require("src.widgets.audio")(s))
elseif widget == "Battery" then
table.insert(widget_table, require("src.widgets.battery")(User_config.battery_path))
elseif widget == "Bluetooth" then
table.insert(widget_table, require("src.widgets.bluetooth")())
elseif widget == "Clock" then
table.insert(widget_table, require("src.widgets.clock")())
elseif widget == "Cpu Frequency" then
table.insert(widget_table, require("src.widgets.cpu_info")("freq", User_config.cpu_frequency))
elseif widget == "Cpu Temperature" then
table.insert(widget_table, require("src.widgets.cpu_info")("temp"))
elseif widget == "Cpu Usage" then
table.insert(widget_table, require("src.widgets.cpu_info")("usage"))
elseif widget == "Date" then
table.insert(widget_table, require("src.widgets.date")())
elseif widget == "Gpu Temperature" then
table.insert(widget_table, require("src.widgets.gpu_info")("temp"))
elseif widget == "Gpu Usage" then
table.insert(widget_table, require("src.widgets.gpu_info")("usage"))
elseif widget == "Keyboard Layout" then
table.insert(widget_table, require("src.widgets.kblayout")(s))
elseif widget == "Tiling Layout" then
table.insert(widget_table, require("src.widgets.layout_list")())
elseif widget == "Network" then
table.insert(widget_table, require("src.widgets.network")())
elseif widget == "Power Button" then
table.insert(widget_table, require("src.widgets.power")())
elseif widget == "Ram Usage" then
table.insert(widget_table, require("src.widgets.ram_info")())
elseif widget == "Systray" then
table.insert(widget_table, require("src.widgets.systray")(s))
elseif widget == "Taglist" then
table.insert(widget_table, require("src.widgets.taglist")(s))
elseif widget == "Tasklist" then
table.insert(widget_table, require("src.widgets.tasklist")(s))
end
end
end
return widget_table
end
if s.index == 2 then
s.network = require("src.widgets.network")()
s.ram_info = require("src.widgets.ram_info")()
require("src.modules.crylia_bar.left_bar")(s, { s.layoutlist, s.taglist })
require("src.modules.crylia_bar.center_bar")(s, { s.tasklist })
require("src.modules.crylia_bar.right_bar")(s, { s.ram_info, s.audio, s.kblayout, s.network, s.date, s.clock, s.powerbutton })
if User_config.widgets then
for index, screen in ipairs(User_config.widgets) do
if index == s.index then
if screen.left_bar then
require("src.modules.crylia_bar.left_bar")(s, get_widgets(screen.left_bar))
end
if screen.center_bar then
require("src.modules.crylia_bar.center_bar")(s, get_widgets(screen.center_bar))
end
if screen.right_bar then
require("src.modules.crylia_bar.right_bar")(s, get_widgets(screen.right_bar))
end
end
end
end
require("src.modules.crylia_bar.dock")(s, User_config.dock_programs)
end

View File

@@ -8,18 +8,20 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
return function(s, widgets)
return function(s, w)
local top_left = awful.popup {
screen = s,
widget = wibox.container.background,
widget = {
},
ontop = false,
bg = color["Grey900"],
visible = true,
maximum_width = dpi(650),
placement = function(c) awful.placement.top_left(c, { margins = dpi(10) }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end
}
@@ -29,47 +31,47 @@ return function(s, widgets)
local function prepare_widgets(widgets)
local layout = {
forced_height = 45,
forced_height = dpi(50),
layout = wibox.layout.fixed.horizontal
}
for i, widget in pairs(widgets) do
if i == 1 then
table.insert(layout,
{
widget,
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
widget,
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
elseif i == #widgets then
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
else
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
end
end
return layout
end
top_left:setup {
prepare_widgets(widgets),
prepare_widgets(w),
nil,
nil,
layout = wibox.layout.fixed.horizontal

View File

@@ -8,7 +8,7 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
return function(s, widgets)
return function(s, w)
local top_right = awful.popup {
widget = wibox.container.background,
@@ -18,7 +18,7 @@ return function(s, widgets)
screen = s,
placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end
}
@@ -28,40 +28,40 @@ return function(s, widgets)
local function prepare_widgets(widgets)
local layout = {
forced_height = 45,
forced_height = dpi(50),
layout = wibox.layout.fixed.horizontal
}
for i, widget in pairs(widgets) do
if i == 1 then
table.insert(layout,
{
widget,
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
widget,
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
elseif i == #widgets then
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
else
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
end
end
return layout
@@ -70,7 +70,7 @@ return function(s, widgets)
top_right:setup {
nil,
nil,
prepare_widgets(widgets),
prepare_widgets(w),
layout = wibox.layout.align.horizontal
}
end

View File

@@ -10,11 +10,11 @@ awful.screen.connect_for_each_screen(
-- e.g. 1 would be the primary screen and 2 the secondary screen.
function(s)
-- Create 9 tags
awful.layout.layouts = user_vars.layouts
awful.layout.layouts = User_config.layouts
awful.tag(
{ "1", "2", "3", "4", "5", "6", "7", "8", "9" },
s,
user_vars.layouts[1]
User_config.layouts[1]
)
require("src.modules.powermenu")(s)
@@ -24,5 +24,6 @@ awful.screen.connect_for_each_screen(
require("src.modules.volume_controller")(s)
require("src.modules.crylia_bar.init")(s)
require("src.modules.notification-center.init")(s)
require("src.modules.window_switcher.init")(s)
end
)

View File

@@ -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
)

View File

@@ -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

View File

@@ -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
)

View File

@@ -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

View File

@@ -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

View File

@@ -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 .. "%"

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/powermenu/"
@@ -21,8 +19,10 @@ return function(s)
resize = true,
forced_height = dpi(200),
clip_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 30)
gears.shape.rounded_rect(cr, width, height, dpi(30))
end,
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
}
@@ -55,7 +55,7 @@ return function(s)
-- Get the full username(if set) and the username + hostname
local update_user_name = function()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/pfp.sh 'userName' '" .. user_vars.namestyle .. "'",
"./.config/awesome/src/scripts/pfp.sh 'userName' '" .. User_config.namestyle .. "'",
function(stdout)
if stdout:gsub("\n", "") == "Rick Astley" then
profile_picture:set_image(awful.util.getdir("config") .. "src/assets/userpfp/" .. "rickastley.jpg")
@@ -73,42 +73,35 @@ return function(s)
{
{
{
{
-- TODO: using gears.color to recolor a SVG will make it look super low res
-- currently I recolor it in the .svg file directly, but later implement
-- a better way to recolor a SVG
-- image = gears.color.recolor_image(icon, color["Grey900"]),
image = icon,
resize = true,
forced_height = dpi(30),
widget = wibox.widget.imagebox
},
margins = dpi(0),
widget = wibox.container.margin
-- TODO: using gears.color to recolor a SVG will make it look super low res
-- currently I recolor it in the .svg file directly, but later implement
-- a better way to recolor a SVG
-- image = gears.color.recolor_image(icon, color["Grey900"]),
image = icon,
resize = true,
forced_height = dpi(30),
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
{
{
text = name,
font = "JetBrains Mono Bold 30",
widget = wibox.widget.textbox
},
margins = dpi(0),
widget = wibox.container.margin
text = name,
font = "JetBrains Mono Bold 30",
widget = wibox.widget.textbox
},
widget = wibox.layout.fixed.horizontal
},
margins = dpi(10),
widget = wibox.container.margin
},
fg = color["Grey900"],
fg = Theme_config.powermenu.button_fg,
bg = bg_color,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
gears.shape.rounded_rect(cr, width, height, dpi(10))
end,
widget = wibox.container.background,
id = 'background'
},
spacing = dpi(0),
layout = wibox.layout.align.vertical
}
@@ -148,79 +141,49 @@ return function(s)
end
-- Create the buttons with their command and name etc
local shutdown_button = button("Shutdown", icondir .. "shutdown.svg", color["Blue200"], shutdown_command)
local reboot_button = button("Reboot", icondir .. "reboot.svg", color["Red200"], reboot_command)
local suspend_button = button("Suspend", icondir .. "suspend.svg", color["Yellow200"], suspend_command)
local logout_button = button("Logout", icondir .. "logout.svg", color["Green200"], logout_command)
local lock_button = button("Lock", icondir .. "lock.svg", color["Orange200"], lock_command)
local shutdown_button = button("Shutdown", icondir .. "shutdown.svg", Theme_config.powermenu.shutdown_button_bg,
shutdown_command)
local reboot_button = button("Reboot", icondir .. "reboot.svg", Theme_config.powermenu.reboot_button_bg, reboot_command)
local suspend_button = button("Suspend", icondir .. "suspend.svg", Theme_config.powermenu.suspend_button_bg,
suspend_command)
local logout_button = button("Logout", icondir .. "logout.svg", Theme_config.powermenu.logout_button_bg, logout_command)
local lock_button = button("Lock", icondir .. "lock.svg", Theme_config.powermenu.lock_button_bg, lock_command)
-- Signals to change color on hover
Hover_signal(shutdown_button.background, color["Blue200"], color["Grey900"])
Hover_signal(reboot_button.background, color["Red200"], color["Grey900"])
Hover_signal(suspend_button.background, color["Yellow200"], color["Grey900"])
Hover_signal(logout_button.background, color["Green200"], color["Grey900"])
Hover_signal(lock_button.background, color["Orange200"], color["Grey900"])
Hover_signal(shutdown_button.background, Theme_config.powermenu.shutdown_button_bg, Theme_config.powermenu.button_fg)
Hover_signal(reboot_button.background, Theme_config.powermenu.reboot_button_bg, Theme_config.powermenu.button_fg)
Hover_signal(suspend_button.background, Theme_config.powermenu.suspend_button_bg, Theme_config.powermenu.button_fg)
Hover_signal(logout_button.background, Theme_config.powermenu.logout_button_bg, Theme_config.powermenu.button_fg)
Hover_signal(lock_button.background, Theme_config.powermenu.lock_button_bg, Theme_config.powermenu.button_fg)
-- The powermenu widget
local powermenu = wibox.widget {
layout = wibox.layout.align.vertical,
expand = "none",
nil,
{
{
nil,
{
{
nil,
{
nil,
{
profile_picture,
margins = dpi(0),
widget = wibox.container.margin
},
nil,
expand = "none",
layout = wibox.layout.align.horizontal
},
nil,
layout = wibox.layout.align.vertical,
expand = "none"
},
spacing = dpi(50),
{
profile_name,
margins = dpi(0),
widget = wibox.container.margin
},
layout = wibox.layout.fixed.vertical
},
nil,
expand = "none",
layout = wibox.layout.align.horizontal
profile_picture,
profile_name,
spacing = dpi(50),
layout = wibox.layout.fixed.vertical
},
{
nil,
{
{
shutdown_button,
reboot_button,
logout_button,
lock_button,
suspend_button,
spacing = dpi(30),
layout = wibox.layout.fixed.horizontal
},
margins = dpi(0),
widget = wibox.container.margin
shutdown_button,
reboot_button,
logout_button,
lock_button,
suspend_button,
spacing = dpi(30),
layout = wibox.layout.fixed.horizontal
},
nil,
expand = "none",
layout = wibox.layout.align.horizontal
halign = "center",
valign = "center",
widget = wibox.container.place
},
layout = wibox.layout.align.vertical
layout = wibox.layout.fixed.vertical
},
nil
halign = "center",
valign = "center",
widget = wibox.container.place
}
-- Container for the widget, covers the entire screen
@@ -230,7 +193,7 @@ return function(s)
type = "splash",
visible = false,
ontop = true,
bg = "#21212188",
bg = Theme_config.powermenu.container_bg,
height = s.geometry.height,
width = s.geometry.width,
x = s.geometry.x,

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/titlebar/"
@@ -16,6 +14,12 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/titlebar/"
awful.titlebar.enable_tooltip = true
awful.titlebar.fallback_name = 'Client'
Theme.titlebar_close_button_normal = icondir .. "close.svg"
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
Theme.titlebar_minimize_button_normal = icondir .. "minimize.svg"
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
local double_click_event_handler = function(double_click_event)
if double_click_timer then
double_click_timer:stop()
@@ -60,10 +64,10 @@ local create_click_events = function(c)
return buttons
end
local create_titlebar = function(c, bg, size)
local create_titlebar = function(c, size)
local titlebar = awful.titlebar(c, {
position = "left",
bg = bg,
bg = Theme_config.titlebar.bg,
size = size
})
@@ -73,27 +77,27 @@ local create_titlebar = function(c, bg, size)
{
awful.titlebar.widget.closebutton(c),
widget = wibox.container.background,
bg = color["Red200"],
bg = Theme_config.titlebar.close_button_bg,
shape = function(cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
id = "closebutton"
},
{
awful.titlebar.widget.maximizedbutton(c),
widget = wibox.container.background,
bg = color["Yellow200"],
bg = Theme_config.titlebar.minimize_button_bg,
shape = function(cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
id = "maximizebutton"
},
{
awful.titlebar.widget.minimizebutton(c),
widget = wibox.container.background,
bg = color["Green200"],
bg = Theme_config.titlebar.maximize_button_bg,
shape = function(cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
id = "minimizebutton"
},
@@ -119,15 +123,18 @@ local create_titlebar = function(c, bg, size)
layout = wibox.layout.align.vertical,
id = "main"
}
Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"], color["Grey900"])
Hover_signal(titlebar.main.margin.spacing.maximizebutton, color["Yellow200"], color["Grey900"])
Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"], color["Grey900"])
Hover_signal(titlebar.main.margin.spacing.closebutton, Theme_config.titlebar.close_button_bg,
Theme_config.titlebar.close_button_fg)
Hover_signal(titlebar.main.margin.spacing.maximizebutton, Theme_config.titlebar.minimize_button_bg,
Theme_config.titlebar.minimize_button_fg)
Hover_signal(titlebar.main.margin.spacing.minimizebutton, Theme_config.titlebar.maximize_button_bg,
Theme_config.titlebar.maximize_button_fg)
end
local create_titlebar_dialog = function(c, bg, size)
local create_titlebar_dialog_modal = function(c, size)
local titlebar = awful.titlebar(c, {
position = "left",
bg = bg,
bg = Theme_config.titlebar.bg,
size = size
})
@@ -137,18 +144,18 @@ local create_titlebar_dialog = function(c, bg, size)
{
awful.titlebar.widget.closebutton(c),
widget = wibox.container.background,
bg = color["Red200"],
bg = Theme_config.titlebar.close_button_bg,
shape = function(cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
id = "closebutton"
},
{
awful.titlebar.widget.minimizebutton(c),
widget = wibox.container.background,
bg = color["Green200"],
bg = Theme_config.titlebar.minimize_button_bg,
shape = function(cr, height, width)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
id = "minimizebutton"
},
@@ -174,79 +181,38 @@ local create_titlebar_dialog = function(c, bg, size)
layout = wibox.layout.align.vertical,
id = "main"
}
Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"], color["Grey900"])
Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"], color["Grey900"])
Hover_signal(titlebar.main.margin.spacing.closebutton, Theme_config.titlebar.close_button_bg,
Theme_config.titlebar.close_button_fg)
Hover_signal(titlebar.main.margin.spacing.minimizebutton, Theme_config.titlebar.minimize_button_bg,
Theme_config.titlebar.minimize_button_fg)
end
local draw_titlebar = function(c)
if c.type == 'normal' and not c.requests_no_titlebar then
if c.class == 'Firefox' then
create_titlebar(c, '#121212AA', 35)
elseif c.name == "Steam" then
create_titlebar(c, '#121212AA', 0)
elseif c.name == "Settings" then
create_titlebar(c, '#121212AA', 0)
elseif c.class == "gcr-prompter" or c.class == "Gcr-prompter" then
create_titlebar(c, '#121212AA', 0)
else
create_titlebar(c, '#121212AA', 35)
end
elseif c.type == 'dialog' then
create_titlebar_dialog(c, '#121212AA', 35)
end
end
client.connect_signal(
"property::maximized",
function(c)
if c.maximized then
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg"
elseif not c.minimized then
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
end
end
)
client.connect_signal(
"request::titlebars",
function(c)
if c.maximized then
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg"
draw_titlebar(c)
elseif not c.minimized then
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
draw_titlebar(c)
if c.type == "normal" then
create_titlebar(c, dpi(35))
elseif c.type == "dialog" then
create_titlebar_dialog_modal(c, dpi(35))
elseif c.type == "modal" then
create_titlebar_dialog_modal(c, dpi(35))
else
create_titlebar(c, dpi(35))
end
if not c.floating or c.maximized then
awful.titlebar.hide(c, 'left')
awful.titlebar.hide(c, 'right')
awful.titlebar.hide(c, 'top')
awful.titlebar.hide(c, 'bottom')
if not c.floating then
awful.titlebar.hide(c, "left")
end
end
)
client.connect_signal(
'property::floating',
"property::floating",
function(c)
if c.floating or (c.floating and c.maximized) then
awful.titlebar.show(c, 'left')
awful.titlebar.hide(c, 'right')
awful.titlebar.hide(c, 'top')
awful.titlebar.hide(c, 'bottom')
if c.floating and not (c.maximized or c.fullscreen) then
awful.titlebar.show(c, "left")
else
awful.titlebar.hide(c, 'left')
awful.titlebar.hide(c, 'right')
awful.titlebar.hide(c, 'top')
awful.titlebar.hide(c, 'bottom')
awful.titlebar.hide(c, "left")
end
end
)

View File

@@ -7,7 +7,6 @@ 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")
local rubato = require("src.lib.rubato")
@@ -26,6 +25,8 @@ return function(s)
{
id = "icon",
resize = false,
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
spacing = dpi(10),
@@ -46,7 +47,7 @@ return function(s)
border_color = color["Grey800"],
border_width = dpi(2),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
}
@@ -64,11 +65,13 @@ return function(s)
"update::bg_sink",
function(new_node)
if node == new_node then
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg", color["Grey900"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
color["Grey900"])
device.bg = color["Purple200"]
device.fg = color["Grey900"]
else
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg", color["Purple200"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
color["Purple200"])
device.bg = color["Grey900"]
device.fg = color["Purple200"]
end
@@ -79,18 +82,19 @@ return function(s)
function(stdout)
local node_active = stdout:gsub("\n", "")
if node == node_active then
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg", color["Grey900"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
color["Grey900"])
device.bg = color["Purple200"]
device.fg = color["Grey900"]
else
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg", color["Purple200"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
color["Purple200"])
device.bg = color["Grey900"]
device.fg = color["Purple200"]
end
end
)
awesome.emit_signal("update::bg_sink", node)
--Hover_signal(device, "#313131", color["Purple200"])
else
device:connect_signal(
@@ -106,11 +110,13 @@ return function(s)
"update::bg_source",
function(new_node)
if node == new_node then
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg", color["Grey900"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
color["Grey900"])
device.bg = color["Blue200"]
device.fg = color["Grey900"]
else
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg", color["Blue200"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
color["Blue200"])
device.bg = color["Grey900"]
device.fg = color["Blue200"]
end
@@ -121,11 +127,13 @@ return function(s)
function(stdout)
local node_active = stdout:gsub("\n", "")
if node == node_active then
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg", color["Grey900"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
color["Grey900"])
device.bg = color["Blue200"]
device.fg = color["Grey900"]
else
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg", color["Blue200"])
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
color["Blue200"])
device.bg = color["Grey900"]
device.fg = color["Blue200"]
end
@@ -161,7 +169,7 @@ return function(s)
border_width = dpi(2),
id = "volume_device_background",
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background
},
@@ -195,7 +203,7 @@ return function(s)
border_color = color["Grey800"],
border_width = dpi(2),
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background
},
@@ -216,6 +224,8 @@ return function(s)
resize = false,
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
id = "icon"
},
id = "center",
@@ -239,7 +249,7 @@ return function(s)
bg = color["Grey800"],
fg = color["Purple200"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
},
@@ -263,6 +273,8 @@ return function(s)
resize = false,
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["LightBlueA200"]),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
id = "icon",
},
id = "center",
@@ -286,7 +298,7 @@ return function(s)
bg = color["Grey800"],
fg = color["LightBlueA200"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
},
@@ -307,13 +319,15 @@ return function(s)
{
resize = false,
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "volume-high.svg", color["Purple200"]),
id = "icon",
},
{
{
bar_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(5))
end,
bar_height = dpi(5),
bar_color = color["Grey800"],
@@ -321,13 +335,12 @@ return function(s)
handle_color = color["Purple200"],
handle_shape = gears.shape.circle,
handle_border_color = color["Purple200"],
handle_width = dpi(15),
handle_width = dpi(12),
maximum = 100,
forced_height = dpi(26),
widget = wibox.widget.slider,
id = "slider"
},
bottom = dpi(12),
left = dpi(5),
id = "slider_margin",
widget = wibox.container.margin
@@ -347,13 +360,15 @@ return function(s)
{
resize = false,
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "microphone.svg", color["Blue200"]),
id = "icon"
},
{
{
bar_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
gears.shape.rounded_rect(cr, width, height, dpi(5))
end,
bar_height = dpi(5),
bar_color = color["Grey800"],
@@ -361,7 +376,7 @@ return function(s)
handle_color = color["Blue200"],
handle_shape = gears.shape.circle,
handle_border_color = color["Blue200"],
handle_width = dpi(15),
handle_width = dpi(12),
maximum = 100,
forced_height = dpi(26),
widget = wibox.widget.slider,
@@ -377,6 +392,7 @@ return function(s)
id = "mic_volume_margin",
left = dpi(10),
right = dpi(10),
top = dpi(10),
widget = wibox.container.margin
},
id = "controller_layout",
@@ -390,7 +406,7 @@ return function(s)
border_color = color["Grey800"],
border_width = dpi(4),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
forced_width = dpi(400),
widget = wibox.container.background
@@ -419,13 +435,13 @@ return function(s)
if volume_list.forced_height == 0 then
rubato_timer.target = dpi(200)
audio_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Purple200"]))
else
rubato_timer.target = 0
audio_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]))
end
@@ -455,20 +471,21 @@ return function(s)
if mic_list.forced_height == 0 then
rubato_timer.target = dpi(200)
mic_selector_margin.mic_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Blue200"]))
else
rubato_timer.target = 0
mic_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Blue200"]))
end
end
)
local audio_slider_margin = volume_controller:get_children_by_id("audio_volume_margin")[1].audio_volume.slider_margin.slider
local audio_slider_margin = volume_controller:get_children_by_id("audio_volume_margin")[1].audio_volume.slider_margin.
slider
-- Volume slider change event
audio_slider_margin:connect_signal(
@@ -499,17 +516,20 @@ return function(s)
stretch = false,
visible = false,
screen = s,
placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(305), top = dpi(60) } }) end,
placement = function(c) awful.placement.align(c,
{ position = "top_right", margins = { right = dpi(305), top = dpi(60) } })
end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end
}
-- Get all source devices
local function get_source_devices()
awful.spawn.easy_async_with_shell(
[[ pactl list sinks | grep -E 'node.name|device.description|alsa.card_name' | awk '{gsub(/"/, ""); for(i = 1;i < NF;i++) printf $i " "; print $NF}' ]],
[[
pactl list sinks | grep -E 'node.name|device.description|alsa.card_name' | awk '{gsub(/"/, ""); for(i = 1;i < NF;i++) printf $i " "; print $NF}'
]],
function(stdout)
local device_list = {}
local was_alsa = false
@@ -543,8 +563,9 @@ return function(s)
-- Get all input devices
local function get_input_devices()
awful.spawn.easy_async_with_shell(
[[ pactl list sources | grep -E "node.name|device.description|alsa.card_name" | awk '{gsub(/"/, ""); for(i = 1;i < NF;i++) printf $i " "; print $NF}' ]],
[[
pactl list sources | grep -E "node.name|device.description|alsa.card_name" | awk '{gsub(/"/, ""); for(i = 1;i < NF;i++) printf $i " "; print $NF}'
]],
function(stdout)
local device_list = {}
local was_alsa = false
@@ -603,9 +624,11 @@ return function(s)
local volume = stdout:gsub("%%", ""):gsub("\n", "")
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(volume))
if volume > 0 then
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone.svg", color["LightBlue200"]))
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir
.. "microphone.svg", color["LightBlue200"]))
else
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir
.. "microphone-off.svg", color["LightBlue200"]))
end
end
)
@@ -620,7 +643,8 @@ return function(s)
function(stdout)
if stdout:match("yes") then
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(0))
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir
.. "microphone-off.svg", color["LightBlue200"]))
else
get_mic_volume()
end
@@ -654,10 +678,10 @@ return function(s)
-- Grabs all keys and hides popup when anything is pressed
-- TODO: Make it possible to navigate and select using the kb
local volume_controller_keygrabber = awful.keygrabber {
awful.keygrabber {
autostart = false,
stop_event = 'release',
keypressed_callback = function(self, mod, key, command)
keypressed_callback = function()
awesome.emit_signal("volume_controller::toggle", s)
mousegrabber.stop()
end
@@ -669,18 +693,6 @@ return function(s)
layout = wibox.layout.fixed.horizontal
}
--[[ awesome.connect_signal(
"volume_controller::toggle:keygrabber",
function()
if awful.keygrabber.is_running then
volume_controller_keygrabber:stop()
else
volume_controller_keygrabber:start()
end
end
) ]]
-- Set the volume and icon
awesome.connect_signal(
"get::volume",
@@ -698,8 +710,10 @@ return function(s)
icon = icon .. "-high"
end
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.slider_margin.slider:set_value(volume)
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Purple200"]))
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.slider_margin.slider:
set_value(volume)
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color.
recolor_image(icon .. ".svg", color["Purple200"]))
end
)
@@ -708,7 +722,8 @@ return function(s)
"get::volume_mute",
function(mute)
if mute then
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "volume-mute.svg", color["Purple200"]))
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.
color.recolor_image(icondir .. "volume-mute.svg", color["Purple200"]))
end
end
)
@@ -718,10 +733,12 @@ return function(s)
"get::mic_volume",
function(volume)
if volume > 0 then
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "microphone.svg", color["LightBlue200"]))
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir
.. "microphone.svg", color["LightBlue200"]))
awesome.emit_signal("update::microphone_widget", tonumber(volume), icondir .. "microphone.svg")
else
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir
.. "microphone-off.svg", color["LightBlue200"]))
awesome.emit_signal("update::microphone_widget", tonumber(volume), icondir .. "microphone-off.svg")
end
end

View File

@@ -18,177 +18,104 @@ return function(s)
local volume_osd_widget = wibox.widget {
{
{
{
{
nil,
{
nil,
{
id = "icon",
forced_height = dpi(220),
image = icondir .. "volume-high.svg",
widget = wibox.widget.imagebox
},
nil,
expand = "none",
id = "icon_margin2",
layout = wibox.layout.align.vertical
},
nil,
id = "icon_margin1",
expand = "none",
layout = wibox.layout.align.horizontal
},
{ -- Volume Icon
image = gears.color.recolor_image(icondir .. "volume-high.svg", Theme_config.volume_osd.icon_color),
valign = "center",
halign = "center",
resize = false,
id = "icon",
widget = wibox.widget.imagebox
},
{ -- Volume Bar
{
{
id = "label",
text = "Volume",
align = "left",
valign = "center",
widget = wibox.widget.textbox
id = "progressbar1",
color = Theme_config.volume_osd.bar_bg_active,
background_color = Theme_config.volume_osd.bar_bg,
max_value = 100,
value = 50,
forced_height = dpi(6),
shape = function(cr, width, heigth)
gears.shape.rounded_bar(cr, width, heigth, dpi(6))
end,
widget = wibox.widget.progressbar
},
nil,
{
id = "value",
text = "0%",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "label_value_layout",
forced_height = dpi(48),
layout = wibox.layout.align.horizontal,
},
{
{
id = "volume_slider",
bar_shape = gears.shape.rounded_rect,
bar_height = dpi(10),
bar_color = color["Grey800"] .. "88",
bar_active_color = "#ffffff",
handle_color = "#ffffff",
handle_shape = gears.shape.circle,
handle_width = dpi(10),
handle_border_color = color["White"],
maximum = 100,
widget = wibox.widget.slider
},
id = "slider_layout",
forced_height = dpi(24),
id = "progressbar_container2",
halign = "center",
valign = "center",
widget = wibox.container.place
},
id = "icon_slider_layout",
spacing = dpi(0),
layout = wibox.layout.align.vertical
id = "progressbar_container",
width = dpi(240),
heigth = dpi(20),
stragety = "max",
widget = wibox.container.constraint
},
id = "osd_layout",
layout = wibox.layout.align.vertical
id = "layout1",
spacing = dpi(10),
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(24),
right = dpi(24),
id = "margin",
margins = dpi(10),
widget = wibox.container.margin
},
bg = color["Grey900"] .. '88',
widget = wibox.container.background,
ontop = true,
visible = true,
type = "notification",
forced_height = dpi(300),
forced_width = dpi(300),
offset = dpi(5),
forced_height = dpi(80),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
border_color = Theme_config.volume_osd.border_color,
border_width = Theme_config.volume_osd.border_width,
fg = Theme_config.volume_osd.fg,
bg = Theme_config.volume_osd.bg,
widget = wibox.container.background
}
local function update_osd()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh volume",
function(stdout)
local volume_level = stdout:gsub("\n", ""):gsub("%%", "")
awesome.emit_signal("widget::volume")
volume_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text(volume_level .. "%")
awesome.emit_signal(
"widget::volume:update",
volume_level
)
if awful.screen.focused().show_volume_osd then
awesome.emit_signal(
"module::volume_osd:show",
true
)
end
volume_level = tonumber(volume_level)
local icon = icondir .. "volume"
if volume_level < 1 then
icon = icon .. "-mute"
elseif volume_level >= 1 and volume_level < 34 then
icon = icon .. "-low"
elseif volume_level >= 34 and volume_level < 67 then
icon = icon .. "-medium"
elseif volume_level >= 67 then
icon = icon .. "-high"
end
volume_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icon .. ".svg")
end
)
end
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:connect_signal(
"property::value",
function()
update_osd()
end
)
local update_slider = function()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh mute",
function(stdout)
if stdout:match("yes") then
volume_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text("0%")
volume_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icondir .. "volume-mute" .. ".svg")
else
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh volume",
function(stdout2)
stdout2 = stdout2:gsub("%%", ""):gsub("\n", "")
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(stdout2))
update_osd()
if stdout:match("yes") then
volume_osd_widget:get_children_by_id("icon")[1]
:set_image(gears.color.recolor_image(
icondir .. "volume-mute" .. ".svg", Theme_config.volume_osd.icon_color))
volume_osd_widget:get_children_by_id("progressbar1")[1].value = tonumber(0)
else
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh volume",
function(stdout2)
local volume_level = stdout2:gsub("%%", ""):gsub("\n", "")
volume_osd_widget:get_children_by_id("progressbar1")[1].value = tonumber(volume_level)
local icon = icondir .. "volume"
if volume_level < 1 then
icon = icon .. "-mute"
elseif volume_level >= 1 and volume_level < 34 then
icon = icon .. "-low"
elseif volume_level >= 34 and volume_level < 67 then
icon = icon .. "-medium"
elseif volume_level >= 67 then
icon = icon .. "-high"
end
volume_osd_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icon .. ".svg",
Theme_config.volume_osd.icon_color))
end
)
end
)
end
end
)
end
-- Signals
awesome.connect_signal(
"module::slider:update",
function()
update_slider()
end
)
awesome.connect_signal(
"widget::volume:update",
function(value)
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(value))
end
)
update_slider()
local volume_container = awful.popup {
widget = wibox.container.background,
widget = {},
ontop = true,
bg = color["Grey900"] .. "00",
stretch = false,
visible = false,
screen = s,
placement = function(c) awful.placement.centered(c, { margins = { top = dpi(200) } }) end,
placement = function(c) awful.placement.bottom_left(c, { margins = dpi(20) }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 15)
gears.shape.rounded_rect(cr, width, height, dpi(14))
end
}
@@ -205,39 +132,17 @@ return function(s)
layout = wibox.layout.fixed.horizontal
}
awesome.connect_signal(
"module::volume_osd:show",
function()
if s == mouse.screen then
volume_container.visible = true
end
end
)
volume_container:connect_signal(
"mouse::enter",
function()
volume_container.visible = true
hide_volume_osd:stop()
end
)
volume_container:connect_signal(
"mouse::leave",
function()
volume_container.visible = true
hide_volume_osd:again()
end
)
awesome.connect_signal(
"widget::volume_osd:rerun",
function()
if hide_volume_osd.started then
hide_volume_osd:again()
else
hide_volume_osd:start()
volume_container.visible = true
if hide_volume_osd.started then
hide_volume_osd:again()
update_slider()
else
hide_volume_osd:start()
update_slider()
end
end
end
)
end

View File

@@ -0,0 +1,153 @@
---------------------------------
-- This is the window_switcher --
---------------------------------
-- 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")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/window_switcher/"
return function(s)
local list_update = function(widget, buttons, label, _, objects)
widget:reset()
for _, object in ipairs(objects) do
local window_element = wibox.widget {
{
{
{ -- Icon
{
id = "icon",
image = object.icon,
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
width = dpi(100),
height = dpi(100),
id = "icon_const",
strategy = "exact",
widget = wibox.container.constraint
},
{
text = "Application",
id = "label",
valign = "center",
align = "center",
widget = wibox.widget.textbox
},
id = "layout1",
spacing = dpi(10),
layout = wibox.layout.fixed.vertical
},
id = "margin",
margins = dpi(20),
widget = wibox.container.margin
},
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
bg = Theme_config.window_switcher.element_bg,
fg = Theme_config.window_switcher.element_fg,
widget = wibox.container.background
}
local function create_buttons(buttons_t, object_t)
if buttons_t then
local btns = {}
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_t)
end,
on_release = function()
b:emit_signal('release', object_t)
end
}
btns[#btns + 1] = btn
end
return btns
end
end
window_element:buttons(create_buttons(buttons, object))
local text, _ = label(object, window_element.margin.layout1.label)
if object == client.focus then
if text == nil or text == "" then
window_element:get_children_by_id("label")[1].text = "Application"
else
local text_full = text:match(">(.-)<")
if text_full then
if object.class == nil then
text = object.name
else
text = object.class:sub(1, 20)
end
end
window_element:get_children_by_id("label")[1].text = text
end
else
end
window_element:get_children_by_id("icon")[1]:set_image(xdg_icon_lookup:find_icon(object.class, 64))
widget:add(window_element)
widget:set_spacing(dpi(6))
end
return widget
end
local window_switcher = awful.widget.tasklist(
s,
awful.widget.tasklist.filter.allscreen,
awful.util.table.join(
awful.button(
{},
1,
function(c)
if c == client.focus then
c.minimized = true
else
c.minimized = false
if not c:isvisible() and c.first_tag then
c.first_tag:view_only()
end
c:emit_signal('request::activate')
c:raise()
end
end
)
),
{},
list_update,
wibox.layout.fixed.horizontal()
)
local window_switcher_container = awful.popup {
ontop = true,
visible = false,
screen = s,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
widget = { window_switcher },
placement = awful.placement.centered,
bg = Theme_config.window_switcher.bg,
border_color = Theme_config.window_switcher.border_color,
border_width = Theme_config.window_switcher.border_width
}
window_switcher_container:setup {
layout = wibox.layout.fixed.vertical
}
end