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

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

View File

@@ -0,0 +1,21 @@
--------------------------------------
-- This is the application launcher --
--------------------------------------
-- Awesome Libs
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
return function()
local application_list = wibox.widget {
homogenous = true,
expand = false,
spacing = dpi(10),
layout = wibox.container.grid
}
return application_list
end

View File

@@ -4,22 +4,58 @@
-- 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/"
local application_grid = require("src.modules.application_launcher.application")()
local searchbar = require("src.modules.application_launcher.searchbar")()
return function(s)
local applicaton_launcher = wibox.widget {
local applicaton_launcher = wibox.widget {
{
{
searchbar,
wibox.widget.inputtextbox,
application_grid,
layout = wibox.layout.fixed.vertical
},
margins = dpi(20),
widget = wibox.container.margin
},
height = dpi(600),
width = dpi(800),
strategy = "exact",
widget = wibox.container.constraint
}
local application_container = awful.popup {
widget = wibox.container.background,
ontop = true,
visible = false,
stretch = false,
screen = s,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
placement = awful.placement.centered,
bg = Theme_config.application_launcher.bg,
border_color = Theme_config.application_launcher.border_color,
border_width = Theme_config.application_launcher.border_width
}
application_container:setup {
applicaton_launcher,
layout = wibox.layout.fixed.vertical
}
awesome.connect_signal(
"application_laucher::show",
function()
application_container.visible = not application_container.visible
end
)
end

View File

@@ -0,0 +1,53 @@
-------------------------------------------------------
-- This is the seachbar for the application launcher --
-------------------------------------------------------
-- Awesome Libs
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local icondir = awful.util.getdir("config") .. "src/assets/icons/application_launcher/searchbar/"
return function()
local searchbar = wibox.widget {
{
{
{
{ -- Search icon
{
resize = false,
image = icondir .. "search.svg",
widget = wibox.widget.imagebox
},
strategy = "exact",
widget = wibox.container.constraint
},
{
fg = Theme_config.application_launcher.searchbar.fg_hint,
text = "Search",
valign = "center",
align = "center",
widget = wibox.widget.textbox
},
widget = wibox.layout.fixed.horizontal
},
margins = dpi(5),
widget = wibox.container.margin
},
bg = Theme_config.application_launcher.searchbar.bg,
fg = Theme_config.application_launcher.searchbar.fg,
border_color = Theme_config.application_launcher.searchbar.border_color,
border_width = Theme_config.application_launcher.searchbar.border_width,
widget = wibox.container.background
},
width = dpi(400),
height = dpi(40),
strategy = "exact",
widget = wibox.container.constraint
}
return searchbar
end

View File

@@ -4,7 +4,6 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -12,17 +11,6 @@ local wibox = require("wibox")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/brightness/"
BACKLIGHT_MAX_BRIGHTNESS = 0
BACKLIGHT_SEPS = 0
awful.spawn.easy_async_with_shell(
"pkexec xfpm-power-backlight-helper --get-max-brightness",
function(stdout)
BACKLIGHT_MAX_BRIGHTNESS = tonumber(stdout)
BACKLIGHT_SEPS = BACKLIGHT_MAX_BRIGHTNESS / 100
BACKLIGHT_SEPS = math.floor(BACKLIGHT_SEPS)
end
)
return function(s)
local brightness_osd_widget = wibox.widget {
@@ -81,30 +69,23 @@ return function(s)
widget = wibox.container.background
}
local update_slider = 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:get_children_by_id("progressbar1")[1].value = brightness_value
awesome.connect_signal(
"brightness::get",
function(brightness)
brightness_osd_widget:get_children_by_id("progressbar1")[1].value = brightness
awesome.emit_signal("update::backlight", brightness_value)
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")[1]:set_image(gears.color.recolor_image(icon .. ".svg",
Theme_config.brightness_osd.icon_color))
local icon = icondir .. "brightness"
if brightness >= 0 and brightness < 34 then
icon = icon .. "-low"
elseif brightness >= 34 and brightness < 67 then
icon = icon .. "-medium"
elseif brightness >= 67 then
icon = icon .. "-high"
end
)
end
update_slider()
brightness_osd_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icon .. ".svg",
Theme_config.brightness_osd.icon_color))
end
)
local brightness_container = awful.popup {
widget = {},
@@ -132,15 +113,13 @@ return function(s)
}
awesome.connect_signal(
"widget::brightness_osd:rerun",
"brightness::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
)

View File

@@ -3,7 +3,6 @@
--------------------------------------------------------------------------------------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -14,7 +13,7 @@ return function(s, widgets)
screen = s,
widget = wibox.container.background,
ontop = false,
bg = color["Grey900"],
bg = Theme_config.center_bar.bg,
visible = true,
maximum_width = dpi(500),
placement = function(c) awful.placement.top(c, { margins = dpi(10) }) end,
@@ -24,7 +23,7 @@ return function(s, widgets)
}
top_center:struts {
top = 55
top = dpi(55)
}
local function prepare_widgets(w)

View File

