From ff202de163d3aeab46cfbd23590adb15b3ea40ed Mon Sep 17 00:00:00 2001 From: Kievits Rene Date: Wed, 25 May 2022 11:27:03 +0200 Subject: [PATCH] fix #10 and #13. Various other fixes and small changes --- awesome/crylia_bar/dock.lua | 83 +-- .../notifications/notification-outline.svg | 1 + .../icons/notifications/notification.svg | 1 + awesome/src/assets/rules.txt | 2 +- awesome/src/core/notifications.lua | 597 ++++++++++-------- awesome/src/core/signals.lua | 140 ++-- .../src/modules/notification-center/init.lua | 0 awesome/src/modules/powermenu.lua | 95 +-- awesome/src/modules/titlebar.lua | 114 ++-- awesome/src/modules/volume_controller.lua | 390 +++++++----- awesome/src/scripts/pfp.sh | 48 ++ awesome/src/tools/icon_handler.lua | 4 +- awesome/src/widgets/audio.lua | 72 ++- awesome/src/widgets/battery.lua | 165 ++--- awesome/src/widgets/bluetooth.lua | 74 +-- awesome/src/widgets/clock.lua | 20 +- awesome/src/widgets/cpu_info.lua | 90 +-- awesome/src/widgets/date.lua | 10 +- awesome/src/widgets/gpu_info.lua | 42 +- awesome/src/widgets/kblayout.lua | 142 ++--- awesome/src/widgets/layout_list.lua | 6 +- awesome/src/widgets/network.lua | 122 ++-- awesome/src/widgets/power.lua | 6 +- awesome/src/widgets/ram_info.lua | 8 +- awesome/src/widgets/systray.lua | 2 +- awesome/src/widgets/taglist.lua | 156 ++--- awesome/src/widgets/tasklist.lua | 88 +-- picom.conf | 466 +++++++++++--- 28 files changed, 1664 insertions(+), 1280 deletions(-) create mode 100644 awesome/src/assets/icons/notifications/notification-outline.svg create mode 100644 awesome/src/assets/icons/notifications/notification.svg create mode 100644 awesome/src/modules/notification-center/init.lua create mode 100755 awesome/src/scripts/pfp.sh diff --git a/awesome/crylia_bar/dock.lua b/awesome/crylia_bar/dock.lua index 498e90a..934ea03 100644 --- a/awesome/crylia_bar/dock.lua +++ b/awesome/crylia_bar/dock.lua @@ -44,7 +44,7 @@ return function(screen, programs) widget = wibox.container.margin } - for k, c in ipairs(client.get()) do + for _, c in ipairs(client.get()) do if string.lower(c.class):match(program) and c == client.focus then dock_element.background.bg = color["Grey800"] end @@ -55,12 +55,12 @@ 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) + if is_steam then + awful.spawn("steam steam://rungameid/" .. program) + else + awful.spawn(program) + end end - end ) awful.tooltip { @@ -181,13 +181,20 @@ return function(screen, programs) } local function check_for_dock_hide(s) + for _, client in ipairs(s.selected_tag:clients()) do + if client.fullscreen then + dock.visible = false + fakedock.visible = false + else + fakedock.visible = true + end + end if #s.selected_tag:clients() < 1 then dock.visible = true return end if s == mouse.screen then - local visible = false - for j, c in ipairs(s.selected_tag:clients()) do + for _, c in ipairs(s.selected_tag:clients()) do if c.maximized or c.fullscreen then dock.visible = false @@ -219,63 +226,63 @@ return function(screen, programs) fakedock:connect_signal( "mouse::enter", function() - for index, c in ipairs(screen.clients) do - if not c.fullscreen then - dock_intelligent_hide:stop() - dock.visible = true + for _, c in ipairs(screen.clients) do + if not c.fullscreen then + dock_intelligent_hide:stop() + dock.visible = true + end end end - end ) client.connect_signal( "manage", function() - check_for_dock_hide(screen) - dock:setup { - dock_elements, - create_incicator_widget(programs), - layout = wibox.layout.fixed.vertical - } - end + check_for_dock_hide(screen) + dock:setup { + dock_elements, + create_incicator_widget(programs), + layout = wibox.layout.fixed.vertical + } + end ) client.connect_signal( "unmanage", function() - check_for_dock_hide(screen) - dock:setup { - dock_elements, - create_incicator_widget(programs), - layout = wibox.layout.fixed.vertical - } - end + check_for_dock_hide(screen) + dock:setup { + dock_elements, + create_incicator_widget(programs), + layout = wibox.layout.fixed.vertical + } + end ) client.connect_signal( "focus", function() - check_for_dock_hide(screen) - dock:setup { - dock_elements, - create_incicator_widget(programs), - layout = wibox.layout.fixed.vertical - } - end + check_for_dock_hide(screen) + dock:setup { + dock_elements, + create_incicator_widget(programs), + layout = wibox.layout.fixed.vertical + } + end ) dock:connect_signal( "mouse::enter", function() - dock_intelligent_hide:stop() - end + dock_intelligent_hide:stop() + end ) dock:connect_signal( "mouse::leave", function() - dock_intelligent_hide:again() - end + dock_intelligent_hide:again() + end ) dock:setup { diff --git a/awesome/src/assets/icons/notifications/notification-outline.svg b/awesome/src/assets/icons/notifications/notification-outline.svg new file mode 100644 index 0000000..b00e8ce --- /dev/null +++ b/awesome/src/assets/icons/notifications/notification-outline.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/awesome/src/assets/icons/notifications/notification.svg b/awesome/src/assets/icons/notifications/notification.svg new file mode 100644 index 0000000..59eb5a1 --- /dev/null +++ b/awesome/src/assets/icons/notifications/notification.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/awesome/src/assets/rules.txt b/awesome/src/assets/rules.txt index 9dba10f..9f2298f 100644 --- a/awesome/src/assets/rules.txt +++ b/awesome/src/assets/rules.txt @@ -1 +1 @@ -Lutris;Steam;Io.elementary.appcenter;Repoman;Com.github.donadigo.eddy;Sysmontask;join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=Gnome-calculator;Virt-manager;Gwe;whatsdesk;Totem; \ No newline at end of file +Lutris;Steam;Io.elementary.appcenter;Repoman;Com.github.donadigo.eddy;Sysmontask;join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=Gnome-calculator;Virt-manager;Gwe;whatsdesk;Totem;steam_app_431960; \ No newline at end of file diff --git a/awesome/src/core/notifications.lua b/awesome/src/core/notifications.lua index 4781b54..0547267 100644 --- a/awesome/src/core/notifications.lua +++ b/awesome/src/core/notifications.lua @@ -1,7 +1,6 @@ ------------------------------- -- The Notification defaults -- ------------------------------- - -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") @@ -14,7 +13,6 @@ local wibox = require("wibox") local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/" -- TODO: Figure out how to use hover effects without messing up the actions - naughty.config.defaults.ontop = true naughty.config.defaults.icon_size = dpi(80) naughty.config.defaults.timeout = 3 @@ -31,334 +29,383 @@ naughty.config.defaults.spacing = dpi(10) naughty.connect_signal( 'request::icon', function(n, context, hints) - if context ~= 'app_icon' then return end - local path = menubar.utils.lookup_icon(hints.app_icon) or - menubar.utils.lookup_icon(hints.app_icon:lower()) - if path then - n.icon = path + if context ~= 'app_icon' then + return + end + local path = menubar.utils.lookup_icon(hints.app_icon) or menubar.utils.lookup_icon(hints.app_icon:lower()) + if path then + n.icon = path + end end -end ) naughty.connect_signal( "request::display", function(n) + if n.urgency == "critical" then + n.title = string.format("%s", + color["RedA200"], n.title) or "" + n.message = string.format("%s", color["Red200"], n.message) or "" + n.app_name = string.format("%s", color["RedA400"], n.app_name) or "" + n.bg = color["Grey900"] + else + n.title = string.format("%s", + color["Pink200"], n.title) or "" + n.message = string.format("%s", "#ffffffaa", n.message) or "" + n.bg = color["Grey900"] + n.timeout = n.timeout or 3 + end - if n.urgency == "critical" then - n.title = string.format("%s", color["RedA200"], n.title) or "" - n.message = string.format("%s", color["Red200"], n.message) or "" - n.app_name = string.format("%s", color["RedA400"], n.app_name) or "" - n.bg = color["Grey900"] - else - n.title = string.format("%s", color["Pink200"], n.title) or "" - n.message = string.format("%s", "#ffffffaa", n.message) or "" - n.bg = color["Grey900"] - n.timeout = n.timeout or 3 - end + local use_image = false - local use_image = false - - if n.app_name == "Spotify" then - n.actions = { - naughty.action { + if n.app_name == "Spotify" then + n.actions = { naughty.action { program = "Spotify", id = "skip-prev", - icon = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Cyan200"]), - }, - naughty.action { + icon = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Cyan200"]) + }, naughty.action { program = "Spotify", id = "play-pause", - icon = gears.color.recolor_image(icondir .. "play-pause.svg", color["Cyan200"]), - }, - naughty.action { + icon = gears.color.recolor_image(icondir .. "play-pause.svg", color["Cyan200"]) + }, naughty.action { program = "Spotify", id = "skip-next", - icon = gears.color.recolor_image(icondir .. "skip-next.svg", color["Cyan200"]), - }, - } - use_image = true - end + icon = gears.color.recolor_image(icondir .. "skip-next.svg", color["Cyan200"]) + } } + use_image = true + end - local action_template_widget = {} + local action_template_widget = {} - if use_image then - action_template_widget = { - { - { - { - { - id = "icon_role", - widget = wibox.widget.imagebox - }, - id = "centered", - valign = "center", - halign = "center", - widget = wibox.container.place - }, - margins = dpi(5), - widget = wibox.container.margin - }, - forced_height = dpi(35), - forced_width = dpi(35), - fg = color["Cyan200"], - bg = color["Grey800"], - shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, dpi(6)) - end, - widget = wibox.container.background, - id = "bgrnd" - }, - id = "mrgn", - top = dpi(10), - bottom = dpi(10), - widget = wibox.container.margin, - } - else - action_template_widget = { - { - { - { - { - id = "text_role", - font = "JetBrainsMono Nerd Font, Regular 12", - widget = wibox.widget.textbox - }, - id = "centered", - widget = wibox.container.place - }, - margins = dpi(5), - widget = wibox.container.margin - }, - fg = color["Green200"], - bg = color["Grey800"], - shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, dpi(6)) - end, - widget = wibox.container.background, - id = "bgrnd" - }, - id = "mrgn", - top = dpi(10), - bottom = dpi(10), - widget = wibox.container.margin, - } - end - - local actions_template = wibox.widget { - notification = n, - base_layout = wibox.widget { - spacing = dpi(40), - layout = wibox.layout.fixed.horizontal - }, - widget_template = action_template_widget, - style = { - underline_normal = false, - underline_selected = true, - bg_normal = color["Grey100"], - bg_selected = color["Grey200"] - }, - widget = naughty.list.actions - } - - local w_template = wibox.widget { - { - { + if use_image then + action_template_widget = { { { { { - { - { - markup = n.app_name or 'System Notification', - align = "center", - valign = "center", - widget = wibox.widget.textbox - }, - fg = color["Teal200"], - widget = wibox.container.background - }, - margins = dpi(10), - widget = wibox.container.margin + id = "icon_role", + widget = wibox.widget.imagebox }, - nil, + id = "centered", + valign = "center", + halign = "center", + widget = wibox.container.place + }, + margins = dpi(5), + widget = wibox.container.margin + }, + forced_height = dpi(35), + forced_width = dpi(35), + fg = color["Cyan200"], + bg = color["Grey800"], + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, dpi(6)) + end, + widget = wibox.container.background, + id = "bgrnd" + }, + id = "mrgn", + top = dpi(10), + bottom = dpi(10), + widget = wibox.container.margin + } + else + action_template_widget = { + { + { + { + { + id = "text_role", + font = "JetBrainsMono Nerd Font, Regular 12", + widget = wibox.widget.textbox + }, + id = "centered", + widget = wibox.container.place + }, + margins = dpi(5), + widget = wibox.container.margin + }, + fg = color["Green200"], + bg = color["Grey800"], + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, dpi(6)) + end, + widget = wibox.container.background, + id = "bgrnd" + }, + id = "mrgn", + top = dpi(10), + bottom = dpi(10), + widget = wibox.container.margin + } + end + + local actions_template = wibox.widget { + notification = n, + base_layout = wibox.widget { + spacing = dpi(40), + layout = wibox.layout.fixed.horizontal + }, + widget_template = action_template_widget, + style = { + underline_normal = false, + underline_selected = true, + bg_normal = color["Grey100"], + bg_selected = color["Grey200"] + }, + widget = naughty.list.actions + } + + local w_template = wibox.widget { + { + { + { + { { { { { { - font = user_vars.font.specify .. ", 10", - text = "✕", + { + image = gears.color.recolor_image(icondir .. "notification-outline.svg", color["Teal200"]), + resize = false, + widget = wibox.widget.imagebox + }, + right = dpi(5), + widget = wibox.container.margin + }, + { + markup = n.app_name or 'System Notification', align = "center", valign = "center", widget = wibox.widget.textbox }, - start_angle = 4.71239, - thickness = dpi(2), - min_value = 0, - max_value = 360, - value = 360, - widget = wibox.container.arcchart, - id = "arc_chart" + layout = wibox.layout.fixed.horizontal + }, + fg = color["Teal200"], + widget = wibox.container.background + }, + margins = dpi(10), + widget = wibox.container.margin + }, + nil, + { + { + { + text = os.date("%H:%M"), + widget = wibox.widget.textbox }, id = "background", fg = color["Teal200"], - bg = color["Grey900"], widget = wibox.container.background }, - strategy = "exact", - width = dpi(20), - height = dpi(20), - widget = wibox.container.constraint, - id = "const" + { + { + { + { + { + font = user_vars.font.specify .. ", 10", + text = "✕", + align = "center", + valign = "center", + widget = wibox.widget.textbox + }, + start_angle = 4.71239, + thickness = dpi(2), + min_value = 0, + max_value = 360, + value = 360, + widget = wibox.container.arcchart, + id = "arc_chart" + }, + id = "background", + fg = color["Teal200"], + bg = color["Grey900"], + widget = wibox.container.background + }, + strategy = "exact", + width = dpi(20), + height = dpi(20), + widget = wibox.container.constraint, + id = "const" + }, + margins = dpi(10), + widget = wibox.container.margin, + id = "arc_margin" + }, + layout = wibox.layout.fixed.horizontal, + id = "arc_app_layout_2" }, - margins = dpi(10), - widget = wibox.container.margin, - id = "arc_margin" + id = "arc_app_layout", + layout = wibox.layout.align.horizontal }, - id = "arc_app_layout", - layout = wibox.layout.align.horizontal + id = "arc_app_bg", + border_color = color["Grey800"], + border_width = dpi(2), + widget = wibox.container.background }, - id = "arc_app_bg", - border_color = color["Grey800"], - border_width = dpi(2), - widget = wibox.container.background - }, - { { { { { - image = n.icon, - resize = true, - widget = wibox.widget.imagebox, - clip_shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 10) - end, + { + image = n.icon, + resize = true, + widget = wibox.widget.imagebox, + clip_shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, 10) + end + }, + width = naughty.config.defaults.icon_size, + height = naughty.config.defaults.icon_size, + strategy = "exact", + widget = wibox.container.constraint }, - width = naughty.config.defaults.icon_size, - height = naughty.config.defaults.icon_size, - strategy = "exact", - widget = wibox.container.constraint - }, - halign = "center", - valign = "top", - widget = wibox.container.place, - }, - left = dpi(20), - bottom = dpi(15), - top = dpi(15), - right = dpi(10), - widget = wibox.container.margin - }, - { - { - { - widget = naughty.widget.title, - align = "left" - }, - { - widget = naughty.widget.message, - align = "left" - }, - { - actions_template, + halign = "center", + valign = "top", widget = wibox.container.place }, - layout = wibox.layout.fixed.vertical + left = dpi(20), + bottom = dpi(15), + top = dpi(15), + right = dpi(10), + widget = wibox.container.margin }, - left = dpi(10), - bottom = dpi(10), - top = dpi(10), - right = dpi(20), - widget = wibox.container.margin + { + { + { + widget = naughty.widget.title, + align = "left" + }, + { + widget = naughty.widget.message, + align = "left" + }, + { + actions_template, + widget = wibox.container.place + }, + layout = wibox.layout.fixed.vertical + }, + left = dpi(10), + bottom = dpi(10), + top = dpi(10), + right = dpi(20), + widget = wibox.container.margin + }, + layout = wibox.layout.fixed.horizontal }, - layout = wibox.layout.fixed.horizontal + id = "widget_layout", + layout = wibox.layout.fixed.vertical }, - id = "widget_layout", - layout = wibox.layout.fixed.vertical + id = "min_size", + strategy = "min", + width = dpi(100), + widget = wibox.container.constraint }, - id = "min_size", - strategy = "min", - width = dpi(100), + id = "max_size", + strategy = "max", + width = Theme.notification_max_width or dpi(500), widget = wibox.container.constraint }, - id = "max_size", - strategy = "max", - width = Theme.notification_max_width or dpi(500), - widget = wibox.container.constraint, - }, - id = "background", - bg = color["Grey900"], - border_color = color["Grey800"], - border_width = dpi(4), - shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 4) - end, - widget = wibox.container.background - } - - local close = w_template.max_size.min_size.widget_layout.arc_app_bg.arc_app_layout.arc_margin.const.background - local arc = close.arc_chart - - local timeout = n.timeout - local remove_time = timeout - - if timeout ~= 0 then - arc.value = 360 - gears.timer { - timeout = 0.1, - call_now = true, - autostart = true, - callback = function() - arc.value = (remove_time - 0) / (timeout - 0) * 360 - remove_time = remove_time - 0.1 - end + id = "background", + bg = color["Grey900"], + border_color = color["Grey800"], + border_width = dpi(4), + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, 4) + end, + widget = wibox.container.background } - end - Hover_signal(close, color["Grey900"], color["Teal200"]) + local close = w_template.max_size.min_size.widget_layout.arc_app_bg.arc_app_layout.arc_app_layout_2.arc_margin.const.background + local arc = close.arc_chart - close:connect_signal( - "button::press", - function() - n:destroy() - end - ) + local timeout = n.timeout + local remove_time = timeout - w_template:connect_signal( - "button::press", - function(c, d, e, key) - if key == 3 then - n:destroy() + if timeout ~= 0 then + arc.value = 360 + local arc_timer = gears.timer { + timeout = 0.1, + call_now = true, + autostart = true, + callback = function() + arc.value = (remove_time - 0) / (timeout - 0) * 360 + remove_time = remove_time - 0.1 + end + } + + w_template:connect_signal( + "mouse::enter", + function() + -- Setting to 0 doesn't work + arc_timer:stop() + n.timeout = 99999 + end + ) + + w_template:connect_signal( + "mouse::leave", + function() + arc_timer:start() + n.timeout = remove_time + end + ) end + + Hover_signal(close, color["Grey900"], color["Teal200"]) + + close:connect_signal( + "button::press", + function() + n:destroy() + end + ) + + w_template:connect_signal( + "button::press", + function(c, d, e, key) + if key == 3 then + n:destroy() + end + -- TODO: Find out how to get the associated client + --[[ if key == 1 then + if n.clients then + n.clients[1]:activate { + switch_to_tag = true, + raise = true + } + end + end ]] + end + ) + + local box = naughty.layout.box { + notification = n, + timeout = 3, + type = "notification", + screen = awful.screen.focused(), + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, 10) + end, + widget_template = w_template + } + + box.buttons = {} + n.buttons = {} end - ) - - local box = naughty.layout.box { - notification = n, - timeout = 3, - type = "notification", - screen = awful.screen.focused(), - shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 10) - end, - widget_template = w_template - } - - box.buttons = {} - n.buttons = {} -end ) naughty.connect_signal( "destroyed", function() -end + end ) -- Test notification ---[[ naughty.notification { +naughty.notification { app_name = "System Notification", title = "A notification 2", message = "This is very informative and overflowing", @@ -376,21 +423,21 @@ end name = "Ignore", }, } -} ]] +} naughty.connect_signal( "invoked", function(_, action) - if action.program == "Spotify" then - if action.id == "skip-prev" then - awful.spawn("playerctl previous") - end - if action.id == "play-pause" then - awful.spawn("playerctl play-pause") - end - if action.id == "skip-next" then - awful.spawn("playerctl next") + if action.program == "Spotify" then + if action.id == "skip-prev" then + awful.spawn("playerctl previous") + end + if action.id == "play-pause" then + awful.spawn("playerctl play-pause") + end + if action.id == "skip-next" then + awful.spawn("playerctl next") + end end end -end ) diff --git a/awesome/src/core/signals.lua b/awesome/src/core/signals.lua index aead15f..002291d 100644 --- a/awesome/src/core/signals.lua +++ b/awesome/src/core/signals.lua @@ -1,89 +1,108 @@ +---@diagnostic disable: undefined-field -- Awesome Libs local awful = require("awful") local beautiful = require("beautiful") local gears = require("gears") +local wibox = require("wibox") screen.connect_signal( "added", function() - awesome.restart() -end + awesome.restart() + end ) screen.connect_signal( "removed", function() - awesome.restart() -end + awesome.restart() + end ) client.connect_signal( "manage", function(c) - if awesome.startup and not c.size_hints.user_porition and not c.size_hints.program_position then - awful.placement.no_offscreen(c) - end - c.shape = function(cr, width, height) - if c.fullscreen or c.maximized then - gears.shape.rectangle(cr, width, height) - else - gears.shape.rounded_rect(cr, width, height, 10) + if awesome.startup and not c.size_hints.user_porition and not c.size_hints.program_position then + awful.placement.no_offscreen(c) + end + c.shape = function(cr, width, height) + if c.fullscreen or c.maximized then + gears.shape.rectangle(cr, width, height) + else + gears.shape.rounded_rect(cr, width, height, 10) + end end end -end ) client.connect_signal( 'unmanage', function(c) - if #awful.screen.focused().clients > 0 then - awful.screen.focused().clients[1]:emit_signal( - 'request::activate', - 'mouse_enter', - { - raise = true - } - ) + if #awful.screen.focused().clients > 0 then + awful.screen.focused().clients[1]:emit_signal( + 'request::activate', + 'mouse_enter', + { + raise = true + } + ) + end end -end ) client.connect_signal( 'tag::switched', function(c) - if #awful.screen.focused().clients > 0 then - awful.screen.focused().clients[1]:emit_signal( - 'request::activate', - 'mouse_enter', - { - raise = true - } - ) + if #awful.screen.focused().clients > 0 then + awful.screen.focused().clients[1]:emit_signal( + 'request::activate', + 'mouse_enter', + { + raise = true + } + ) + end end -end ) - -- Sloppy focus -client.connect_signal("mouse::enter", function(c) - c:emit_signal("request::activate", "mouse_enter", { raise = false }) -end) +client.connect_signal( + "mouse::enter", + function(c) + c:emit_signal( + "request::activate", + "mouse_enter", + { + raise = false + } + ) + end +) -- Workaround for focused border color, why in the love of god doesnt it work with -- beautiful.border_focus -client.connect_signal("focus", function(c) - c.border_color = "#616161" -end) +client.connect_signal( + "focus", + function(c) + c.border_color = "#616161" + end +) -client.connect_signal("unfocus", function(c) - c.border_color = beautiful.border_normal -end) +client.connect_signal( + "unfocus", + function(c) + c.border_color = beautiful.border_normal + end +) +--- Takes a wibox.container.background and connects four signals to it +---@param widget widget.container.background +---@param bg string +---@param fg string function Hover_signal(widget, bg, fg) local old_wibox, old_cursor, old_bg, old_fg - widget:connect_signal( - "mouse::enter", - function() + + local mouse_enter = function() if bg then old_bg = widget.bg if string.len(bg) == 7 then @@ -102,11 +121,8 @@ function Hover_signal(widget, bg, fg) w.cursor = "hand1" end end - ) - widget:connect_signal( - "button::press", - function() + local button_press = function() if bg then if bg then if string.len(bg) == 7 then @@ -120,11 +136,8 @@ function Hover_signal(widget, bg, fg) widget.fg = fg end end - ) - widget:connect_signal( - "button::release", - function() + local button_release = function() if bg then if bg then if string.len(bg) == 7 then @@ -138,11 +151,8 @@ function Hover_signal(widget, bg, fg) widget.fg = fg end end - ) - widget:connect_signal( - "mouse::leave", - function() + local mouse_leave = function() if bg then widget.bg = old_bg end @@ -154,5 +164,21 @@ function Hover_signal(widget, bg, fg) old_wibox = nil end end - ) + + widget:disconnect_signal("mouse::enter", mouse_enter) + + widget:disconnect_signal("button::press", button_press) + + widget:disconnect_signal("button::release", button_release) + + widget:disconnect_signal("mouse::leave", mouse_leave) + + widget:connect_signal("mouse::enter", mouse_enter) + + widget:connect_signal("button::press", button_press) + + widget:connect_signal("button::release", button_release) + + widget:connect_signal("mouse::leave", mouse_leave) + end diff --git a/awesome/src/modules/notification-center/init.lua b/awesome/src/modules/notification-center/init.lua new file mode 100644 index 0000000..e69de29 diff --git a/awesome/src/modules/powermenu.lua b/awesome/src/modules/powermenu.lua index 4023df2..90cff4f 100644 --- a/awesome/src/modules/powermenu.lua +++ b/awesome/src/modules/powermenu.lua @@ -40,67 +40,28 @@ return function(s) -- TODO: If the user doesnt have AccountsService look into $HOME/.faces local update_profile_picture = function() awful.spawn.easy_async_with_shell( - [=[ - iconPath="/var/lib/AccountsService/icons/${USER}" - userIconPath="${HOME}/.config/awesome/src/assets/userpfp/" - if [[ -f "${userIconPath}" ]]; - then - if [[ -f "${iconPath}" ]]; - then - if ! cmp --silent "${userIconPath}.png" "${iconPath}"; - then - cp "${iconPath}" "${userIconPath}${USER}.png" - fi - printf "${userIconPath}.png" - else - printf "${userIconPath}.png" - fi - exit; - else - if [[ -f "${iconPath}" ]]; - then - cp "${iconPath}" "${userIconPath}${USER}.png" - printf "${userIconPath}${USER}.png" - exit; - fi - fi - ]=], + "./.config/awesome/src/scripts/pfp.sh 'userPfp'", function(stdout) - if stdout then - profile_picture:set_image(stdout:gsub("\n", "")) - else - profile_picture:set_image(icondir .. "defaultpfp.svg") + if stdout then + profile_picture:set_image(stdout:gsub("\n", "")) + else + profile_picture:set_image(icondir .. "defaultpfp.svg") + end end - end ) end update_profile_picture() - -- Will determin the display style - local namestyle = user_vars.namestyle -- Get the full username(if set) and the username + hostname local update_user_name = function() awful.spawn.easy_async_with_shell( - [=[ - fullname="$(getent passwd `whoami` | cut -d ':' -f 5)" - user="$(whoami)" - host="$(hostname)" - if [[ "]=] .. namestyle .. [=[" == "userhost" ]]; - then - printf "$user@$host" - elif [[ "]=] .. namestyle .. [=[" == "fullname" ]]; - then - printf "$fullname" - else - printf "Rick Astley" - fi - ]=], + "./.config/awesome/src/scripts/pfp.sh 'userName' '" .. user_vars.namestyle .. "'", function(stdout) - if stdout:gsub("\n", "") == "Rick Astley" then - profile_picture:set_image(awful.util.getdir("config") .. "src/assets/userpfp/" .. "rickastley.jpg") + if stdout:gsub("\n", "") == "Rick Astley" then + profile_picture:set_image(awful.util.getdir("config") .. "src/assets/userpfp/" .. "rickastley.jpg") + end + profile_name:set_text(stdout) end - profile_name:set_text(stdout) - end ) end update_user_name() @@ -154,8 +115,8 @@ return function(s) item:connect_signal( "button::release", function() - callback() - end + callback() + end ) return item @@ -163,7 +124,7 @@ return function(s) -- Create the power menu actions local suspend_command = function() - awful.spawn("dm-tool lock & systemctl suspend") + awful.spawn("systemctl suspend") awesome.emit_signal("module::powermenu:hide") end @@ -194,11 +155,11 @@ return function(s) local lock_button = button("Lock", icondir .. "lock.svg", color["Orange200"], lock_command) -- Signals to change color on hover - Hover_signal(shutdown_button.background, color["Blue200"]) - Hover_signal(reboot_button.background, color["Red200"]) - Hover_signal(suspend_button.background, color["Yellow200"]) - Hover_signal(logout_button.background, color["Green200"]) - Hover_signal(lock_button.background, color["Orange200"]) + 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"]) -- The powermenu widget local powermenu = wibox.widget { @@ -283,8 +244,8 @@ return function(s) {}, 3, function() - awesome.emit_signal("module::powermenu:hide") - end + awesome.emit_signal("module::powermenu:hide") + end ) ) ) @@ -304,18 +265,18 @@ return function(s) awesome.connect_signal( "module::powermenu:show", function() - if s == mouse.screen then - powermenu_container.visible = true - powermenu_keygrabber:start() + if s == mouse.screen then + powermenu_container.visible = true + powermenu_keygrabber:start() + end end - end ) awesome.connect_signal( "module::powermenu:hide", function() - powermenu_keygrabber:stop() - powermenu_container.visible = false - end + powermenu_keygrabber:stop() + powermenu_container.visible = false + end ) end diff --git a/awesome/src/modules/titlebar.lua b/awesome/src/modules/titlebar.lua index ad4e401..2f58d3d 100644 --- a/awesome/src/modules/titlebar.lua +++ b/awesome/src/modules/titlebar.lua @@ -26,9 +26,9 @@ local double_click_event_handler = function(double_click_event) double_click_timer = gears.timer.start_new( 0.20, function() - double_click_timer = nil - return false - end + double_click_timer = nil + return false + end ) end @@ -38,23 +38,23 @@ local create_click_events = function(c) {}, 1, function() - double_click_event_handler(function() - if c.floating then - c.float = false - return - end - c.maximized = not c.maximized - c:raise() - end) - c:activate { context = 'titlebar', action = 'mouse_move' } - end + double_click_event_handler(function() + if c.floating then + c.float = false + return + end + c.maximized = not c.maximized + c:raise() + end) + c:activate { context = 'titlebar', action = 'mouse_move' } + end ), awful.button( {}, 3, function() - c:activate { context = 'titlebar', action = 'mouse_resize' } - end + c:activate { context = 'titlebar', action = 'mouse_resize' } + end ) ) return buttons @@ -119,9 +119,9 @@ local create_titlebar = function(c, bg, size) layout = wibox.layout.align.vertical, id = "main" } - Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"]) - Hover_signal(titlebar.main.margin.spacing.maximizebutton, color["Yellow200"]) - Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"]) + 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"]) end local create_titlebar_dialog = function(c, bg, size) @@ -174,8 +174,8 @@ local create_titlebar_dialog = function(c, bg, size) layout = wibox.layout.align.vertical, id = "main" } - Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"]) - Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"]) + Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"], color["Grey900"]) + Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"], color["Grey900"]) end local draw_titlebar = function(c) @@ -199,54 +199,54 @@ 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" + 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 -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.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) + 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') + end 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') - end -end ) client.connect_signal( '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') - else - awful.titlebar.hide(c, 'left') - awful.titlebar.hide(c, 'right') - awful.titlebar.hide(c, 'top') - awful.titlebar.hide(c, 'bottom') + 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') + else + awful.titlebar.hide(c, 'left') + awful.titlebar.hide(c, 'right') + awful.titlebar.hide(c, 'top') + awful.titlebar.hide(c, 'bottom') + end end -end ) diff --git a/awesome/src/modules/volume_controller.lua b/awesome/src/modules/volume_controller.lua index dbce44e..a2b7cdb 100644 --- a/awesome/src/modules/volume_controller.lua +++ b/awesome/src/modules/volume_controller.lua @@ -7,6 +7,7 @@ local awful = require("awful") local color = require("src.theme.colors") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") +local naughty = require("naughty") local wibox = require("wibox") require("src.core.signals") @@ -16,6 +17,7 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/" -- Returns the volume controller return function(s) + -- Function to create source/sink devices local function create_device(name, node, sink) local device = wibox.widget { { @@ -53,10 +55,10 @@ return function(s) device:connect_signal( "button::press", function() - awful.spawn.spawn("./.config/awesome/src/scripts/vol.sh set_sink " .. node) + awful.spawn.spawn("./.config/awesome/src/scripts/vol.sh set_sink " .. node) - awesome.emit_signal("update::background:vol", node) - end + awesome.emit_signal("update::background:vol", node) + end ) --#region Signal Functions @@ -146,47 +148,47 @@ return function(s) awesome.connect_signal( "update::background:vol", function(new_node) - if node == new_node then - old_bg = color["Purple200"] - old_fg = color["Grey900"] - bg = color["Purple200"] - fg = color["Grey900"] - device.background:set_bg(color["Purple200"]) - device.background:set_fg(color["Grey900"]) - else - fg = color["Purple200"] - bg = color["Grey700"] - device.background:set_fg(color["Purple200"]) - device.background:set_bg(color["Grey700"]) + if node == new_node then + old_bg = color["Purple200"] + old_fg = color["Grey900"] + bg = color["Purple200"] + fg = color["Grey900"] + device.background:set_bg(color["Purple200"]) + device.background:set_fg(color["Grey900"]) + else + fg = color["Purple200"] + bg = color["Grey700"] + device.background:set_fg(color["Purple200"]) + device.background:set_bg(color["Grey700"]) + end end - end ) awful.spawn.easy_async_with_shell( [[ pactl get-default-sink ]], function(stdout) - local node_active = stdout:gsub("\n", "") - if node == node_active then - bg = color["Purple200"] - fg = color["Grey900"] - device.background:set_bg(color["Purple200"]) - device.background:set_fg(color["Grey900"]) - else - fg = color["Purple200"] - bg = color["Grey700"] - device.background:set_fg(color["Purple200"]) - device.background:set_bg(color["Grey700"]) + local node_active = stdout:gsub("\n", "") + if node == node_active then + bg = color["Purple200"] + fg = color["Grey900"] + device.background:set_bg(color["Purple200"]) + device.background:set_fg(color["Grey900"]) + else + fg = color["Purple200"] + bg = color["Grey700"] + device.background:set_fg(color["Purple200"]) + device.background:set_bg(color["Grey700"]) + end end - end ) else device:connect_signal( "button::press", function() - awful.spawn.spawn("./.config/awesome/src/scripts/mic.sh set_source " .. node) + awful.spawn.spawn("./.config/awesome/src/scripts/mic.sh set_source " .. node) - awesome.emit_signal("update::background:mic", node) - end + awesome.emit_signal("update::background:mic", node) + end ) --#region Signal Functions @@ -276,42 +278,43 @@ return function(s) awesome.connect_signal( "update::background:mic", function(new_node) - if node == new_node then - old_bg = color["Blue200"] - old_fg = color["Grey900"] - bg = color["Blue200"] - fg = color["Grey900"] - device.background:set_bg(color["Blue200"]) - device.background:set_fg(color["Grey900"]) - else - fg = color["Blue200"] - bg = color["Grey700"] - device.background:set_fg(color["Blue200"]) - device.background:set_bg(color["Grey700"]) + if node == new_node then + old_bg = color["Blue200"] + old_fg = color["Grey900"] + bg = color["Blue200"] + fg = color["Grey900"] + device.background:set_bg(color["Blue200"]) + device.background:set_fg(color["Grey900"]) + else + fg = color["Blue200"] + bg = color["Grey700"] + device.background:set_fg(color["Blue200"]) + device.background:set_bg(color["Grey700"]) + end end - end ) awful.spawn.easy_async_with_shell( [[ pactl get-default-source ]], function(stdout) - local node_active = stdout:gsub("\n", "") - if node == node_active then - bg = color["Blue200"] - fg = color["Grey900"] - device.background:set_bg(color["Blue200"]) - device.background:set_fg(color["Grey900"]) - else - fg = color["Blue200"] - bg = color["Grey700"] - device.background:set_fg(color["Blue200"]) - device.background:set_bg(color["Grey700"]) + local node_active = stdout:gsub("\n", "") + if node == node_active then + bg = color["Blue200"] + fg = color["Grey900"] + device.background:set_bg(color["Blue200"]) + device.background:set_fg(color["Grey900"]) + else + fg = color["Blue200"] + bg = color["Grey700"] + device.background:set_fg(color["Blue200"]) + device.background:set_bg(color["Grey700"]) + end end - end ) end return device end + -- Container for the source devices local dropdown_list_volume = wibox.widget { { { @@ -330,6 +333,7 @@ return function(s) widget = wibox.container.margin } + -- Container for the sink devices local dropdown_list_microphone = wibox.widget { { { @@ -550,19 +554,19 @@ return function(s) audio_selector_margin:connect_signal( "button::press", function() - volume_list.visible = not volume_list.visible - if volume_list.visible then - audio_bg.shape = function(cr, width, height) - gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4) + volume_list.visible = not volume_list.visible + if volume_list.visible then + audio_bg.shape = function(cr, width, height) + gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4) + end + audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"])) + else + audio_bg.shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, 4) + end + audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"])) end - audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"])) - else - audio_bg.shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 4) - end - audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"])) end - end ) -- Variables for easier access and better readability @@ -575,19 +579,19 @@ return function(s) mic_selector_margin:connect_signal( "button::press", function() - mic_list.visible = not mic_list.visible - if mic_list.visible then - mic_selector_margin.mic_bg.shape = function(cr, width, height) - gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4) + mic_list.visible = not mic_list.visible + if mic_list.visible then + mic_selector_margin.mic_bg.shape = function(cr, width, height) + gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4) + end + mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"])) + else + mic_bg.shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, 4) + end + mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"])) end - mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"])) - else - mic_bg.shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 4) - end - mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"])) end - end ) local audio_slider_margin = volume_controller:get_children_by_id("audio_volume_margin")[1].audio_volume.slider_margin.slider @@ -596,9 +600,9 @@ return function(s) audio_slider_margin:connect_signal( "property::value", function() - local volume = audio_slider_margin.value - awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ " .. tonumber(volume) .. "%") - end + local volume = audio_slider_margin.value + awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ " .. tonumber(volume) .. "%") + end ) local mic_slider_margin = volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider @@ -607,10 +611,10 @@ 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) - end + local volume = mic_slider_margin.value + awful.spawn("pactl set-source-volume @DEFAULT_SOURCE@ " .. tonumber(volume) .. "%") + awesome.emit_signal("get::mic_volume", volume) + end ) -- Main container @@ -627,87 +631,98 @@ return function(s) end } - -- Get all audio devices from all sinks - local function get_devices() + -- Get all source devices + local function get_source_devices() awful.spawn.easy_async_with_shell( [[ pactl list sinks | grep -E 'node.name|alsa.card_name' | awk '{gsub(/"/, ""); for(i = 3;i < NF;i++) printf $i " "; print $NF}' ]], function(stdout) - local i, j = 1, 1 - local device_list = { layout = wibox.layout.fixed.vertical } + local i, j = 1, 1 + local device_list = { layout = wibox.layout.fixed.vertical } - local node_names, alsa_names = {}, {} - for node_name in stdout:gmatch("[^\n]+") do - if (i % 2) == 0 then - table.insert(node_names, node_name) + local node_names, alsa_names = {}, {} + for node_name in stdout:gmatch("[^\n]+") do + if (i % 2) == 0 then + table.insert(node_names, node_name) + end + i = i + 1 end - i = i + 1 - end - for alsa_name in stdout:gmatch("[^\n]+") do - if (j % 2) == 1 then - table.insert(alsa_names, alsa_name) + for alsa_name in stdout:gmatch("[^\n]+") do + if (j % 2) == 1 then + table.insert(alsa_names, alsa_name) + end + j = j + 1 end - j = j + 1 - end - for k = 1, #alsa_names, 1 do - device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], true) + for k = 1, #alsa_names, 1 do + device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], true) + end + dropdown_list_volume.volume_device_background.volume_device_list.children = device_list end - dropdown_list_volume.volume_device_background.volume_device_list.children = device_list - end ) end - get_devices() + get_source_devices() - -- Get all input devices from all sources + -- Get all input devices local function get_input_devices() awful.spawn.easy_async_with_shell( [[ pactl list sources | grep -E "node.name|alsa.card_name" | awk '{gsub(/"/, ""); for(i = 3;i < NF;i++) printf $i " "; print $NF}' ]], function(stdout) - local i, j = 1, 1 - local device_list = { layout = wibox.layout.fixed.vertical } + local i, j = 1, 1 + local device_list = { layout = wibox.layout.fixed.vertical } - local node_names, alsa_names = {}, {} - for node_name in stdout:gmatch("[^\n]+") do - if (i % 2) == 0 then - table.insert(node_names, node_name) + local node_names, alsa_names = {}, {} + for node_name in stdout:gmatch("[^\n]+") do + if (i % 2) == 0 then + table.insert(node_names, node_name) + end + i = i + 1 end - i = i + 1 - end - for alsa_name in stdout:gmatch("[^\n]+") do - if (j % 2) == 1 then - table.insert(alsa_names, alsa_name) + for alsa_name in stdout:gmatch("[^\n]+") do + if (j % 2) == 1 then + table.insert(alsa_names, alsa_name) + end + j = j + 1 end - j = j + 1 - end - for k = 1, #alsa_names, 1 do - device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], false) + for k = 1, #alsa_names, 1 do + device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], false) + end + dropdown_list_microphone.volume_device_background.volume_device_list.children = device_list end - dropdown_list_microphone.volume_device_background.volume_device_list.children = device_list - end ) 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() + 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", "") - 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"])) - else - volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"])) + 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"])) + else + 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 - end ) end @@ -718,75 +733,122 @@ return function(s) 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() + 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 ) end get_mic_mute() + -- When the mouse leaves the popup it stops the mousegrabber and hides the popup. + volume_controller_container:connect_signal( + "mouse::leave", + function() + mousegrabber.run( + function() + awesome.emit_signal("volume_controller::toggle", s) + mousegrabber.stop() + return true + end, + "arrow" + ) + end + ) + + volume_controller_container:connect_signal( + "mouse::enter", + function() + mousegrabber.stop() + end + ) + + -- 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 { + autostart = false, + stop_event = 'release', + keypressed_callback = function(self, mod, key, command) + awesome.emit_signal("volume_controller::toggle", s) + mousegrabber.stop() + end + } + + -- Draw the popup volume_controller_container:setup { volume_controller, layout = wibox.layout.fixed.horizontal } - -- Global signal called from src.widgets.audio.lua + --[[ 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", function(volume) - volume = tonumber(volume) - local icon = icondir .. "volume" - if volume < 1 then - icon = icon .. "-mute" + 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" + 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 - - 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 ) - -- Global signal called from src.widgets.audio.lua + -- 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"])) + 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 - 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"])) - 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"])) + 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"])) + 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"])) + end end - end ) -- Toggle container visibility awesome.connect_signal( "volume_controller::toggle", function(scr) - if scr == s then - volume_controller_container.visible = not volume_controller_container.visible - end + if scr == s then + volume_controller_container.visible = not volume_controller_container.visible + end - end + end ) end diff --git a/awesome/src/scripts/pfp.sh b/awesome/src/scripts/pfp.sh new file mode 100755 index 0000000..ac1a183 --- /dev/null +++ b/awesome/src/scripts/pfp.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +case $1 in + + "userPfp") + iconPath="/var/lib/AccountsService/icons/$USER" + + userIconPath="$HOME/.config/awesome/src/assets/userpfp/" + + if [[ -f "$userIconPath" ]]; + then + if [[ -f "$iconPath" ]]; + then + if ! cmp --silent "$userIconPath.png" "$iconPath"; + then + cp "$iconPath" "$userIconPath$USER.png" + fi + printf "$userIconPath.png" + else + printf "$userIconPath.png" + fi + exit; + else + if [[ -f "$iconPath" ]]; + then + cp "$iconPath" "$userIconPath$USER.png" + printf "$userIconPath$USER.png" + exit; + fi + fi + ;; + + "userName") + fullname="$(getent passwd `whoami` | cut -d ':' -f 5)" + user="$(whoami)" + host="$(hostname)" + if [[ "$2" == "userhost" ]]; + then + printf "$user@$host" + elif [[ "$2" == "fullname" ]]; + then + printf "$fullname" + else + printf "Rick Astley" + fi + ;; + +esac diff --git a/awesome/src/tools/icon_handler.lua b/awesome/src/tools/icon_handler.lua index b6cbeea..89ffd32 100644 --- a/awesome/src/tools/icon_handler.lua +++ b/awesome/src/tools/icon_handler.lua @@ -37,14 +37,14 @@ function Get_icon(theme, client, program_string, class_string, is_steam) end end - for index, icon in ipairs(icon_cache) do + for _, icon in ipairs(icon_cache) do if icon:match(clientName) then return icon end end local resolutions = { "128x128", "96x96", "64x64", "48x48", "42x42", "32x32", "24x24", "16x16" } - for i, res in ipairs(resolutions) do + for _, res in ipairs(resolutions) do local iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/" local ioStream = io.open(iconDir .. clientName, "r") if ioStream ~= nil then diff --git a/awesome/src/widgets/audio.lua b/awesome/src/widgets/audio.lua index e3e0023..a584772 100644 --- a/awesome/src/widgets/audio.lua +++ b/awesome/src/widgets/audio.lua @@ -1,7 +1,6 @@ ------------------------------ -- This is the audio widget -- ------------------------------ - -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") @@ -60,26 +59,27 @@ return function(s) awful.spawn.easy_async_with_shell( "./.config/awesome/src/scripts/vol.sh volume", function(stdout) - local icon = icondir .. "volume" - stdout = stdout:gsub("%%", "") - local volume = tonumber(stdout) or 0 - audio_widget.container.audio_layout.spacing = dpi(5) - audio_widget.container.audio_layout.label.visible = true - if volume < 1 then - icon = icon .. "-mute" - audio_widget.container.audio_layout.spacing = dpi(0) - audio_widget.container.audio_layout.label.visible = false - 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" + local icon = icondir .. "volume" + stdout = stdout:gsub("%%", "") + local volume = tonumber(stdout) or 0 + audio_widget.container.audio_layout.spacing = dpi(5) + audio_widget.container.audio_layout.label.visible = true + if volume < 1 then + icon = icon .. "-mute" + audio_widget.container.audio_layout.spacing = dpi(0) + audio_widget.container.audio_layout.label.visible = false + 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 + audio_widget.container.audio_layout.label:set_text(volume .. "%") + audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image( + gears.color.recolor_image(icon .. ".svg", color["Grey900"])) + awesome.emit_signal("get::volume", volume) end - audio_widget.container.audio_layout.label:set_text(volume .. "%") - audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Grey900"])) - awesome.emit_signal("get::volume", volume) - end ) end @@ -87,30 +87,32 @@ return function(s) awful.spawn.easy_async_with_shell( "./.config/awesome/src/scripts/vol.sh mute", function(stdout) - if stdout:match("yes") then - audio_widget.container.audio_layout.label.visible = false - audio_widget.container:set_right(0) - audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", color["Grey900"])) - awesome.emit_signal("get::volume_mute", true) - else - audio_widget.container:set_right(10) - awesome.emit_signal("get::volume_mute", false) - get_volume() + if stdout:match("yes") then + audio_widget.container.audio_layout.label.visible = false + audio_widget.container:set_right(0) + audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image( + gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", color["Grey900"])) + awesome.emit_signal("get::volume_mute", true) + else + audio_widget.container:set_right(10) + awesome.emit_signal("get::volume_mute", false) + get_volume() + end end - end ) end -- Signals - Hover_signal(audio_widget, color["Yellow200"]) + Hover_signal(audio_widget, color["Yellow200"], color["Grey900"]) audio_widget:connect_signal( "button::press", function() - awesome.emit_signal("module::slider:update") - awesome.emit_signal("widget::volume_osd:rerun") - awesome.emit_signal("volume_controller::toggle", s) - end + awesome.emit_signal("module::slider:update") + awesome.emit_signal("widget::volume_osd:rerun") + awesome.emit_signal("volume_controller::toggle", s) + awesome.emit_signal("volume_controller::toggle:keygrabber") + end ) gears.timer { diff --git a/awesome/src/widgets/battery.lua b/awesome/src/widgets/battery.lua index 5093e57..ea80907 100644 --- a/awesome/src/widgets/battery.lua +++ b/awesome/src/widgets/battery.lua @@ -1,7 +1,6 @@ -------------------------------- -- This is the battery widget -- -------------------------------- - -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") @@ -71,23 +70,23 @@ return function() awful.spawn.easy_async_with_shell( [[ upower -i $(upower -e | grep BAT) | grep "time to " ]], function(stdout) - if stdout == nil or stdout == '' then - battery_tooltip:set_text('No Battery Found') - return + if stdout == nil or stdout == '' then + battery_tooltip:set_text('No Battery Found') + return + end + local rem_time = "" + if stdout:match("hour") then + rem_time = "Hours" + else + rem_time = "Minutes" + end + local bat_time = stdout:match("%d+,%d") or stdout:match("%d+.%d") or "" + if stdout:match("empty") then + battery_tooltip:set_text("Remaining battery time: " .. bat_time .. " " .. rem_time) + elseif stdout:match("time to full") then + battery_tooltip:set_text("Battery fully charged in: " .. bat_time .. " " .. rem_time) + end end - local rem_time = "" - if stdout:match("hour") then - rem_time = "Hours" - else - rem_time = "Minutes" - end - local bat_time = stdout:match("%d+,%d") or stdout:match("%d+.%d") or "" - if stdout:match("empty") then - battery_tooltip:set_text("Remaining battery time: " .. bat_time .. " " .. rem_time) - elseif stdout:match("time to full") then - battery_tooltip:set_text("Battery fully charged in: " .. bat_time .. " " .. rem_time) - end - end ) end get_battery_info() @@ -109,92 +108,96 @@ return function() awful.spawn.easy_async_with_shell( [[sh -c "upower -i $(upower -e | grep BAT) | grep percentage | awk '{print \$2}' |tr -d '\n%'"]], function(stdout) - local battery_percentage = tonumber(stdout) + local battery_percentage = tonumber(stdout) - if not battery_percentage then - return - end - - battery_widget.container.battery_layout.spacing = dpi(5) - battery_widget.container.battery_layout.label.visible = true - battery_widget.container.battery_layout.label:set_text(battery_percentage .. '%') - - local icon = 'battery' - - if status == 'fully-charged' or status == 'charging' and battery_percentage == 100 then - icon = icon .. '-' .. 'charging' - battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121"))) - return - end - - if battery_percentage > 0 and battery_percentage < 10 and status == 'discharging' then - icon = icon .. '-' .. 'alert' - if (os.difftime(os.time(), last_battery_check) > 300 or notify_critical_battery) then - last_battery_check = os.time() - notify_critical_battery = false - battery_warning() + if not battery_percentage then + return end - battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121"))) - return + + battery_widget.container.battery_layout.spacing = dpi(5) + battery_widget.container.battery_layout.label.visible = true + battery_widget.container.battery_layout.label:set_text(battery_percentage .. '%') + + local icon = 'battery' + + if status == 'fully-charged' or status == 'charging' and battery_percentage == 100 then + icon = icon .. '-' .. 'charging' + battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached( + gears.color.recolor_image(icondir .. icon .. '.svg', "#212121"))) + return + end + + if battery_percentage > 0 and battery_percentage < 10 and status == 'discharging' then + icon = icon .. '-' .. 'alert' + if (os.difftime(os.time(), last_battery_check) > 300 or notify_critical_battery) then + last_battery_check = os.time() + notify_critical_battery = false + battery_warning() + end + battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached( + gears.color.recolor_image(icondir .. icon .. '.svg', "#212121"))) + return + end + + if battery_percentage > 0 and battery_percentage < 10 then + icon = icon .. '-' .. status .. '-' .. 'outline' + elseif battery_percentage >= 10 and battery_percentage < 20 then + icon = icon .. '-' .. status .. '-' .. '10' + elseif battery_percentage >= 20 and battery_percentage < 30 then + icon = icon .. '-' .. status .. '-' .. '20' + elseif battery_percentage >= 30 and battery_percentage < 40 then + icon = icon .. '-' .. status .. '-' .. '30' + elseif battery_percentage >= 40 and battery_percentage < 50 then + icon = icon .. '-' .. status .. '-' .. '40' + elseif battery_percentage >= 50 and battery_percentage < 60 then + icon = icon .. '-' .. status .. '-' .. '50' + elseif battery_percentage >= 60 and battery_percentage < 70 then + icon = icon .. '-' .. status .. '-' .. '60' + elseif battery_percentage >= 70 and battery_percentage < 80 then + icon = icon .. '-' .. status .. '-' .. '70' + elseif battery_percentage >= 80 and battery_percentage < 90 then + icon = icon .. '-' .. status .. '-' .. '80' + elseif battery_percentage >= 90 and battery_percentage < 100 then + icon = icon .. '-' .. status .. '-' .. '90' + end + + battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached( + gears.color.recolor_image(icondir .. icon .. '.svg', "#212121"))) + end - - if battery_percentage > 0 and battery_percentage < 10 then - icon = icon .. '-' .. status .. '-' .. 'outline' - elseif battery_percentage >= 10 and battery_percentage < 20 then - icon = icon .. '-' .. status .. '-' .. '10' - elseif battery_percentage >= 20 and battery_percentage < 30 then - icon = icon .. '-' .. status .. '-' .. '20' - elseif battery_percentage >= 30 and battery_percentage < 40 then - icon = icon .. '-' .. status .. '-' .. '30' - elseif battery_percentage >= 40 and battery_percentage < 50 then - icon = icon .. '-' .. status .. '-' .. '40' - elseif battery_percentage >= 50 and battery_percentage < 60 then - icon = icon .. '-' .. status .. '-' .. '50' - elseif battery_percentage >= 60 and battery_percentage < 70 then - icon = icon .. '-' .. status .. '-' .. '60' - elseif battery_percentage >= 70 and battery_percentage < 80 then - icon = icon .. '-' .. status .. '-' .. '70' - elseif battery_percentage >= 80 and battery_percentage < 90 then - icon = icon .. '-' .. status .. '-' .. '80' - elseif battery_percentage >= 90 and battery_percentage < 100 then - icon = icon .. '-' .. status .. '-' .. '90' - end - - battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121"))) - - end ) end - Hover_signal(battery_widget, color["Purple200"]) + Hover_signal(battery_widget, color["Purple200"], color["Grey900"]) battery_widget:connect_signal( 'button::press', function() - awful.spawn("xfce4-power-manager-settings") - end + awful.spawn("xfce4-power-manager-settings") + end ) battery_widget:connect_signal( "mouse::enter", function() - get_battery_info() - end + get_battery_info() + end ) watch( [[sh -c "upower -i $(upower -e | grep BAT) | grep state | awk '{print \$2}' | tr -d '\n'"]], 5, function(widget, stdout) - local status = stdout:gsub('%\n', '') - if status == nil or status == '' then - battery_widget.container.battery_layout.spacing = dpi(0) - battery_widget.container.battery_layout.label.visible = false - battery_tooltip:set_text('No battery found') - battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. 'battery-off' .. '.svg', "#212121"))) + local status = stdout:gsub('%\n', '') + if status == nil or status == '' then + battery_widget.container.battery_layout.spacing = dpi(0) + battery_widget.container.battery_layout.label.visible = false + battery_tooltip:set_text('No battery found') + battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached( + gears.color.recolor_image(icondir .. 'battery-off' .. '.svg', "#212121"))) + end + update_battery(status) end - update_battery(status) - end ) return battery_widget diff --git a/awesome/src/widgets/bluetooth.lua b/awesome/src/widgets/bluetooth.lua index 495fe4e..0d22343 100644 --- a/awesome/src/widgets/bluetooth.lua +++ b/awesome/src/widgets/bluetooth.lua @@ -67,13 +67,13 @@ return function() awful.spawn.easy_async_with_shell( './.config/awesome/src/scripts/bt.sh', function(stdout2) - if stdout2 == nil or stdout2:gsub("\n", "") == "" then - bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently not connected") - else - connected_device = stdout2:gsub("%(", ""):gsub("%)", "") - bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently connected to:\n" .. connected_device) + if stdout2 == nil or stdout2:gsub("\n", "") == "" then + bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently not connected") + else + connected_device = stdout2:gsub("%(", ""):gsub("%)", "") + bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently connected to:\n" .. connected_device) + end end - end ) end bluetooth_widget.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Grey900"])) @@ -82,49 +82,49 @@ return function() ) -- Signals - Hover_signal(bluetooth_widget, color["Blue200"]) + Hover_signal(bluetooth_widget, color["Blue200"], color["Grey900"]) bluetooth_widget:connect_signal( "button::press", function() - awful.spawn.easy_async_with_shell( - "rfkill list bluetooth", - function(stdout) - if stdout:gsub("\n", "") ~= '' then - if bluetooth_state == "off" then - awful.spawn.easy_async_with_shell( - [[ + awful.spawn.easy_async_with_shell( + "rfkill list bluetooth", + function(stdout) + if stdout:gsub("\n", "") ~= '' then + if bluetooth_state == "off" then + awful.spawn.easy_async_with_shell( + [[ rfkill unblock bluetooth sleep 1 bluetoothctl power on - ]], - function() - naughty.notification { - title = "System Notification", - app_name = "Bluetooth", - message = "Bluetooth activated" - } - end - ) - else - awful.spawn.easy_async_with_shell( - [[ + ]] , + function() + naughty.notification { + title = "System Notification", + app_name = "Bluetooth", + message = "Bluetooth activated" + } + end + ) + else + awful.spawn.easy_async_with_shell( + [[ bluetoothctl power off rfkill block bluetooth - ]], - function() - naughty.notification { - title = "System Notification", - app_name = "Bluetooth", - message = "Bluetooth deactivated" - } + ]] , + function() + naughty.notification { + title = "System Notification", + app_name = "Bluetooth", + message = "Bluetooth deactivated" + } + end + ) + end end - ) end - end + ) end - ) - end ) return bluetooth_widget diff --git a/awesome/src/widgets/clock.lua b/awesome/src/widgets/clock.lua index ec4505b..bf9b4f5 100644 --- a/awesome/src/widgets/clock.lua +++ b/awesome/src/widgets/clock.lua @@ -39,7 +39,8 @@ return function() id = "label", align = "center", valign = "center", - widget = wibox.widget.textbox + format = "%H:%M", + widget = wibox.widget.textclock }, id = "clock_layout", layout = wibox.layout.fixed.horizontal @@ -57,22 +58,7 @@ return function() widget = wibox.container.background } - local set_clock = function() - clock_widget.container.clock_layout.label:set_text(os.date("%H:%M")) - end - - -- Updates the clock every 5 seconds, worst case you are 5 seconds behind - -- ¯\_(ツ)_/¯ - gears.timer { - timeout = 5, - autostart = true, - call_now = true, - callback = function() - set_clock() - end - } - - Hover_signal(clock_widget, color["Orange200"]) + Hover_signal(clock_widget, color["Orange200"], color["Grey900"]) return clock_widget end diff --git a/awesome/src/widgets/cpu_info.lua b/awesome/src/widgets/cpu_info.lua index 6697cea..f9b6318 100644 --- a/awesome/src/widgets/cpu_info.lua +++ b/awesome/src/widgets/cpu_info.lua @@ -145,21 +145,21 @@ return function(widget, clock_mode) [[ cat "/proc/stat" | grep '^cpu ' ]], 3, function(_, stdout) - local user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice = - stdout:match("(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s") + local user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice = + stdout:match("(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s") - local total = user + nice + system + idle + iowait + irq + softirq + steal + local total = user + nice + system + idle + iowait + irq + softirq + steal - local diff_idle = idle - idle_prev - local diff_total = total - total_prev - local diff_usage = (1000 * (diff_total - diff_idle) / diff_total + 5) / 10 + local diff_idle = idle - idle_prev + local diff_total = total - total_prev + local diff_usage = (1000 * (diff_total - diff_idle) / diff_total + 5) / 10 - cpu_usage_widget.container.cpu_layout.label.text = tostring(math.floor(diff_usage)) .. "%" + cpu_usage_widget.container.cpu_layout.label.text = tostring(math.floor(diff_usage)) .. "%" - total_prev = total - idle_prev = idle - collectgarbage("collect") - end + total_prev = total + idle_prev = idle + collectgarbage("collect") + end ) watch( @@ -167,53 +167,53 @@ return function(widget, clock_mode) 3, function(_, stdout) - local temp_icon - local temp_color + local temp_icon + local temp_color - local temp_num = tonumber(stdout:match("%d+")) - if temp_num < 50 then - temp_color = color["Green200"] - temp_icon = icon_dir .. "thermometer-low.svg" - elseif temp_num >= 50 and temp_num < 80 then - temp_color = color["Orange200"] - temp_icon = icon_dir .. "thermometer.svg" - elseif temp_num >= 80 then - temp_color = color["Red200"] - temp_icon = icon_dir .. "thermometer-high.svg" + local temp_num = tonumber(stdout:match("%d+")) + if temp_num < 50 then + temp_color = color["Green200"] + temp_icon = icon_dir .. "thermometer-low.svg" + elseif temp_num >= 50 and temp_num < 80 then + temp_color = color["Orange200"] + temp_icon = icon_dir .. "thermometer.svg" + elseif temp_num >= 80 then + temp_color = color["Red200"] + temp_icon = icon_dir .. "thermometer-high.svg" + end + Hover_signal(cpu_temp, temp_color, color["Grey900"]) + cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon) + cpu_temp:set_bg(temp_color) + cpu_temp.container.cpu_layout.label.text = math.floor(temp_num) .. "°C" end - Hover_signal(cpu_temp, temp_color) - cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon) - cpu_temp:set_bg(temp_color) - cpu_temp.container.cpu_layout.label.text = math.floor(temp_num) .. "°C" - end ) watch( [[ bash -c "cat /proc/cpuinfo | grep "MHz" | awk '{print int($4)}'" ]], 3, function(_, stdout) - local cpu_freq = {} + local cpu_freq = {} - for value in stdout:gmatch("%d+") do - table.insert(cpu_freq, value) - end - - local average = 0 - - if clock_mode == "average" then - for i = 1, #cpu_freq do - average = average + cpu_freq[i] + for value in stdout:gmatch("%d+") do + table.insert(cpu_freq, value) + end + + local average = 0 + + if clock_mode == "average" then + for i = 1, #cpu_freq do + average = average + cpu_freq[i] + end + average = math.floor(average / #cpu_freq) + cpu_clock.container.cpu_layout.label.text = tonumber(average) .. "Mhz" + elseif clock_mode then + cpu_clock.container.cpu_layout.label.text = tonumber(cpu_freq[clock_mode]) .. "Mhz" end - average = math.floor(average / #cpu_freq) - cpu_clock.container.cpu_layout.label.text = tonumber(average) .. "Mhz" - elseif clock_mode then - cpu_clock.container.cpu_layout.label.text = tonumber(cpu_freq[clock_mode]) .. "Mhz" end - end ) - Hover_signal(cpu_usage_widget, color["Blue200"]) - Hover_signal(cpu_clock, color["Purple200"]) + Hover_signal(cpu_usage_widget, color["Blue200"], color["Grey900"]) + Hover_signal(cpu_clock, color["Purple200"], color["Grey900"]) if widget == "usage" then return cpu_usage_widget diff --git a/awesome/src/widgets/date.lua b/awesome/src/widgets/date.lua index e9b62ed..4643a33 100644 --- a/awesome/src/widgets/date.lua +++ b/awesome/src/widgets/date.lua @@ -72,20 +72,20 @@ return function() } -- Signals - Hover_signal(date_widget, color["Teal200"]) + Hover_signal(date_widget, color["Teal200"], color["Grey900"]) date_widget:connect_signal( "mouse::enter", function() - awesome.emit_signal("widget::calendar_osd:stop", true) - end + awesome.emit_signal("widget::calendar_osd:stop", true) + end ) date_widget:connect_signal( "mouse::leave", function() - awesome.emit_signal("widget::calendar_osd:rerun", true) - end + awesome.emit_signal("widget::calendar_osd:rerun", true) + end ) return date_widget diff --git a/awesome/src/widgets/gpu_info.lua b/awesome/src/widgets/gpu_info.lua index a06a9cf..69b88c9 100644 --- a/awesome/src/widgets/gpu_info.lua +++ b/awesome/src/widgets/gpu_info.lua @@ -54,7 +54,7 @@ return function(widget) end, widget = wibox.container.background } - Hover_signal(gpu_usage_widget, color["Green200"]) + Hover_signal(gpu_usage_widget, color["Green200"], color["Grey900"]) local gpu_temp_widget = wibox.widget { { @@ -102,8 +102,8 @@ return function(widget) [[ bash -c "nvidia-smi -q -d UTILIZATION | grep Gpu | awk '{print $3}'"]], 3, function(_, stdout) - gpu_usage_widget.container.gpu_layout.label.text = stdout:gsub("\n", "") .. "%" - end + gpu_usage_widget.container.gpu_layout.label.text = stdout:gsub("\n", "") .. "%" + end ) -- GPU Temperature @@ -112,26 +112,26 @@ return function(widget) 3, function(_, stdout) - local temp_icon - local temp_color - local temp_num = tonumber(stdout) + local temp_icon + local temp_color + local temp_num = tonumber(stdout) - if temp_num < 50 then - temp_color = color["Green200"] - temp_icon = icon_dir .. "thermometer-low.svg" - elseif temp_num >= 50 and temp_num < 80 then - temp_color = color["Orange200"] - temp_icon = icon_dir .. "thermometer.svg" - elseif temp_num >= 80 then - temp_color = color["Red200"] - temp_icon = icon_dir .. "thermometer-high.svg" + if temp_num < 50 then + temp_color = color["Green200"] + temp_icon = icon_dir .. "thermometer-low.svg" + elseif temp_num >= 50 and temp_num < 80 then + temp_color = color["Orange200"] + temp_icon = icon_dir .. "thermometer.svg" + elseif temp_num >= 80 then + temp_color = color["Red200"] + temp_icon = icon_dir .. "thermometer-high.svg" + end + + Hover_signal(gpu_temp_widget, temp_color, color["Grey900"]) + gpu_temp_widget.container.gpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon) + gpu_temp_widget:set_bg(temp_color) + gpu_temp_widget.container.gpu_layout.label.text = tostring(temp_num) .. "°C" end - - Hover_signal(gpu_temp_widget, temp_color) - gpu_temp_widget.container.gpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon) - gpu_temp_widget:set_bg(temp_color) - gpu_temp_widget.container.gpu_layout.label.text = tostring(temp_num) .. "°C" - end ) if widget == "usage" then diff --git a/awesome/src/widgets/kblayout.lua b/awesome/src/widgets/kblayout.lua index 0d559e2..428ee72 100644 --- a/awesome/src/widgets/kblayout.lua +++ b/awesome/src/widgets/kblayout.lua @@ -59,10 +59,10 @@ return function(s) awful.spawn.easy_async_with_shell( [[ setxkbmap -query | grep layout | awk '{print $2}' ]], function(stdout) - local layout = stdout:gsub("\n", "") - kblayout_widget.container.kblayout_layout.label.text = layout - awesome.emit_signal("update::background:kblayout") - end + local layout = stdout:gsub("\n", "") + kblayout_widget.container.kblayout_layout.label.text = layout + awesome.emit_signal("update::background:kblayout") + end ) end @@ -72,12 +72,12 @@ return function(s) local xkeyboard_country_code = { { "af", "أفغانيش(Afghanistan)", "AFG" }, -- Afghanistan - { "al", "shqip(Albania)", "ALB" }, -- Albania - { "am", "հայերեն(Armenia)", "ARM" }, -- Armenia + { "al", "Shqip(Albania)", "ALB" }, -- Albania + { "am", "Hայերեն(Armenia)", "ARM" }, -- Armenia { "ara", "عربي(Arab)", "ARB" }, -- Arabic { "at", "Österreichisch (Austria)", "AUT" }, -- Austria { "az", "Azərbaycan(Azerbaijan)", "AZE" }, -- Azerbaijan - { "ba", "bosanski(Bosnia and Herzegovina)", "BIH" }, -- Bosnia and Herzegovina + { "ba", "Bosanski(Bosnia and Herzegovina)", "BIH" }, -- Bosnia and Herzegovina { "bd", "", "BGD" }, -- Bangladesh { "be", "", "BEL" }, -- Belgium { "bg", "", "BGR" }, -- Bulgaria @@ -219,22 +219,22 @@ return function(s) awesome.connect_signal( "update::background:kblayout", function() - awful.spawn.easy_async_with_shell( - [[ setxkbmap -query | grep layout | awk '{print $2}' ]], - function(stdout) - local layout = stdout:gsub("\n", "") - if kb_layout_item.keymap == layout then - kb_layout_item.bg = color["DeepPurple200"] - kb_layout_item:get_children_by_id("background2")[1].fg = color["Grey900"] - kb_layout_item:get_children_by_id("background1")[1].fg = color["Grey900"] - else - kb_layout_item.bg = color["Grey800"] - kb_layout_item:get_children_by_id("background2")[1].fg = color["Red200"] - kb_layout_item:get_children_by_id("background1")[1].fg = color["Purple200"] - end + awful.spawn.easy_async_with_shell( + [[ setxkbmap -query | grep layout | awk '{print $2}' ]], + function(stdout) + local layout = stdout:gsub("\n", "") + if kb_layout_item.keymap == layout then + kb_layout_item.bg = color["DeepPurple200"] + kb_layout_item:get_children_by_id("background2")[1].fg = color["Grey900"] + kb_layout_item:get_children_by_id("background1")[1].fg = color["Grey900"] + else + kb_layout_item.bg = color["Grey800"] + kb_layout_item:get_children_by_id("background2")[1].fg = color["Red200"] + kb_layout_item:get_children_by_id("background1")[1].fg = color["Purple200"] + end + end + ) end - ) - end ) get_kblayout() @@ -242,15 +242,15 @@ return function(s) kb_layout_item:connect_signal( "button::press", function() - awful.spawn.easy_async_with_shell( - "setxkbmap " .. keymap, - function() - awesome.emit_signal("kblayout::hide:kbmenu") - mousegrabber.stop() - get_kblayout() + awful.spawn.easy_async_with_shell( + "setxkbmap " .. keymap, + function() + awesome.emit_signal("kblayout::hide:kbmenu") + mousegrabber.stop() + get_kblayout() + end + ) end - ) - end ) return kb_layout_item end @@ -294,25 +294,23 @@ return function(s) kb_menu_widget:connect_signal( "mouse::leave", function() - mousegrabber.run( - function() - kblayout_widget.bg = color["Green200"] - if mouse.is_left_mouse_button_pressed then + mousegrabber.run( + function() + kblayout_widget.bg = color["Green200"] awesome.emit_signal("kblayout::hide:kbmenu") mousegrabber.stop() - end - return true - end, - "arrow" - ) - end + return true + end, + "arrow" + ) + end ) kb_menu_widget:connect_signal( "mouse::enter", function() - mousegrabber.stop() - end + mousegrabber.stop() + end ) kb_menu_widget:setup( @@ -323,38 +321,38 @@ return function(s) awful.spawn.easy_async_with_shell( "setxkbmap -query | grep layout: | awk '{print $2}'", function(stdout) - for j, n in ipairs(user_vars.kblayout) do - if stdout:match(n) then - if j == #user_vars.kblayout then - awful.spawn.easy_async_with_shell( - "setxkbmap " .. user_vars.kblayout[1], - function() - get_kblayout() + for j, n in ipairs(user_vars.kblayout) do + if stdout:match(n) then + if j == #user_vars.kblayout then + awful.spawn.easy_async_with_shell( + "setxkbmap " .. user_vars.kblayout[1], + function() + get_kblayout() + end + ) + else + awful.spawn.easy_async_with_shell( + "setxkbmap " .. user_vars.kblayout[j + 1], + function() + get_kblayout() + end + ) end - ) - else - awful.spawn.easy_async_with_shell( - "setxkbmap " .. user_vars.kblayout[j + 1], - function() - get_kblayout() - end - ) end end end - end ) end awesome.connect_signal( "kblayout::toggle", function() - toggle_kb_layout() - end + toggle_kb_layout() + end ) -- Signals - Hover_signal(kblayout_widget, color["Green200"]) + Hover_signal(kblayout_widget, color["Green200"], color["Grey900"]) local kblayout_keygrabber = awful.keygrabber { autostart = false, @@ -368,23 +366,23 @@ return function(s) kblayout_widget:connect_signal( "button::press", function() - mousegrabber.stop() - if kb_menu_widget.visible then - kb_menu_widget.visible = false - kblayout_keygrabber:stop() - else - kb_menu_widget.visible = true - kblayout_keygrabber:start() + mousegrabber.stop() + if kb_menu_widget.visible then + kb_menu_widget.visible = false + kblayout_keygrabber:stop() + else + kb_menu_widget.visible = true + kblayout_keygrabber:start() + end end - end ) awesome.connect_signal( "kblayout::hide:kbmenu", function() - kb_menu_widget.visible = false - kblayout_keygrabber:stop() - end + kb_menu_widget.visible = false + kblayout_keygrabber:stop() + end ) get_kblayout() diff --git a/awesome/src/widgets/layout_list.lua b/awesome/src/widgets/layout_list.lua index a1e1d2e..bb28d1c 100644 --- a/awesome/src/widgets/layout_list.lua +++ b/awesome/src/widgets/layout_list.lua @@ -33,13 +33,13 @@ return function() } -- Signals - Hover_signal(layout, color["LightBlue200"]) + Hover_signal(layout, color["LightBlue200"], color["Grey900"]) layout:connect_signal( "button::press", function() - awful.layout.inc(-1) - end + awful.layout.inc(-1) + end ) return layout diff --git a/awesome/src/widgets/network.lua b/awesome/src/widgets/network.lua index 952ba03..60f2db3 100644 --- a/awesome/src/widgets/network.lua +++ b/awesome/src/widgets/network.lua @@ -131,21 +131,21 @@ return function() awful.spawn.easy_async_with_shell( [[ iw dev ]] .. interfaces.wlan_interface .. [[ link ]], function(stdout) - local essid = stdout:match("SSID: (.-)\n") or "N/A" - local bitrate = stdout:match("tx bitrate: (.+/s)") or "N/A" - local message = "Connected to " .. essid .. "\nSignal strength " .. tostring(wifi_strength) .. "%\n" .. "Bit rate " .. tostring(bitrate) .. "" + local essid = stdout:match("SSID: (.-)\n") or "N/A" + local bitrate = stdout:match("tx bitrate: (.+/s)") or "N/A" + local message = "Connected to " .. essid .. "\nSignal strength " .. tostring(wifi_strength) .. "%\n" .. "Bit rate " .. tostring(bitrate) .. "" - if healthy then - update_tooltip(message) - else - update_tooltip("You are connected but have no internet" .. message) - end + if healthy then + update_tooltip(message) + else + update_tooltip("You are connected but have no internet" .. message) + end - if reconnect_startup or startup then - notify_connected(essid) - update_reconnect_startup(false) + if reconnect_startup or startup then + notify_connected(essid) + update_reconnect_startup(false) + end end - end ) end @@ -153,20 +153,20 @@ return function() awful.spawn.easy_async_with_shell( check_for_internet, function(stdout) - local icon = "wifi-strength" - if not stdout:match("Connected but no internet") then - if startup or reconnect_startup then - awesome.emit_signal("system::network_connected") + local icon = "wifi-strength" + if not stdout:match("Connected but no internet") then + if startup or reconnect_startup then + awesome.emit_signal("system::network_connected") + end + icon = icon .. '-' .. tostring(strength) + update_wireless_data(true) + else + icon = icon .. "-" .. tostring(strength) + update_wireless_data(false) end - icon = icon .. '-' .. tostring(strength) - update_wireless_data(true) - else - icon = icon .. "-" .. tostring(strength) - update_wireless_data(false) + network_widget.container.network_layout.spacing = dpi(8) + network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color["Grey900"])) end - network_widget.container.network_layout.spacing = dpi(8) - network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color["Grey900"])) - end ) end @@ -174,16 +174,16 @@ return function() awful.spawn.easy_async_with_shell( [[ awk 'NR==3 {printf "%3.0f", ($3/70)*100}' /proc/net/wireless ]], function(stdout) - if not tonumber(stdout) then - return + if not tonumber(stdout) then + return + end + wifi_strength = tonumber(stdout) + network_widget.container.network_layout.spacing = dpi(8) + network_widget.container.network_layout.label.visible = true + network_widget.container.network_layout.label:set_text(tostring(wifi_strength .. "%")) + local wifi_strength_rounded = math.floor(wifi_strength / 25 + 0.5) + update_wireless_icon(wifi_strength_rounded) end - wifi_strength = tonumber(stdout) - network_widget.container.network_layout.spacing = dpi(8) - network_widget.container.network_layout.label.visible = true - network_widget.container.network_layout.label:set_text(tostring(wifi_strength .. "%")) - local wifi_strength_rounded = math.floor(wifi_strength / 25 + 0.5) - update_wireless_icon(wifi_strength_rounded) - end ) end @@ -205,26 +205,26 @@ return function() awful.spawn.easy_async_with_shell( check_for_internet, function(stdout) - local icon = "ethernet" + local icon = "ethernet" - if stdout:match("Connected but no internet") then - icon = "no-internet" - update_tooltip( - "No internet" - ) - else - update_tooltip("You are connected to:\nEthernet Interface " .. interfaces.lan_interface .. "") - if startup or reconnect_startup then - awesome.emit_signal("system::network_connected") - notify_connected() - update_startup() + if stdout:match("Connected but no internet") then + icon = "no-internet" + update_tooltip( + "No internet" + ) + else + update_tooltip("You are connected to:\nEthernet Interface " .. interfaces.lan_interface .. "") + if startup or reconnect_startup then + awesome.emit_signal("system::network_connected") + notify_connected() + update_startup() + end + update_reconnect_startup(false) end - update_reconnect_startup(false) + network_widget.container.network_layout.label.visible = false + network_widget.container.network_layout.spacing = dpi(0) + network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(icondir .. icon .. ".svg") end - network_widget.container.network_layout.label.visible = false - network_widget.container.network_layout.spacing = dpi(0) - network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(icondir .. icon .. ".svg") - end ) end @@ -302,15 +302,15 @@ return function() print_network_mode ]=], function(stdout) - local mode = stdout:gsub("%\n", "") - if stdout:match("No internet connected") then - update_disconnected() - elseif stdout:match("wireless") then - update_wireless() - elseif stdout:match("wired") then - update_wired() + local mode = stdout:gsub("%\n", "") + if stdout:match("No internet connected") then + update_disconnected() + elseif stdout:match("wireless") then + update_wireless() + elseif stdout:match("wired") then + update_wired() + end end - end ) end @@ -324,13 +324,13 @@ return function() } -- Signals - Hover_signal(network_widget, color["Red200"]) + Hover_signal(network_widget, color["Red200"], color["Grey900"]) network_widget:connect_signal( "button::press", function() - awful.spawn("gnome-control-center wlan") - end + awful.spawn("gnome-control-center wlan") + end ) return network_widget diff --git a/awesome/src/widgets/power.lua b/awesome/src/widgets/power.lua index 5e36982..95812ab 100644 --- a/awesome/src/widgets/power.lua +++ b/awesome/src/widgets/power.lua @@ -50,13 +50,13 @@ return function() } -- Signals - Hover_signal(power_widget, color["Red200"]) + Hover_signal(power_widget, color["Red200"], color["Grey900"]) power_widget:connect_signal( "button::release", function() - awesome.emit_signal("module::powermenu:show") - end + awesome.emit_signal("module::powermenu:show") + end ) return power_widget diff --git a/awesome/src/widgets/ram_info.lua b/awesome/src/widgets/ram_info.lua index 74db52c..09b9c2e 100644 --- a/awesome/src/widgets/ram_info.lua +++ b/awesome/src/widgets/ram_info.lua @@ -55,17 +55,17 @@ return function() widget = wibox.container.background } - Hover_signal(ram_widget, color["Red200"]) + Hover_signal(ram_widget, color["Red200"], color["Grey900"]) watch( [[ bash -c "cat /proc/meminfo| grep Mem | awk '{print $2}'" ]], 3, function(_, stdout) - local MemTotal, MemFree, MemAvailable = stdout:match("(%d+)\n(%d+)\n(%d+)\n") + local MemTotal, MemFree, MemAvailable = stdout:match("(%d+)\n(%d+)\n(%d+)\n") - ram_widget.container.ram_layout.label.text = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) .. "/" .. string.format("%.1f", (MemTotal / 1024 / 1024)) .. "GB"):gsub(",", ".") - end + ram_widget.container.ram_layout.label.text = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) .. "/" .. string.format("%.1f", (MemTotal / 1024 / 1024)) .. "GB"):gsub(",", ".") + end ) return ram_widget diff --git a/awesome/src/widgets/systray.lua b/awesome/src/widgets/systray.lua index c0a87c1..95111d7 100644 --- a/awesome/src/widgets/systray.lua +++ b/awesome/src/widgets/systray.lua @@ -30,7 +30,7 @@ return function(s) bg = color["BlueGrey800"] } -- Signals - Hover_signal(systray.container, color["Red200"]) + Hover_signal(systray.container, color["Red200"], color["Grey900"]) awesome.connect_signal("systray::update", function() local num_entries = awesome.systray() diff --git a/awesome/src/widgets/taglist.lua b/awesome/src/widgets/taglist.lua index d6a44f5..97798bd 100644 --- a/awesome/src/widgets/taglist.lua +++ b/awesome/src/widgets/taglist.lua @@ -1,3 +1,8 @@ +-------------------------------- +-- This is the taglist widget -- +-------------------------------- + +-- Awesome Libs local wibox = require("wibox") local awful = require("awful") local gears = require("gears") @@ -8,52 +13,29 @@ require("src.tools.icon_handler") local list_update = function(widget, buttons, label, data, objects) widget:reset() - for i, object in ipairs(objects) do - - local tag_icon = wibox.widget { - nil, - { - id = "icon", - resize = true, - widget = wibox.widget.imagebox - }, - nil, - layout = wibox.layout.align.horizontal - } - - local tag_icon_margin = wibox.widget { - tag_icon, - forced_width = dpi(33), - margins = dpi(3), - widget = wibox.container.margin - } - - local tag_label = wibox.widget { - text = "", - align = "center", - valign = "center", - visible = true, - font = user_vars.font.extrabold, - forced_width = dpi(25), - widget = wibox.widget.textbox - } - - local tag_label_margin = wibox.widget { - tag_label, - left = dpi(5), - right = dpi(5), - widget = wibox.container.margin - } + for _, object in ipairs(objects) do local tag_widget = wibox.widget { - - id = "widget_margin", { + { + { + text = "", + align = "center", + valign = "center", + visible = true, + font = user_vars.font.extrabold, + forced_width = dpi(25), + id = "label", + widget = wibox.widget.textbox + }, + id = "margin", + left = dpi(5), + right = dpi(5), + widget = wibox.container.margin + }, id = "container", - tag_label_margin, layout = wibox.layout.fixed.horizontal }, - fg = color["White"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) @@ -83,8 +65,7 @@ local list_update = function(widget, buttons, label, data, objects) tag_widget:buttons(create_buttons(buttons, object)) - local text, bg_color, bg_image, icon, args = label(object, tag_label) - tag_label:set_text(object.index) + tag_widget.container.margin.label:set_text(object.index) if object.urgent == true then tag_widget:set_bg(color["RedA200"]) tag_widget:set_fg(color["Grey900"]) @@ -97,7 +78,7 @@ local list_update = function(widget, buttons, label, data, objects) -- Set the icon for each client for _, client in ipairs(object:clients()) do - tag_label_margin:set_right(0) + tag_widget.container.margin:set_right(0) local icon = wibox.widget { { id = "icon_container", @@ -108,7 +89,6 @@ local list_update = function(widget, buttons, label, data, objects) }, widget = wibox.container.place }, - tag_icon_margin, forced_width = dpi(33), margins = dpi(6), widget = wibox.container.margin @@ -121,63 +101,65 @@ local list_update = function(widget, buttons, label, data, objects) }) end + --#region Hover_signal local old_wibox, old_cursor, old_bg tag_widget:connect_signal( "mouse::enter", function() - old_bg = tag_widget.bg - if object == awful.screen.focused().selected_tag then - tag_widget.bg = '#dddddd' .. 'dd' - else - tag_widget.bg = '#3A475C' .. 'dd' + old_bg = tag_widget.bg + if object == awful.screen.focused().selected_tag then + tag_widget.bg = '#dddddd' .. 'dd' + else + tag_widget.bg = '#3A475C' .. 'dd' + end + local w = mouse.current_wibox + if w then + old_cursor, old_wibox = w.cursor, w + w.cursor = "hand1" + end end - local w = mouse.current_wibox - if w then - old_cursor, old_wibox = w.cursor, w - w.cursor = "hand1" - end - end ) tag_widget:connect_signal( "button::press", function() - if object == awful.screen.focused().selected_tag then - tag_widget.bg = '#bbbbbb' .. 'dd' - else - tag_widget.bg = '#3A475C' .. 'dd' + if object == awful.screen.focused().selected_tag then + tag_widget.bg = '#bbbbbb' .. 'dd' + else + tag_widget.bg = '#3A475C' .. 'dd' + end end - end ) tag_widget:connect_signal( "button::release", function() - if object == awful.screen.focused().selected_tag then - tag_widget.bg = '#dddddd' .. 'dd' - else - tag_widget.bg = '#3A475C' .. 'dd' + if object == awful.screen.focused().selected_tag then + tag_widget.bg = '#dddddd' .. 'dd' + else + tag_widget.bg = '#3A475C' .. 'dd' + end end - end ) tag_widget:connect_signal( "mouse::leave", function() - tag_widget.bg = old_bg - if old_wibox then - old_wibox.cursor = old_cursor - old_wibox = nil + tag_widget.bg = old_bg + if old_wibox then + old_wibox.cursor = old_cursor + old_wibox = nil + end end - end ) + --#endregion widget:add(tag_widget) widget:set_spacing(dpi(6)) end end -local tag_list = function(s) +return function(s) return awful.widget.taglist( s, awful.widget.taglist.filter.noempty, @@ -186,49 +168,49 @@ local tag_list = function(s) {}, 1, function(t) - t:view_only() - end + t:view_only() + end ), awful.button( { modkey }, 1, function(t) - if client.focus then - client.focus:move_to_tag(t) + if client.focus then + client.focus:move_to_tag(t) + end end - end ), awful.button( {}, 3, function(t) - if client.focus then - client.focus:toggle_tag(t) + if client.focus then + client.focus:toggle_tag(t) + end end - end ), awful.button( { modkey }, 3, function(t) - if client.focus then - client.focus:toggle_tag(t) + if client.focus then + client.focus:toggle_tag(t) + end end - end ), awful.button( {}, 4, function(t) - awful.tag.viewnext(t.screen) - end + awful.tag.viewnext(t.screen) + end ), awful.button( {}, 5, function(t) - awful.tag.viewprev(t.screen) - end + awful.tag.viewprev(t.screen) + end ) ), {}, @@ -236,5 +218,3 @@ local tag_list = function(s) wibox.layout.fixed.horizontal() ) end - -return tag_list diff --git a/awesome/src/widgets/tasklist.lua b/awesome/src/widgets/tasklist.lua index a36369b..fdc219a 100644 --- a/awesome/src/widgets/tasklist.lua +++ b/awesome/src/widgets/tasklist.lua @@ -1,3 +1,8 @@ +--------------------------------- +-- This is the tasklist widget -- +--------------------------------- + +-- Awesome Libs local awful = require('awful') local wibox = require('wibox') local dpi = require('beautiful').xresources.apply_dpi @@ -83,7 +88,7 @@ local list_update = function(widget, buttons, label, data, objects) task_widget:buttons(create_buttons(buttons, object)) - local text, bg, bg_image, icon, args = label(object, task_widget.container.layout_it.title) + local text, _ = label(object, task_widget.container.layout_it.title) if object == client.focus then if text == nil or text == '' then task_widget.container.layout_it.title:set_margins(0) @@ -112,61 +117,64 @@ local list_update = function(widget, buttons, label, data, objects) widget:add(task_widget) widget:set_spacing(dpi(6)) + --#region Hover_signal local old_wibox, old_cursor, old_bg task_widget:connect_signal( "mouse::enter", function() - old_bg = task_widget.bg - if object == client.focus then - task_widget.bg = '#dddddddd' - else - task_widget.bg = '#3A475Cdd' + old_bg = task_widget.bg + if object == client.focus then + task_widget.bg = '#dddddddd' + else + task_widget.bg = '#3A475Cdd' + end + local w = mouse.current_wibox + if w then + old_cursor, old_wibox = w.cursor, w + w.cursor = "hand1" + end end - local w = mouse.current_wibox - if w then - old_cursor, old_wibox = w.cursor, w - w.cursor = "hand1" - end - end ) task_widget:connect_signal( "button::press", function() - if object == client.focus then - task_widget.bg = "#ffffffaa" - else - task_widget.bg = '#3A475Caa' + if object == client.focus then + task_widget.bg = "#ffffffaa" + else + task_widget.bg = '#3A475Caa' + end end - end ) task_widget:connect_signal( "button::release", function() - if object == client.focus then - task_widget.bg = "#ffffffdd" - else - task_widget.bg = '#3A475Cdd' + if object == client.focus then + task_widget.bg = "#ffffffdd" + else + task_widget.bg = '#3A475Cdd' + end end - end ) task_widget:connect_signal( "mouse::leave", function() - task_widget.bg = old_bg - if old_wibox then - old_wibox.cursor = old_cursor - old_wibox = nil + task_widget.bg = old_bg + if old_wibox then + old_wibox.cursor = old_cursor + old_wibox = nil + end end - end ) + --#endregion + end return widget end -local tasklist = function(s) +return function(s) return awful.widget.tasklist( s, awful.widget.tasklist.filter.currenttags, @@ -175,24 +183,24 @@ local tasklist = function(s) {}, 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() + 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 - c:emit_signal('request::activate') - c:raise() end - end ), awful.button( {}, 3, function(c) - c:kill() - end + c:kill() + end ) ), {}, @@ -200,5 +208,3 @@ local tasklist = function(s) wibox.layout.fixed.horizontal() ) end - -return tasklist diff --git a/picom.conf b/picom.conf index 746c857..fb52f10 100644 --- a/picom.conf +++ b/picom.conf @@ -1,156 +1,412 @@ -# ░█▀█░▀█▀░█▀▀░█▀█░█▄█░░░░█▀▀░█▀█░█▀█░█▀▀ -# ░█▀▀░░█░░█░░░█░█░█░█░░░░█░░░█░█░█░█░█▀▀ -# ░▀░░░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀░░▀▀▀░▀▀▀░▀░▀░▀░░ +################################# +# Shadows # +################################# + + +# Enabled client-side shadows on windows. Note desktop windows +# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow, +# unless explicitly requested using the wintypes option. # -# X compositor configuration - -# ░█▀▀░█░█░█▀█░█▀▄░█▀█░█░█ -# ░▀▀█░█▀█░█▀█░█░█░█░█░█▄█ -# ░▀▀▀░▀░▀░▀░▀░▀▀░░▀▀▀░▀░▀ - +# shadow = false shadow = true; + +# The blur radius for shadows, in pixels. (defaults to 12) +# shadow-radius = 12 shadow-radius = 12; -shadow-opacity = 0.65; -shadow-offset-x = -5; -shadow-offset-y = -6; +# The opacity of shadows. (0.0 - 1.0, defaults to 0.75) +# shadow-opacity = .75 + +# The left offset for shadows, in pixels. (defaults to -15) +# shadow-offset-x = -15 +shadow-offset-x = -7; + +# The top offset for shadows, in pixels. (defaults to -15) +# shadow-offset-y = -15 +shadow-offset-y = -7; + +# Red color value of shadow (0.0 - 1.0, defaults to 0). # shadow-red = 0 + +# Green color value of shadow (0.0 - 1.0, defaults to 0). # shadow-green = 0 + +# Blue color value of shadow (0.0 - 1.0, defaults to 0). # shadow-blue = 0 -shadow-color = "#000000"; +# Hex string color value of shadow (#000000 - #FFFFFF, defaults to #000000). This option will override options set shadow-(red/green/blue) +shadow-color = "#000000" + +# Specify a list of conditions of windows that should have no shadow. +# +# examples: +# shadow-exclude = "n:e:Notification"; +# +# shadow-exclude = [] shadow-exclude = [ - #"name = 'Notification'", - "class_g = 'Conky'", - #"class_g ?= 'Notify-osd'", - "class_g = 'Cairo-clock'", - #"class_g = 'slop'", - #"name = 'Dunst'", - #"name = 'dmenu'", - #"class_g = 'Rofi'", - "_GTK_FRAME_EXTENTS@:c", - "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'" + "name = 'Notification'", + "class_g = 'Conky'", + "class_g ?= 'Notify-osd'", + "class_g = 'Cairo-clock'", + "_GTK_FRAME_EXTENTS@:c" ]; -# shadow-exclude-reg = "x10+0+0"; -# xinerama-shadow-crop = true; +# Specify a list of conditions of windows that should have no shadow painted over, such as a dock window. +# clip-shadow-above = [] -# ░█▀▀░█▀█░█▀▄░▀█▀░█▀█░█▀▀ -# ░█▀▀░█▀█░█░█░░█░░█░█░█░█ -# ░▀░░░▀░▀░▀▀░░▀▀▀░▀░▀░▀▀▀ +# Specify a X geometry that describes the region in which shadow should not +# be painted in, such as a dock window region. Use +# shadow-exclude-reg = "x10+0+0" +# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on. +# +# shadow-exclude-reg = "" +# Crop shadow of a window fully on a particular Xinerama screen to the screen. +# xinerama-shadow-crop = false + + +################################# +# Fading # +################################# + + +# Fade windows in/out when opening/closing and when opacity changes, +# unless no-fading-openclose is used. +# fading = false fading = true; + +# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028) +# fade-in-step = 0.028 fade-in-step = 0.03; + +# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03) +# fade-out-step = 0.03 fade-out-step = 0.03; -fade-delta = 4; -fade-exclude = [ - "name *= 'polybar'" -]; +# The time between steps in fade step, in milliseconds. (> 0, defaults to 10) + fade-delta = 6 -no-fading-openclose = false; -no-fading-destroyed-argb = true; +# Specify a list of conditions of windows that should not be faded. +# fade-exclude = [] -# ░█▀█░█▀█░█▀█░█▀▀░▀█▀░▀█▀░█░█ -# ░█░█░█▀▀░█▀█░█░░░░█░░░█░░░█░ -# ░▀▀▀░▀░░░▀░▀░▀▀▀░▀▀▀░░▀░░░▀░ +# Do not fade on window open/close. +# no-fading-openclose = false +# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc. +# no-fading-destroyed-argb = false + + +################################# +# Transparency / Opacity # +################################# + + +# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0) +# inactive-opacity = 1 inactive-opacity = 1; + +# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default) +# frame-opacity = 1.0 frame-opacity = 1; + +# Let inactive opacity set by -i override the '_NET_WM_WINDOW_OPACITY' values of windows. +# inactive-opacity-override = true inactive-opacity-override = false; -active-opacity = 1.0; -inactive-dim = 0.0; -focus-exclude = [ - "class_g = 'Cairo-clock'", - "class_g ?= 'rofi'", - "class_g ?= 'slop'", - "class_g ?= 'Steam'" -]; +# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0) +# active-opacity = 1.0 -# inactive-dim-fixed = 1.0; +# Dim inactive windows. (0.0 - 1.0, defaults to 0.0) +# inactive-dim = 0.0 -opacity-rule = [ - "80:class_g = 'URxvt'", - "80:class_g = 'UXTerm'", - "80:class_g = 'XTerm'" -] +# Specify a list of conditions of windows that should never be considered focused. +# focus-exclude = [] +focus-exclude = [ "class_g = 'Cairo-clock'" ]; -# ░█▀▄░█░░░█░█░█▀▄░█▀▄░▀█▀░█▀█░█▀▀ -# ░█▀▄░█░░░█░█░█▀▄░█▀▄░░█░░█░█░█░█ -# ░▀▀░░▀▀▀░▀▀▀░▀░▀░▀░▀░▀▀▀░▀░▀░▀▀▀ +# Use fixed inactive dim value, instead of adjusting according to window opacity. +# inactive-dim-fixed = 1.0 -blur: { - method = "dual_kawase"; - strength = 5.0; - deviation = 1.0; - kernel = "11x11gaussian"; -} +# Specify a list of opacity rules, in the format `PERCENT:PATTERN`, +# like `50:name *= "Firefox"`. picom-trans is recommended over this. +# Note we don't make any guarantee about possible conflicts with other +# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows. +# example: +# opacity-rule = [ "80:class_g = 'URxvt'" ]; +# +# opacity-rule = [] -blur-background = false; -blur-background-frame = true; -blur-background-fixed = true; -# blur-kern = "3x3box"; -blur-background-exclude = [ - #"name *= 'polybar'", - "window_type = 'dock'", - "_GTK_FRAME_EXTENTS@:c" -]; +################################# +# Corners # +################################# -# ░█▀▀░█▀▀░█▀█░█▀▀░█▀▄░█▀█░█░░░░░█▀▀░█▀▀░▀█▀░▀█▀░▀█▀░█▀█░█▀▀░█▀▀ -# ░█░█░█▀▀░█░█░█▀▀░█▀▄░█▀█░█░░░░░▀▀█░█▀▀░░█░░░█░░░█░░█░█░█░█░▀▀█ -# ░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀░▀░▀░▀░▀▀▀░░░▀▀▀░▀▀▀░░▀░░░▀░░▀▀▀░▀░▀░▀▀▀░▀▀▀ +# Sets the radius of rounded window corners. When > 0, the compositor will +# round the corners of windows. Does not interact well with +# `transparent-clipping`. +#corner-radius = 10 -#corner-radius = 10.0 +# Exclude conditions for rounded corners. rounded-corners-exclude = [ - "name *= 'Awesome drawin'", - "name *= 'polybar'", - "name *= 'rofi'", - "name *= 'Dunst'", - "name *= 'dmenu'", - "_GTK_FRAME_EXTENTS@:c" -] -round-borders = 1 -daemon = false; + "window_type = 'dock'", + "window_type = 'desktop'" +]; + + +################################# +# Background-Blurring # +################################# + + +# Parameters for background blurring, see the *BLUR* section for more information. +blur-method = "dual_kawase" +blur-size = 12 +# +# blur-deviation = false +# +blur-strength = 5 + +# Blur background of semi-transparent / ARGB windows. +# Bad in performance, with driver-dependent behavior. +# The name of the switch may change without prior notifications. +# +blur-background = false + +# Blur background of windows when the window frame is not opaque. +# Implies: +# blur-background +# Bad in performance, with driver-dependent behavior. The name may change. +# +blur-background-frame = true + +# Use fixed blur strength rather than adjusting according to window opacity. +blur-background-fixed = true + + +# Specify the blur convolution kernel, with the following format: +# example: +# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"; +# +# blur-kern = "" +blur-kern = "11x11gaussian"; + + +# Exclude conditions for background blur. +# blur-background-exclude = [] +blur-background-exclude = [ + "window_type = 'dock'", + "window_type = 'desktop'", + "_GTK_FRAME_EXTENTS@:c" +]; + +################################# +# General Settings # +################################# + +# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers. +# daemon = false + +# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`. +# `xrender` is the default one. +# +# backend = "glx" backend = "glx"; + +# Enable/disable VSync. +# vsync = false vsync = true; -dbus = false; + +# Enable remote control via D-Bus. See the *D-BUS API* section below for more details. +# dbus = false + +# Try to detect WM windows (a non-override-redirect window with no +# child that has 'WM_STATE') and mark them as active. +# +# mark-wmwin-focused = false mark-wmwin-focused = true; + +# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused. +# mark-ovredir-focused = false mark-ovredir-focused = true; + +# Try to detect windows with rounded corners and don't consider them +# shaped windows. The accuracy is not very high, unfortunately. +# +# detect-rounded-corners = false detect-rounded-corners = true; + +# Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers +# not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows. +# +# detect-client-opacity = false detect-client-opacity = true; -refresh-rate = 0; -# use-ewmh-active-win = true; -# unredir-if-possible = false; -# unredir-if-possible-delay = 0; -unredir-if-possible-exclude = []; +# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window, +# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, +# provided that the WM supports it. +# +# use-ewmh-active-win = false +# Unredirect all windows if a full-screen opaque window is detected, +# to maximize performance for full-screen windows. Known to cause flickering +# when redirecting/unredirecting windows. +# +# unredir-if-possible = false + +# Delay before unredirecting the window, in milliseconds. Defaults to 0. +# unredir-if-possible-delay = 0 + +# Conditions of windows that shouldn't be considered full-screen for unredirecting screen. +# unredir-if-possible-exclude = [] + +# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows +# in the same group focused at the same time. +# +# detect-transient = false detect-transient = true; -detect-client-leader = true; -resize-damage = 1; -invert-color-include = []; +# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same +# group focused at the same time. This usually means windows from the same application +# will be considered focused or unfocused at the same time. +# 'WM_TRANSIENT_FOR' has higher priority if detect-transient is enabled, too. +# +# detect-client-leader = false -glx-no-stencil = true; -# glx-no-rebind-pixmap = false; +# Resize damaged region by a specific number of pixels. +# A positive value enlarges it while a negative one shrinks it. +# If the value is positive, those additional pixels will not be actually painted +# to screen, only used in blur calculation, and such. (Due to technical limitations, +# with use-damage, those pixels will still be incorrectly painted to screen.) +# Primarily used to fix the line corruption issues of blur, +# in which case you should use the blur radius value here +# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`, +# with a 5x5 one you use `--resize-damage 2`, and so on). +# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly. +# +# resize-damage = 1 + +# Specify a list of conditions of windows that should be painted with inverted color. +# Resource-hogging, and is not well tested. +# +# invert-color-include = [] + +# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer. +# Might cause incorrect opacity when rendering transparent content (but never +# practically happened) and may not work with blur-background. +# My tests show a 15% performance boost. Recommended. +# +glx-no-stencil = true + +# GLX backend: Avoid rebinding pixmap on window damage. +# Probably could improve performance on rapid window content changes, +# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.). +# Recommended if it works. +# +# glx-no-rebind-pixmap = false + +# Disable the use of damage information. +# This cause the whole screen to be redrawn everytime, instead of the part of the screen +# has actually changed. Potentially degrades the performance, but might fix some artifacts. +# The opposing option is use-damage +# +# no-use-damage = false use-damage = true; -# xrender-sync-fence = true; -# glx-fshader-win = ""; -# force-win-blend = false; +# Use X Sync fence to sync clients' draw calls, to make sure all draw +# calls are finished before picom starts drawing. Needed on nvidia-drivers +# with GLX backend for some users. +# +# xrender-sync-fence = false -# no-ewmh-fullscreen = false; -# max-brightness = 1.0; +# GLX backend: Use specified GLSL fragment shader for rendering window contents. +# See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl` +# in the source tree for examples. +# +# glx-fshader-win = "" -transparent-clipping = false; +# Force all windows to be painted with blending. Useful if you +# have a glx-fshader-win that could turn opaque pixels transparent. +# +# force-win-blend = false -show-all-xerrors = true; +# Do not use EWMH to detect fullscreen windows. +# Reverts to checking if a window is fullscreen based only on its size and coordinates. +# +# no-ewmh-fullscreen = false -wintypes: { - tooltip = { fade = true; focus = false; }; - normal = { shadow = true; blur-background = false; }; - dock = { shadow = true; blur-background = false;}; - desktop = { shadow = true; blur-background = false; }; +# Dimming bright windows so their brightness doesn't exceed this set value. +# Brightness of a window is estimated by averaging all pixels in the window, +# so this could comes with a performance hit. +# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0) +# +# max-brightness = 1.0 + +# Make transparent windows clip other windows like non-transparent windows do, +# instead of blending on top of them. +# +# transparent-clipping = false + +# Set the log level. Possible values are: +# "trace", "debug", "info", "warn", "error" +# in increasing level of importance. Case doesn't matter. +# If using the "TRACE" log level, it's better to log into a file +# using *--log-file*, since it can generate a huge stream of logs. +# +# log-level = "debug" +log-level = "warn"; + +# Set the log file. +# If *--log-file* is never specified, logs will be written to stderr. +# Otherwise, logs will to written to the given file, though some of the early +# logs might still be written to the stderr. +# When setting this option from the config file, it is recommended to use an absolute path. +# +# log-file = "/path/to/your/log/file" + +# Show all X errors (for debugging) +# show-all-xerrors = false + +# Write process ID to a file. +# write-pid-path = "/path/to/your/log/file" + +# Window type settings +# +# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard: +# "unknown", "desktop", "dock", "toolbar", "menu", "utility", +# "splash", "dialog", "normal", "dropdown_menu", "popup_menu", +# "tooltip", "notification", "combo", and "dnd". +# +# Following per window-type options are available: :: +# +# fade, shadow::: +# Controls window-type-specific shadow and fade settings. +# +# opacity::: +# Controls default opacity of the window type. +# +# focus::: +# Controls whether the window of this type is to be always considered focused. +# (By default, all window types except "normal" and "dialog" has this on.) +# +# full-shadow::: +# Controls whether shadow is drawn under the parts of the window that you +# normally won't be able to see. Useful when the window has parts of it +# transparent, and you want shadows in those areas. +# +# clip-shadow-above::: +# Controls wether shadows that would have been drawn above the window should +# be clipped. Useful for dock windows that should have no shadow painted on top. +# +# redir-ignore::: +# Controls whether this type of windows should cause screen to become +# redirected again after been unredirected. If you have unredir-if-possible +# set, and doesn't want certain window to cause unnecessary screen redirection, +# you can set this to `true`. +# +wintypes: +{ + tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; }; + dock = { shadow = true; clip-shadow-above = false; } + dnd = { shadow = false; } + popup_menu = { opacity = 0.8; } + dropdown_menu = { opacity = 0.8; } };