@@ -3,7 +3,6 @@
--------------------------------------------------------------------------------------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -41,7 +40,7 @@ return function(screen, programs)
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(10))
end,
bg = color["Grey900"],
bg = Theme_config.dock.element_bg,
widget = wibox.container.background,
id = "background"
},
@@ -55,11 +54,12 @@ return function(screen, programs)
for _, c in ipairs(client.get()) do
if string.lower(c.class):match(program["Icon"]) and c == client.focus then
dock_element.background.bg = color["Grey800"]
dock_element.background.bg = Theme_config.dock.element_focused_bg
end
end
Hover_signal(dock_element.background, color["Grey800"], color["White"])
Hover_signal(dock_element.background, Theme_config.dock.element_focused_hover_bg,
Theme_config.dock.element_focused_hover_fg)
dock_element:connect_signal(
"button::press",
@@ -84,7 +84,7 @@ return function(screen, programs)
local dock = awful.popup {
widget = wibox.container.background,
ontop = true,
bg = color["Grey900"],
bg = Theme_config.dock.bg,
visible = true,
screen = screen,
type = "dock",
@@ -139,24 +139,24 @@ return function(screen, programs)
local clients = client.get()
for index, pr in ipairs(prog) do
local indicators = { layout = wibox.layout.flex.horizontal, spacing = dpi(5) }
local col = color["Grey600"]
local col = Theme_config.dock.indicator_bg
for i, c in ipairs(clients) do
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"]
col = Theme_config.dock.indicator_focused_bg
elseif c.urgent then
col = color["RedA200"]
col = Theme_config.dock.indicator_urgent_bg
elseif c.maximized then
col = color["GreenA200"]
col = Theme_config.dock.indicator_maximized_bg
elseif c.minimized then
col = color["BlueA200"]
col = Theme_config.dock.indicator_minimized_bg
elseif c.fullscreen then
col = color["PinkA200"]
col = Theme_config.dock.indicator_fullscreen_bg
else
col = color["Grey600"]
col = Theme_config.dock.indicator_bg
end
indicators[i] = wibox.widget {
widget = wibox.container.background,

View File

@@ -3,7 +3,6 @@
--------------------------------------------------------------------------------------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -16,7 +15,7 @@ return function(s, w)
},
ontop = false,
bg = color["Grey900"],
bg = Theme_config.left_bar.bg,
visible = true,
maximum_width = dpi(650),
placement = function(c) awful.placement.top_left(c, { margins = dpi(10) }) end,
@@ -26,7 +25,7 @@ return function(s, w)
}
top_left:struts {
top = 55
top = dpi(55)
}
local function prepare_widgets(widgets)

View File

@@ -3,7 +3,6 @@
--------------------------------------------------------------------------------------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -13,7 +12,7 @@ return function(s, w)
local top_right = awful.popup {
widget = wibox.container.background,
ontop = false,
bg = color["Grey900"],
bg = Theme_config.right_bar.bg,
visible = true,
screen = s,
placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end,
@@ -23,7 +22,7 @@ return function(s, w)
}
top_right:struts {
top = 55
top = dpi(55)
}
local function prepare_widgets(widgets)

View File

@@ -10,7 +10,7 @@ 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_config.layouts
awful.layout.append_default_layouts(User_config.layouts)
awful.tag(
{ "1", "2", "3", "4", "5", "6", "7", "8", "9" },
s,
@@ -19,12 +19,13 @@ awful.screen.connect_for_each_screen(
require("src.modules.powermenu")(s)
require("src.modules.volume_osd")(s)
require("src.modules.brightness_osd")(s)
require("src.modules.bluetooth_controller")(s)
--require("src.modules.brightness_osd")(s)
--require("src.modules.bluetooth_controller")(s)
require("src.modules.titlebar")
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)
--require("src.modules.application_launcher.init")(s)
end
)

View File

@@ -4,7 +4,6 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -58,8 +57,8 @@ return function(s)
id = "clearall"
},
id = "background4",
fg = color["Grey900"],
bg = color["Blue200"],
fg = Theme_config.notification_center.clear_all_button.fg,
bg = Theme_config.notification_center.clear_all_button.bg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12)
end,
@@ -81,7 +80,7 @@ return function(s)
{
{
widget = wibox.container.background,
bg = color["Grey700"],
bg = Theme_config.notification_center.dnd.disabled,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(8))
end,
@@ -104,7 +103,7 @@ return function(s)
{
{
widget = wibox.container.background,
bg = color["Purple200"],
bg = Theme_config.notification_center.dnd.border_enabled,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(8))
end,
@@ -131,8 +130,8 @@ return function(s)
},
active = false,
widget = wibox.container.background,
bg = color["Grey900"],
border_color = color["Grey800"],
bg = Theme_config.notification_center.dnd.bg,
border_color = Theme_config.notification_center.dnd.border_disabled,
border_width = dpi(2),
forced_height = dpi(40),
forced_width = dpi(80),
@@ -148,13 +147,13 @@ return function(s)
left_button.visible = true
right_button.visible = false
toggle_button.active = not toggle_button.active
toggle_button.border_color = color["Grey800"]
toggle_button.border_color = Theme_config.notification_center.dnd.border_disabled
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"]
toggle_button.border_color = Theme_config.notification_center.dnd.border_enabled
User_config.dnd = true
end
end
@@ -177,9 +176,9 @@ return function(s)
id = "layout12"
},
id = "background4",
fg = color["Pink200"],
fg = Theme_config.notification_center.dnd.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
forced_height = dpi(40),
widget = wibox.container.background
@@ -227,9 +226,9 @@ return function(s)
--#region Notification center
local notification_center = awful.popup {
widget = wibox.container.background,
bg = color["Grey900"],
border_color = color["Grey800"],
border_width = dpi(4),
bg = Theme_config.notification_center.bg,
border_color = Theme_config.notification_center.border_color,
border_width = Theme_config.notification_center.border_width,
placement = function(c)
awful.placement.top(c, { margins = dpi(10) })
end,
@@ -237,7 +236,7 @@ return function(s)
screen = s,
visible = false,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
}
@@ -295,8 +294,7 @@ return function(s)
id = "yes",
spacing_widget = {
{
fg = color["Grey800"],
bg = color["Grey800"],
bg = Theme_config.notification_center.spacing_color,
widget = wibox.container.background
},
top = dpi(40),
@@ -365,7 +363,8 @@ return function(s)
end
)
Hover_signal(clear_all_widget, color["Blue200"], color["Grey900"])
Hover_signal(clear_all_widget, Theme_config.notification_center.clear_all_button.bg,
Theme_config.notification_center.clear_all_button.fg)
--#endregion
end

View File

@@ -4,7 +4,6 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -33,7 +32,7 @@ function nl.create_notification(n)
id = "txt"
},
id = "background",
fg = color["Teal200"],
fg = Theme_config.notification_center.notification_list.timer_fg,
widget = wibox.container.background
},
margins = dpi(10),
@@ -81,7 +80,7 @@ function nl.create_notification(n)
id = "arc_chart"
},
id = "background",
fg = color["Teal200"],
fg = Theme_config.notification_center.notification_list.close_color,
widget = wibox.container.background
},
strategy = "exact",
@@ -108,7 +107,8 @@ function nl.create_notification(n)
{
{
{
image = gears.color.recolor_image(icondir .. "notification-outline.svg", color["Teal200"]),
image = gears.color.recolor_image(icondir .. "notification-outline.svg",
Theme_config.notification_center.notification_list.icon),
resize = false,
valign = "center",
halign = "center",
@@ -125,7 +125,7 @@ function nl.create_notification(n)
},
layout = wibox.layout.fixed.horizontal
},
fg = color["Teal200"],
fg = Theme_config.notification_center.notification_list.title_fg,
widget = wibox.container.background
},
margins = dpi(10),
@@ -141,8 +141,8 @@ function nl.create_notification(n)
layout = wibox.layout.align.horizontal
},
id = "arc_app_bg",
border_color = color["Grey800"],
border_width = dpi(2),
border_color = Theme_config.notification_center.notification_list.title_border_color,
border_width = Theme_config.notification_center.notification_list.title_border_width,
widget = wibox.container.background
},
{
@@ -211,12 +211,10 @@ function nl.create_notification(n)
widget = wibox.container.constraint
},
pk = #nl.notification_list + 1,
bg = color["Grey900"],
border_color = color["Grey800"],
border_width = dpi(4),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 8)
end,
bg = Theme_config.notification_center.notification_list.notification_bg,
border_color = Theme_config.notification_center.notification_list.notification_border_color,
border_width = Theme_config.notification_center.notification_list.notification_border_width,
shape = Theme_config.notification_center.notification_list.notification_shape,
widget = wibox.container.background
}
@@ -235,7 +233,8 @@ function nl.create_notification(n)
end
)
Hover_signal(close_widget.const.background, color["Grey900"], color["Teal200"])
Hover_signal(close_widget.const.background, Theme_config.notification_center.notification_list.close_bg,
Theme_config.notification_center.notification_list.close_color)
notification:connect_signal(
"mouse::enter",

View File

@@ -4,7 +4,6 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -43,7 +42,8 @@ return function()
{
{ -- Username
id = "username_prefix",
image = gears.color.recolor_image(icondir .. "user.svg", color["Blue200"]),
image = gears.color.recolor_image(icondir .. "user.svg",
Theme_config.notification_center.profile.username_icon_color),
valign = "center",
halign = "left",
resize = false,
@@ -61,7 +61,8 @@ return function()
{
{
id = "os_prefix",
image = gears.color.recolor_image(icondir .. "laptop.svg", color["Blue200"]),
image = gears.color.recolor_image(icondir .. "laptop.svg",
Theme_config.notification_center.profile.os_prefix_icon_color),
valign = "center",
halign = "left",
resize = false,
@@ -79,7 +80,8 @@ return function()
{
{
id = "kernel_prefix",
image = gears.color.recolor_image(icondir .. "penguin.svg", color["Blue200"]),
image = gears.color.recolor_image(icondir .. "penguin.svg",
Theme_config.notification_center.profile.kernel_icon_color),
valign = "center",
halign = "left",
resize = false,
@@ -97,7 +99,8 @@ return function()
{
{
id = "uptime_prefix",
image = gears.color.recolor_image(icondir .. "clock.svg", color["Blue200"]),
image = gears.color.recolor_image(icondir .. "clock.svg",
Theme_config.notification_center.profile.uptime_icon_color),
valign = "center",
halign = "left",
resize = false,
@@ -129,12 +132,10 @@ return function()
widget = wibox.layout.fixed.vertical
},
id = "wrapper",
fg = color["Green200"],
border_color = color["Grey800"],
border_width = dpi(4),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(8))
end,
fg = Theme_config.notification_center.profile.fg,
border_color = Theme_config.notification_center.profile.border_color,
border_width = Theme_config.notification_center.profile.border_width,
shape = Theme_config.notification_center.profile.shape,
widget = wibox.container.background
},
id = "const",
@@ -177,7 +178,6 @@ return function()
profile_widget:get_children_by_id("username")[1].text = stdout:gsub("\n", "") or ""
end
)
end
-- function to fetch uptime async

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")
local naughty = require("naughty")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
@@ -43,7 +41,8 @@ return function(s)
local shuffle_button = wibox.widget {
resize = false,
image = gears.color.recolor_image(icondir .. "shuffle.svg", color["Grey800"]),
image = gears.color.recolor_image(icondir .. "shuffle.svg",
Theme_config.notification_center.song_info.shuffle_disabled),
valign = "center",
halign = "center",
widget = wibox.widget.imagebox,
@@ -55,10 +54,12 @@ return function(s)
function(stdout)
if stdout:match("On") then
awful.spawn.with_shell("playerctl shuffle off")
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg", color["Grey800"])
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg",
Theme_config.notification_center.song_info.shuffle_enabled)
else
awful.spawn.with_shell("playerctl shuffle on")
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg", color["Green200"])
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg",
Theme_config.notification_center.song_info.shuffle_disabled)
end
end
)
@@ -69,9 +70,11 @@ return function(s)
"playerctl shuffle",
function(stdout)
if stdout:match("On") then
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg", color["Green200"])
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg",
Theme_config.notification_center.song_info.shuffle_enabled)
else
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg", color["Grey800"])
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg",
Theme_config.notification_center.song_info.shuffle_disabled)
end
end
)
@@ -81,7 +84,7 @@ return function(s)
local repeat_button = wibox.widget {
resize = false,
image = gears.color.recolor_image(icondir .. "repeat.svg", color["Grey800"]),
image = gears.color.recolor_image(icondir .. "repeat.svg", Theme_config.notification_center.song_info.repeat_disabled),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
@@ -95,11 +98,14 @@ return function(s)
function(stdout)
local loop_mode = stdout:gsub("\n", "")
if loop_mode == "Track" then
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat-once.svg"), color["Green200"])
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat-once.svg"),
Theme_config.notification_center.song_info.repeat_single)
elseif loop_mode == "None" then
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"), color["Grey800"])
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"),
Theme_config.notification_center.song_info.repeat_disabled)
elseif loop_mode == "Playlist" then
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"), color["Green200"])
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"),
Theme_config.notification_center.song_info.repeat_all)
end
end
)
@@ -114,7 +120,7 @@ return function(s)
resize = false,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Teal200"]),
image = gears.color.recolor_image(icondir .. "skip-prev.svg", Theme_config.notification_center.song_info.prev_enabled),
widget = wibox.widget.imagebox
}
@@ -134,7 +140,8 @@ return function(s)
resize = false,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "play-pause.svg", color["Teal200"]),
image = gears.color.recolor_image(icondir .. "play-pause.svg",
Theme_config.notification_center.song_info.play_enabled),
widget = wibox.widget.imagebox
}
@@ -149,7 +156,7 @@ return function(s)
resize = false,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "skip-next.svg", color["Teal200"]),
image = gears.color.recolor_image(icondir .. "skip-next.svg", Theme_config.notification_center.song_info.next_enabled),
widget = wibox.widget.imagebox
}
@@ -173,13 +180,16 @@ return function(s)
local loop_mode = stdout:gsub("\n", "")
if loop_mode == "None" then
awful.spawn.with_shell("playerctl loop playlist")
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"), color["Green200"])
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"),
Theme_config.notification_center.song_info.repeat_all)
elseif loop_mode == "Playlist" then
awful.spawn.with_shell("playerctl loop track")
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat-once.svg"), color["Green200"])
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat-once.svg"),
Theme_config.notification_center.song_info.repeat_single)
elseif loop_mode == "Track" then
awful.spawn.with_shell("playerctl loop none")
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"), color["Grey800"])
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"),
Theme_config.notification_center.song_info.repeat_disabled)
end
end
)
@@ -187,9 +197,12 @@ return function(s)
repeat_button:buttons(gears.table.join(awful.button({}, 1, loop_handler)))
button_hover_effect(prev_button, "skip-prev.svg", color["Teal200"], color["Teal300"])
button_hover_effect(pause_play_button, "play-pause.svg", color["Teal200"], color["Teal300"])
button_hover_effect(next_button, "skip-next.svg", color["Teal200"], color["Teal300"])
button_hover_effect(prev_button, "skip-prev.svg", Theme_config.notification_center.song_info.prev_enabled,
Theme_config.notification_center.song_info.prev_hover)
button_hover_effect(pause_play_button, "play-pause.svg", Theme_config.notification_center.song_info.play_enabled,
Theme_config.notification_center.song_info.play_hover)
button_hover_effect(next_button, "skip-next.svg", Theme_config.notification_center.song_info.next_enabled,
Theme_config.notification_center.song_info.next_hover)
--#endregion
@@ -202,7 +215,7 @@ return function(s)
{
{ -- Album art
{
image = "default image",
image = icondir .. "default_image.svg",
resize = true,
clip_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(8))
@@ -223,15 +236,16 @@ return function(s)
{
{
{ --Title
halign = "center",
valign = "center",
align = "center",
widget = wibox.widget.textbox,
id = "textbox4"
},
fg = color["Pink200"],
fg = Theme_config.notification_center.song_info.title_fg,
id = "textbox5",
widget = wibox.container.background
},
id = "textbox_const",
strategy = "max",
width = dpi(400),
widget = wibox.container.constraint
@@ -250,7 +264,7 @@ return function(s)
widget = wibox.widget.textbox,
id = "textbox3"
},
fg = color["Teal200"],
fg = Theme_config.notification_center.song_info.artist_fg,
id = "background",
widget = wibox.container.background
},
@@ -301,7 +315,7 @@ return function(s)
widget = wibox.widget.textbox,
id = "textbox2"
},
fg = color["Lime200"],
fg = Theme_config.notification_center.song_info.duration_fg,
widget = wibox.container.background,
id = "background3"
},
@@ -311,8 +325,8 @@ return function(s)
},
{ -- Progressbar
{
color = color["Purple200"],
background_color = color["Grey800"],
color = Theme_config.notification_center.song_info.progress_color,
background_color = Theme_config.notification_center.song_info.progress_background_color,
max_value = 100,
value = 50,
forced_height = dpi(5),
@@ -335,7 +349,7 @@ return function(s)
id = "text1"
},
id = "background2",
fg = color["Lime200"],
fg = Theme_config.notification_center.song_info.duration_fg,
widget = wibox.container.background
},
id = "margin3",
@@ -354,11 +368,9 @@ return function(s)
margins = dpi(10)
},
id = "background1",
border_color = color["Grey800"],
border_width = dpi(4),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(8))
end,
border_color = Theme_config.notification_center.song_info.border_color,
border_width = Theme_config.notification_center.song_info.border_width,
shape = Theme_config.notification_center.song_info.shape,
widget = wibox.container.background
},
id = "margin1",
@@ -427,9 +439,12 @@ return function(s)
function(stdout2)
local length = stdout2:gsub("\n", "")
if length ~= "" then
local length_formated = string.format("%02d:%02d", math.floor(tonumber(length or 1) / 60000000) or 0, (math.floor(tonumber(length or 1) / 1000000) % 60) or 0)
music_widget:get_children_by_id("progressbar1")[1].max_value = tonumber(math.floor(tonumber(length) / 1000000))
music_widget:get_children_by_id("text1")[1].markup = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, Bold 14'>%s</span>", color["Teal200"], length_formated)
local length_formated = string.format("%02d:%02d", math.floor(tonumber(length or 1) / 60000000) or 0,
(math.floor(tonumber(length or 1) / 1000000) % 60) or 0)
music_widget:get_children_by_id("progressbar1")[1].max_value = tonumber(math.floor(tonumber(length) /
1000000))
music_widget:get_children_by_id("text1")[1].markup = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, Bold 14'>%s</span>"
, Theme_config.notification_center.song_info.duration_fg, length_formated)
end
end
)
@@ -442,7 +457,8 @@ return function(s)
end
)
-- Update track id
trackid, artist, title = stdout, music_widget:get_children_by_id("textbox3")[1].text, music_widget:get_children_by_id("textbox4")[1].text
trackid, artist, title = stdout, music_widget:get_children_by_id("textbox3")[1].text,
music_widget:get_children_by_id("textbox4")[1].text
end
)
-- Always update the current song progression
@@ -451,8 +467,10 @@ return function(s)
function(stdout)
local time = stdout:gsub("\n", "")
if time ~= "" then
local time_formated = string.format("%02d:%02d", math.floor(tonumber(time or "1") / 60), math.floor(tonumber(time or "1")) % 60)
music_widget:get_children_by_id("textbox2")[1].markup = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, Bold 14'>%s</span>", color["Teal200"], time_formated)
local time_formated = string.format("%02d:%02d", math.floor(tonumber(time or "1") / 60),
math.floor(tonumber(time or "1")) % 60)
music_widget:get_children_by_id("textbox2")[1].markup = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, Bold 14'>%s</span>"
, Theme_config.notification_center.song_info.duration_fg, time_formated)
music_widget:get_children_by_id("progressbar1")[1].value = tonumber(time)
end
end

View File

@@ -3,7 +3,6 @@
------------------------------------------------
-- Awesome Libs
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local wibox = require("wibox")
@@ -12,7 +11,7 @@ return function()
return wibox.widget {
{
forced_height = dpi(2),
bg = color["Grey800"],
bg = Theme_config.notification_center.spacing_line.color,
widget = wibox.container.background
},
left = dpi(80),

View File

@@ -4,7 +4,6 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -32,12 +31,12 @@ return function()
{
{
{ --Bar
color = color["Blue200"],
background_color = color["Grey800"],
color = Theme_config.notification_center.status_bar.cpu_usage_color,
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
max_value = 100,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
shape = function(cr)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
end,
id = "progressbar1",
@@ -56,7 +55,8 @@ return function()
},
{
{ --Icon
image = gears.color.recolor_image(icondir .. "cpu/cpu.svg", color["Cyan200"]),
image = gears.color.recolor_image(icondir .. "cpu/cpu.svg",
Theme_config.notification_center.status_bar.cpu_usage_color),
halign = "center",
valign = "center",
widget = wibox.widget.imagebox,
@@ -102,12 +102,12 @@ return function()
{
{
{ --Bar
color = color["Blue200"],
background_color = color["Grey800"],
color = Theme_config.notification_center.status_bar.cpu_temp_color,
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
max_value = 100,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
shape = function(cr)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
end,
id = "progressbar1",
@@ -127,7 +127,8 @@ return function()
{
{ --Icon
id = "icon1",
image = gears.color.recolor_image(icondir .. "cpu/thermometer.svg", color["Cyan200"]),
image = gears.color.recolor_image(icondir .. "cpu/thermometer.svg",
Theme_config.notification_center.status_bar.cpu_temp_color),
halign = "center",
valign = "center",
widget = wibox.widget.imagebox
@@ -171,7 +172,8 @@ return function()
elseif cpu_temp >= 80 then
temp_icon = icondir .. "cpu/thermometer-high.svg"
end
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(temp_icon, color["Blue200"])
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(temp_icon,
Theme_config.notification_center.status_bar.cpu_temp_color)
tooltip.text = "CPU Temp: " .. cpu_temp .. "°C"
rubato_timer.target = cpu_temp
end
@@ -181,12 +183,12 @@ return function()
{
{
{ --Bar
color = color["Red200"],
background_color = color["Grey800"],
color = Theme_config.notification_center.status_bar.ram_usage_color,
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
max_value = 100,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
shape = function(cr)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
end,
id = "progressbar1",
@@ -205,7 +207,8 @@ return function()
},
{
{ --Icon
image = gears.color.recolor_image(icondir .. "cpu/ram.svg", color["Red200"]),
image = gears.color.recolor_image(icondir .. "cpu/ram.svg",
Theme_config.notification_center.status_bar.ram_usage_color),
halign = "center",
valign = "center",
widget = wibox.widget.imagebox
@@ -239,7 +242,10 @@ return function()
awesome.connect_signal(
"update::ram_widget",
function(MemTotal, MemFree, MemAvailable)
function(MemTotal, _, MemAvailable)
if not MemTotal or not MemAvailable then
return
end
local ram_usage = math.floor(((MemTotal - MemAvailable) / MemTotal * 100) + 0.5)
tooltip.text = "RAM Usage: " .. ram_usage .. "%"
rubato_timer.target = ram_usage
@@ -250,12 +256,12 @@ return function()
{
{
{ --Bar
color = color["Green200"],
background_color = color["Grey800"],
color = Theme_config.notification_center.status_bar.gpu_usage_color,
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
max_value = 100,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
shape = function(cr)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
end,
id = "progressbar1",
@@ -274,7 +280,8 @@ return function()
},
{
{ --Icon
image = gears.color.recolor_image(icondir .. "cpu/gpu.svg", color["Green200"]),
image = gears.color.recolor_image(icondir .. "cpu/gpu.svg",
Theme_config.notification_center.status_bar.gpu_usage_color),
halign = "center",
valign = "center",
widget = wibox.widget.imagebox
@@ -318,12 +325,12 @@ return function()
{
{
{ --Bar
color = color["Green200"],
background_color = color["Grey800"],
color = Theme_config.notification_center.status_bar.gpu_temp_color,
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
max_value = 100,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
shape = function(cr)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
end,
id = "progressbar1",
@@ -343,7 +350,8 @@ return function()
{
{ --Icon
id = "icon1",
image = gears.color.recolor_image(icondir .. "cpu/thermometer.svg", color["Green200"]),
image = gears.color.recolor_image(icondir .. "cpu/thermometer.svg",
Theme_config.notification_center.status_bar.gpu_temp_color),
halign = "center",
valign = "center",
widget = wibox.widget.imagebox
@@ -395,7 +403,8 @@ return function()
temp_num = "NaN"
temp_icon = icondir .. "cpu/thermometer-low.svg"
end
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(temp_icon, color["Green200"])
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(temp_icon,
Theme_config.notification_center.status_bar.gpu_temp_color)
tooltip.text = "GPU Temp: " .. temp_num .. "°C"
rubato_timer.target = temp_num
end
@@ -405,12 +414,12 @@ return function()
{
{
{ --Bar
color = color["Yellow200"],
background_color = color["Grey800"],
color = Theme_config.notification_center.status_bar.volume_color,
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
max_value = 100,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
shape = function(cr)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
end,
id = "progressbar1",
@@ -430,7 +439,8 @@ return function()
{
{ --Icon
id = "icon1",
image = gears.color.recolor_image(icondir .. "audio/volume-high.svg", color["Yellow200"]),
image = gears.color.recolor_image(icondir .. "audio/volume-high.svg",
Theme_config.notification_center.status_bar.volume_color),
halign = "center",
valign = "center",
widget = wibox.widget.imagebox
@@ -464,10 +474,25 @@ return function()
}
awesome.connect_signal(
"update::volume_widget",
function(volume, volume_icon)
--w:get_children_by_id("progressbar1")[1].value = volume
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(volume_icon, color["Yellow200"])
"audio::get",
function(muted, volume)
local icon = icondir .. "audio/volume"
volume = tonumber(volume)
if muted then
icon = icon .. "-mute"
else
if volume < 1 then
icon = icon .. "-mute"
elseif volume >= 1 and volume < 34 then
icon = icon .. "-low"
elseif volume >= 34 and volume < 67 then
icon = icon .. "-medium"
elseif volume >= 67 then
icon = icon .. "-high"
end
end
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(icon .. ".svg",
Theme_config.notification_center.status_bar.volume_color)
tooltip.text = "Volume: " .. volume .. "%"
rubato_timer.target = volume
end
@@ -477,12 +502,12 @@ return function()
{
{
{ --Bar
color = color["Purple200"],
background_color = color["Grey800"],
color = Theme_config.notification_center.status_bar.microphone_color,
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
max_value = 100,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
shape = function(cr)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
end,
id = "progressbar1",
@@ -502,7 +527,8 @@ return function()
{
{ --Icon
id = "icon1",
image = gears.color.recolor_image(icondir .. "audio/microphone.svg", color["Purple200"]),
image = gears.color.recolor_image(icondir .. "audio/microphone.svg",
Theme_config.notification_center.status_bar.microphone_color),
halign = "center",
valign = "center",
widget = wibox.widget.imagebox
@@ -536,12 +562,17 @@ return function()
}
awesome.connect_signal(
"update::microphone_widget",
function(microphone, microphone_icon)
--w:get_children_by_id("progressbar1")[1].value = microphone
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(microphone_icon, color["Purple200"])
tooltip.text = "Microphone: " .. microphone .. "%"
rubato_timer.target = microphone
"microphone::get",
function(muted, volume)
local icon = icondir .. "audio/microphone"
volume = tonumber(volume)
if muted or (volume < 1) then
icon = icon .. "-off"
end
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(icon .. ".svg",
Theme_config.notification_center.status_bar.microphone_color)
tooltip.text = "Microphone: " .. volume .. "%"
rubato_timer.target = volume
end
)
elseif widget == "backlight" then
@@ -549,12 +580,12 @@ return function()
{
{
{ --Bar
color = color["Pink200"],
background_color = color["Grey800"],
color = Theme_config.notification_center.status_bar.backlight_color,
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
max_value = 100,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
shape = function(cr)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
end,
id = "progressbar1",
@@ -574,7 +605,8 @@ return function()
{
{ --Icon
id = "icon1",
image = gears.color.recolor_image(icondir .. "brightness/brightness-high.svg", color["Pink200"]),
image = gears.color.recolor_image(icondir .. "brightness/brightness-high.svg" .. ".svg",
Theme_config.notification_center.status_bar.backlight_color),
halign = "center",
valign = "center",
widget = wibox.widget.imagebox
@@ -610,8 +642,8 @@ return function()
awesome.connect_signal(
"update::backlight",
function(backlight, backlight_icon)
--w:get_children_by_id("progressbar1")[1].value = backlight
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(backlight_icon, color["Pink200"])
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(backlight_icon,
Theme_config.notification_center.status_bar.backlight_color)
tooltip.text = "Backlight: " .. backlight .. "%"
rubato_timer.target = backlight
end
@@ -621,12 +653,12 @@ return function()
{
{
{ --Bar
color = color["Purple200"],
background_color = color["Grey800"],
color = Theme_config.notification_center.status_bar.battery_color,
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
max_value = 100,
value = 0,
forced_height = dpi(8),
shape = function(cr, width, heigth)
shape = function(cr)
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
end,
id = "progressbar1",
@@ -646,7 +678,8 @@ return function()
{
{ --Icon
id = "icon1",
image = gears.color.recolor_image(icondir .. "battery/battery.svg", color["Purple200"]),
image = gears.color.recolor_image(icondir .. "battery/battery.svg",
Theme_config.notification_center.status_bar.battery_color),
halign = "center",
valign = "center",
widget = wibox.widget.imagebox
@@ -682,8 +715,8 @@ return function()
awesome.connect_signal(
"update::battery_widget",
function(battery, battery_icon)
--w:get_children_by_id("progressbar1")[1].value = battery
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(battery_icon, color["Purple200"])
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(battery_icon,
Theme_config.notification_center.status_bar.battery_color)
tooltip.text = "Battery: " .. battery .. "%"
rubato_timer.target = battery
end
@@ -714,11 +747,9 @@ return function()
},
forced_height = dpi(120),
forced_width = dpi(500),
border_color = color["Grey800"],
border_width = dpi(4),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(10))
end,
border_color = Theme_config.notification_center.status_bar.border_color,
border_width = Theme_config.notification_center.status_bar.border_width,
shape = Theme_config.notification_center.status_bar.shape,
widget = wibox.container.background
},
top = dpi(10),

View File

@@ -4,7 +4,6 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -66,20 +65,21 @@ return function()
widget = wibox.widget.textbox,
id = "description"
},
fg = color["LightBlue200"],
fg = Theme_config.notification_center.weather.description_fg,
widget = wibox.container.background
},
{ -- line
forced_height = dpi(4),
forced_width = dpi(10),
bg = color["Grey800"],
bg = Theme_config.notification_center.weather.line_bg,
widget = wibox.container.background,
id = "line"
},
{
{ -- Speed
{
image = gears.color.recolor_image(icondir .. "weather-windy.svg", color["OrangeA200"]),
image = gears.color.recolor_image(icondir .. "weather-windy.svg",
Theme_config.notification_center.weather.speed_icon_color),
resize = true,
forced_width = dpi(24),
forced_height = dpi(24),
@@ -111,7 +111,8 @@ return function()
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "humidity.svg", color["OrangeA200"]),
image = gears.color.recolor_image(icondir .. "humidity.svg",
Theme_config.notification_center.weather.humidity_icon_color),
id = "humidity_icon"
},
{
@@ -142,11 +143,9 @@ return function()
widget = wibox.container.place
},
id = "background",
border_color = color["Grey800"],
border_width = dpi(4),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
border_color = Theme_config.notification_center.weather.border_color,
border_width = Theme_config.notification_center.weather.border_width,
shape = Theme_config.notification_center.weather.shape,
widget = wibox.container.background
},
id = "margin",
@@ -200,7 +199,7 @@ return function()
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("line")[1].bg = color["Grey800"]
weather_widget:get_children_by_id("line")[1].bg = Theme_config.notification_center.weather.line_color
weather_widget:get_children_by_id("speed")[1].text = speed .. " m/s"
weather_widget:get_children_by_id("humidity")[1].text = humidity .. "%"

View File

@@ -76,7 +76,6 @@ 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),

View File

@@ -14,9 +14,12 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/titlebar/"
awful.titlebar.enable_tooltip = true
awful.titlebar.fallback_name = 'Client'
-- Normal AND Focus(active/inactive) have to be set or errors will appear in stdout
Theme.titlebar_close_button_normal = icondir .. "close.svg"
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
Theme.titlebar_close_button_focus = icondir .. "close.svg"
Theme.titlebar_minimize_button_normal = icondir .. "minimize.svg"
Theme.titlebar_minimize_button_focus = icondir .. "minimize.svg"
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
@@ -75,7 +78,9 @@ local create_titlebar = function(c, size)
{
{
{
awful.titlebar.widget.closebutton(c),
{
widget = awful.titlebar.widget.closebutton(c),
},
widget = wibox.container.background,
bg = Theme_config.titlebar.close_button_bg,
shape = function(cr, height, width)
@@ -84,7 +89,9 @@ local create_titlebar = function(c, size)
id = "closebutton"
},
{
awful.titlebar.widget.maximizedbutton(c),
{
widget = awful.titlebar.widget.maximizedbutton(c),
},
widget = wibox.container.background,
bg = Theme_config.titlebar.minimize_button_bg,
shape = function(cr, height, width)
@@ -93,7 +100,9 @@ local create_titlebar = function(c, size)
id = "maximizebutton"
},
{
awful.titlebar.widget.minimizebutton(c),
{
widget = awful.titlebar.widget.minimizebutton(c),
},
widget = wibox.container.background,
bg = Theme_config.titlebar.maximize_button_bg,
shape = function(cr, height, width)
@@ -115,7 +124,7 @@ local create_titlebar = function(c, size)
},
{
{
widget = awful.widget.clienticon(c)
widget = awful.titlebar.widget.iconwidget(c),
},
margins = dpi(5),
widget = wibox.container.margin
@@ -200,7 +209,7 @@ client.connect_signal(
create_titlebar(c, dpi(35))
end
if not c.floating then
if not c.floating or c.maximized or c.fullscreen then
awful.titlebar.hide(c, "left")
end
end

View File

@@ -4,7 +4,6 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -43,12 +42,10 @@ return function(s)
widget = wibox.container.margin
},
id = "background",
bg = color["Grey900"],
border_color = color["Grey800"],
border_width = dpi(2),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
bg = Theme_config.volume_controller.device_bg,
border_color = Theme_config.volume_controller.device_border_color,
border_width = Theme_config.volume_controller.device_border_width,
shape = Theme_config.volume_controller.device_shape,
widget = wibox.container.background
}
if sink == true then
@@ -66,14 +63,14 @@ return function(s)
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.bg = color["Purple200"]
device.fg = color["Grey900"]
Theme_config.volume_controller.device_headphones_selected_icon_color)
device.bg = Theme_config.volume_controller.device_headphones_selected_bg
device.fg = Theme_config.volume_controller.device_headphones_selected_fg
else
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"]
Theme_config.volume_controller.device_headphones_selected_icon_color)
device.bg = Theme_config.volume_controller.device_bg
device.fg = Theme_config.volume_controller.device_headphones_fg
end
end
)
@@ -83,20 +80,19 @@ return function(s)
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.bg = color["Purple200"]
device.fg = color["Grey900"]
Theme_config.volume_controller.device_icon_color)
device.bg = Theme_config.volume_controller.device_headphones_selected_bg
device.fg = Theme_config.volume_controller.device_headphones_selected_fg
else
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"]
Theme_config.volume_controller.device_headphones_selected_icon_color)
device.bg = Theme_config.volume_controller.device_bg
device.fg = Theme_config.volume_controller.device_headphones_fg
end
end
)
awesome.emit_signal("update::bg_sink", node)
else
device:connect_signal(
"button::press",
function()
@@ -111,14 +107,14 @@ return function(s)
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.bg = color["Blue200"]
device.fg = color["Grey900"]
Theme_config.volume_controller.device_icon_color)
device.bg = Theme_config.volume_controller.device_microphone_selected_bg
device.fg = Theme_config.volume_controller.device_microphone_selected_fg
else
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"]
Theme_config.volume_controller.device_microphone_selected_icon_color)
device.bg = Theme_config.volume_controller.device_bg
device.fg = Theme_config.volume_controller.device_microphone_fg
end
end
)
@@ -128,14 +124,14 @@ return function(s)
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.bg = color["Blue200"]
device.fg = color["Grey900"]
Theme_config.volume_controller.device_icon_color)
device.bg = Theme_config.volume_controller.device_microphone_selected_bg
device.fg = Theme_config.volume_controller.device_microphone_selected_fg
else
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"]
Theme_config.volume_controller.device_microphone_selected_icon_color)
device.bg = Theme_config.volume_controller.device_bg
device.fg = Theme_config.volume_controller.device_microphone_fg
end
end
)
@@ -165,12 +161,10 @@ return function(s)
strategy = "max",
widget = wibox.container.constraint
},
border_color = color["Grey800"],
border_width = dpi(2),
border_color = Theme_config.volume_controller.list_border_color,
border_width = Theme_config.volume_controller.list_border_width,
id = "volume_device_background",
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
shape = Theme_config.volume_controller.list_shape,
widget = wibox.container.background
},
left = dpi(10),
@@ -200,11 +194,9 @@ return function(s)
widget = wibox.container.constraint
},
id = "volume_device_background",
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, dpi(4))
end,
border_color = Theme_config.volume_controller.list_border_color,
border_width = Theme_config.volume_controller.list_border_width,
shape = Theme_config.volume_controller.list_shape,
widget = wibox.container.background
},
left = dpi(10),
@@ -222,7 +214,8 @@ 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.volume_controller.device_headphones_selected_icon_color),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
@@ -246,11 +239,9 @@ return function(s)
layout = wibox.layout.fixed.horizontal
},
id = "audio_bg",
bg = color["Grey800"],
fg = color["Purple200"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
bg = Theme_config.volume_controller.list_bg,
fg = Theme_config.volume_controller.list_headphones_fg,
shape = Theme_config.volume_controller.list_shape,
widget = wibox.container.background
},
id = "audio_selector_margin",
@@ -271,7 +262,8 @@ 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.volume_controller.device_microphone_selected_icon_color),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
@@ -295,11 +287,9 @@ return function(s)
layout = wibox.layout.fixed.horizontal
},
id = "mic_bg",
bg = color["Grey800"],
fg = color["LightBlueA200"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end,
bg = Theme_config.volume_controller.list_bg,
fg = Theme_config.volume_controller.list_microphone_fg,
shape = Theme_config.volume_controller.selector_shape,
widget = wibox.container.background
},
id = "mic_selector_margin",
@@ -321,7 +311,7 @@ return function(s)
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "volume-high.svg", color["Purple200"]),
image = gears.color.recolor_image(icondir .. "volume-high.svg", Theme_config.volume_controller.volume_fg),
id = "icon",
},
{
@@ -330,11 +320,11 @@ return function(s)
gears.shape.rounded_rect(cr, width, height, dpi(5))
end,
bar_height = dpi(5),
bar_color = color["Grey800"],
bar_active_color = color["Purple200"],
handle_color = color["Purple200"],
bar_color = Theme_config.device_border_color,
bar_active_color = Theme_config.volume_controller.volume_fg,
handle_color = Theme_config.volume_controller.volume_fg,
handle_shape = gears.shape.circle,
handle_border_color = color["Purple200"],
handle_border_color = Theme_config.volume_controller.volume_fg,
handle_width = dpi(12),
maximum = 100,
forced_height = dpi(26),
@@ -362,7 +352,7 @@ return function(s)
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
image = gears.color.recolor_image(icondir .. "microphone.svg", color["Blue200"]),
image = gears.color.recolor_image(icondir .. "microphone.svg", Theme_config.volume_controller.microphone_fg),
id = "icon"
},
{
@@ -371,11 +361,11 @@ return function(s)
gears.shape.rounded_rect(cr, width, height, dpi(5))
end,
bar_height = dpi(5),
bar_color = color["Grey800"],
bar_active_color = color["Blue200"],
handle_color = color["Blue200"],
bar_color = Theme_config.volume_controller.device_border_color,
bar_active_color = Theme_config.volume_controller.microphone_fg,
handle_color = Theme_config.volume_controller.microphone_fg,
handle_shape = gears.shape.circle,
handle_border_color = color["Blue200"],
handle_border_color = Theme_config.volume_controller.microphone_fg,
handle_width = dpi(12),
maximum = 100,
forced_height = dpi(26),
@@ -402,12 +392,10 @@ return function(s)
margins = dpi(10),
widget = wibox.container.margin
},
bg = color["Grey900"],
border_color = color["Grey800"],
border_width = dpi(4),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(12))
end,
bg = Theme_config.volume_controller.bg,
border_color = Theme_config.volume_controller.border_color,
border_width = Theme_config.volume_controller.border_width,
shape = Theme_config.volume_controller.shape,
forced_width = dpi(400),
widget = wibox.container.background
}
@@ -437,13 +425,15 @@ return function(s)
audio_bg.shape = function(cr, width, height)
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"]))
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg",
Theme_config.volume_controller.device_headphones_selected_icon_color))
else
rubato_timer.target = 0
audio_bg.shape = function(cr, width, height)
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"]))
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.volume_controller.device_headphones_selected_icon_color))
end
end
)
@@ -473,26 +463,26 @@ return function(s)
mic_selector_margin.mic_bg.shape = function(cr, width, height)
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"]))
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg",
Theme_config.volume_controller.device_microphone_selected_icon_color))
else
rubato_timer.target = 0
mic_bg.shape = function(cr, width, height)
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"]))
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.volume_controller.device_microphone_selected_icon_color))
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(
"property::value",
function()
local volume = audio_slider_margin.value
awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ " .. tonumber(volume) .. "%")
awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ " .. tonumber(audio_slider_margin.value) .. "%")
end
)
@@ -502,9 +492,7 @@ return function(s)
mic_slider_margin:connect_signal(
"property::value",
function()
local volume = mic_slider_margin.value
awful.spawn("pactl set-source-volume @DEFAULT_SOURCE@ " .. tonumber(volume) .. "%")
awesome.emit_signal("get::mic_volume", volume)
awful.spawn("pactl set-source-volume @DEFAULT_SOURCE@ " .. tonumber(mic_slider_margin.value) .. "%")
end
)
@@ -512,16 +500,14 @@ return function(s)
local volume_controller_container = awful.popup {
widget = wibox.container.background,
ontop = true,
bg = color["Grey900"],
bg = Theme_config.volume_controller.bg,
stretch = false,
visible = false,
screen = s,
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, dpi(12))
end
shape = Theme_config.volume_controller.shape,
}
-- Get all source devices
@@ -558,8 +544,6 @@ return function(s)
)
end
get_source_devices()
-- Get all input devices
local function get_input_devices()
awful.spawn.easy_async_with_shell(
@@ -595,64 +579,70 @@ return function(s)
)
end
get_input_devices()
-- Event watcher, detects when device is addes/removed
awful.spawn.with_line_callback(
[[bash -c "LC_ALL=C pactl subscribe | grep --line-buffered 'on server'"]],
{
stdout = function(line)
get_input_devices()
get_source_devices()
awful.spawn.with_shell("pkill pactl && pkill grep")
end
}
awesome.connect_signal(
"audio::device_changed",
function()
get_input_devices()
end
)
awesome.connect_signal(
"exit",
"microphone::device_changed",
function()
awful.spawn.with_shell("pkill pactl && pkill grep")
get_source_devices()
end
)
-- Set the volume and icon
awesome.connect_signal(
"audio::get",
function(muted, volume)
if muted then
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color
.recolor_image(icondir .. "volume-mute.svg", Theme_config.volume_controller.volume_fg))
else
volume = tonumber(volume)
local icon = icondir .. "volume"
if volume < 1 then
icon = icon .. "-mute"
elseif volume >= 1 and volume < 34 then
icon = icon .. "-low"
elseif volume >= 34 and volume < 67 then
icon = icon .. "-medium"
elseif volume >= 67 then
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", Theme_config.volume_controller.volume_fg))
end
end
)
-- Get microphone volume
local function get_mic_volume()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/mic.sh volume",
function(stdout)
local volume = stdout:gsub("%%", ""):gsub("\n", "")
awesome.connect_signal(
"microphone::get",
function(muted, volume)
if muted 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", Theme_config.volume_controller.microphone_fg))
else
volume = tonumber(volume)
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].mic_volume.icon:set_image(gears.color.recolor_image(icondir
.. "microphone.svg", Theme_config.volume_controller.microphone_fg))
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].mic_volume.icon:set_image(gears.color.recolor_image(icondir
.. "microphone-off.svg", Theme_config.volume_controller.microphone_fg))
end
end
)
end
get_mic_volume()
-- Check if microphone is muted
local function get_mic_mute()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/mic.sh mute",
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"]))
else
get_mic_volume()
end
end
)
end
get_mic_mute()
end
)
-- When the mouse leaves the popup it stops the mousegrabber and hides the popup.
volume_controller_container:connect_signal(
@@ -693,57 +683,6 @@ return function(s)
layout = wibox.layout.fixed.horizontal
}
-- Set the volume and icon
awesome.connect_signal(
"get::volume",
function(volume)
volume = tonumber(volume)
local icon = icondir .. "volume"
if volume < 1 then
icon = icon .. "-mute"
elseif volume >= 1 and volume < 34 then
icon = icon .. "-low"
elseif volume >= 34 and volume < 67 then
icon = icon .. "-medium"
elseif volume >= 67 then
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"]))
end
)
-- Check if the volume is muted
awesome.connect_signal(
"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"]))
end
end
)
-- Set the microphone volume
awesome.connect_signal(
"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"]))
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"]))
awesome.emit_signal("update::microphone_widget", tonumber(volume), icondir .. "microphone-off.svg")
end
end
)
-- Toggle container visibility
awesome.connect_signal(
"volume_controller::toggle",
@@ -751,7 +690,6 @@ return function(s)
if scr == s then
volume_controller_container.visible = not volume_controller_container.visible
end
end
)

View File

@@ -4,7 +4,6 @@
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -71,41 +70,33 @@ return function(s)
widget = wibox.container.background
}
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: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
)
awesome.connect_signal(
"audio::get",
function(muted, volume)
if muted 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
volume = tonumber(volume)
volume_osd_widget:get_children_by_id("progressbar1")[1].value = tonumber(volume)
local icon = icondir .. "volume"
if volume < 1 then
icon = icon .. "-mute"
elseif volume >= 1 and volume < 34 then
icon = icon .. "-low"
elseif volume >= 34 and volume < 67 then
icon = icon .. "-medium"
elseif volume >= 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
)
update_slider()
local volume_container = awful.popup {
widget = {},
@@ -138,10 +129,8 @@ return function(s)
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
)

View File

@@ -8,10 +8,6 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local naughty = require("naughty")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/window_switcher/"
return function(s)
-- Variable to check if client is selected
@@ -44,6 +40,7 @@ return function(s)
local selected = objects_sorted[1].pid
for _, object in ipairs(objects_sorted) do
local window_element = wibox.widget {
{
@@ -123,89 +120,92 @@ return function(s)
local i = 1
local sel = nil
local function select_next()
if not object.valid then
return
end
if #objects_sorted >= i then
selected = objects_sorted[i].pid
sel = selected
if selected == object.pid then
window_element.border_color = Theme_config.window_switcher.selected_border_color
window_element.fg = Theme_config.window_switcher.selected_fg
window_element.bg = Theme_config.window_switcher.selected_bg
else
window_element.border_color = Theme_config.window_switcher.border_color
window_element.fg = Theme_config.window_switcher.element_fg
window_element.bg = Theme_config.window_switcher.bg
end
end
if #objects_sorted > i then
i = i + 1
else
i = 1
end
end
local function raise()
if not object.valid then
return
end
if objects_sorted[i] then
if sel == object.pid then
if not object:isvisible() and object.first_tag then
object.first_tag:view_only()
end
object:emit_signal('request::activate')
object:raise()
end
-- Reset window switcher
i = 1
selected = objects_sorted[i].pid
sel = selected
if selected == object.pid then
window_element.border_color = Theme_config.window_switcher.selected_border_color
window_element.fg = Theme_config.window_switcher.selected_fg
window_element.bg = Theme_config.window_switcher.bg
else
window_element.border_color = Theme_config.window_switcher.border_color
window_element.fg = Theme_config.window_switcher.element_fg
window_element.bg = Theme_config.window_switcher.selected_bg
end
end
awesome.disconnect_signal(
"window_switcher::select_next",
select_next
)
awesome.disconnect_signal(
"window_switcher::raise",
raise
)
end
awesome.connect_signal(
"window_switcher::select_next",
function()
if not object.valid then
return
end
if #objects_sorted >= i then
selected = objects_sorted[i].pid
sel = selected
if selected == object.pid then
window_element.border_color = Theme_config.window_switcher.selected_border_color
window_element.fg = Theme_config.window_switcher.selected_fg
window_element.bg = Theme_config.window_switcher.selected_bg
else
window_element.border_color = Theme_config.window_switcher.border_color
window_element.fg = Theme_config.window_switcher.element_fg
window_element.bg = Theme_config.window_switcher.bg
end
end
if #objects_sorted > i then
i = i + 1
else
i = 1
end
end
)
object:connect_signal(
"unmanage",
function(c)
i = 1
objects_sorted[1] = objects_sorted[#objects_sorted]
objects_sorted[#objects_sorted] = nil
if objects_sorted[1] then
selected = objects_sorted[1].pid
end
-- remove object from table
if not object.valid then
return
end
for _, object in ipairs(objects) do
if object.pid == c.pid then
table.remove(objects, _)
break
end
end
for _, object in ipairs(objects_sorted) do
if object.pid == c.pid then
table.remove(objects_sorted, _)
break
end
end
end
select_next
)
awesome.connect_signal(
"window_switcher::raise",
function()
if not object.valid then
return
end
if objects_sorted[i] then
if sel == object.pid then
if not object:isvisible() and object.first_tag then
object.first_tag:view_only()
end
object:emit_signal('request::activate')
object:raise()
end
raise
)
-- Reset window switcher
object:connect_signal(
"unmanage",
function(c)
if object.valid then
i = 1
selected = objects_sorted[i].pid
sel = selected
if selected == object.pid then
window_element.border_color = Theme_config.window_switcher.selected_border_color
window_element.fg = Theme_config.window_switcher.selected_fg
window_element.bg = Theme_config.window_switcher.bg
else
window_element.border_color = Theme_config.window_switcher.border_color
window_element.fg = Theme_config.window_switcher.element_fg
window_element.bg = Theme_config.window_switcher.selected_bg
objects_sorted[1] = objects_sorted[#objects_sorted]
objects_sorted[#objects_sorted] = nil
for _, obj in ipairs(objects_sorted) do
if obj.valid then
if obj.pid == c.pid then
table.remove(objects_sorted, _)
break
end
end
end
end
end
@@ -288,7 +288,9 @@ return function(s)
awesome.connect_signal(
"toggle_window_switcher",
function()
window_switcher_container.visible = not window_switcher_container.visible
if mouse.screen == s then
window_switcher_container.visible = not window_switcher_container.visible
end
end
)