From e727015e811bcef6cc900afb43ba5b190ec0f89a Mon Sep 17 00:00:00 2001 From: Rene Date: Fri, 29 Jul 2022 13:21:56 +0200 Subject: [PATCH] Add application launcher and rewritten window switcher, remove rofi as its no longer needed and replaced by widgets. Fixed a lot of bugs and weird behaviour --- awesome/rc.lua | 3 +- .../icons/weather/weather-clouds-night.svg | 5 + awesome/src/assets/rules.txt | 2 +- awesome/src/bindings/global_keys.lua | 16 +- awesome/src/core/notifications.lua | 9 +- awesome/src/core/signals.lua | 72 +++-- awesome/src/lib/overflow_widget/overflow.lua | 4 +- .../application_launcher/application.lua | 215 +++++++++++++- .../src/modules/application_launcher/init.lua | 25 +- .../application_launcher/searchbar.lua | 221 +++++++++++++- awesome/src/modules/brightness_osd.lua | 12 +- awesome/src/modules/crylia_bar/dock.lua | 64 +++-- awesome/src/modules/init.lua | 6 +- .../src/modules/notification-center/init.lua | 15 +- .../notification-center/notification_list.lua | 8 +- .../modules/notification-center/song_info.lua | 13 +- .../notification-center/status_bars.lua | 13 +- awesome/src/modules/titlebar.lua | 15 +- awesome/src/modules/volume_controller.lua | 8 +- awesome/src/modules/volume_osd.lua | 15 +- awesome/src/modules/window_switcher/init.lua | 270 +----------------- .../window_switcher/window_elements.lua | 179 ++++++++++++ awesome/src/theme/theme_config.lua | 33 ++- awesome/src/theme/user_config.lua | 8 +- awesome/src/tools/desktop_parser.lua | 103 ++++++- awesome/src/tools/helpers/audio.lua | 9 + awesome/src/tools/helpers/cpu_temp.lua | 21 +- awesome/src/tools/hex_to_rgba.lua | 8 + awesome/src/tools/xdg_icon_lookup.lua | 22 +- awesome/src/widgets/audio.lua | 3 + awesome/src/widgets/battery.lua | 5 +- awesome/src/widgets/layout_list.lua | 2 +- awesome/src/widgets/systray.lua | 2 +- rofi/rofi.rasi | 112 -------- rofi/window.rasi | 85 ------ 35 files changed, 964 insertions(+), 639 deletions(-) create mode 100644 awesome/src/assets/icons/weather/weather-clouds-night.svg create mode 100644 awesome/src/modules/window_switcher/window_elements.lua create mode 100644 awesome/src/tools/hex_to_rgba.lua delete mode 100644 rofi/rofi.rasi delete mode 100644 rofi/window.rasi diff --git a/awesome/rc.lua b/awesome/rc.lua index a8ef099..9125edb 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -18,5 +18,6 @@ require("src.bindings.global_buttons") require("src.bindings.bind_to_tags") require("src.modules.init") require("src.tools.helpers.init") ---require("src.tools.auto_starter")(User_config.autostart) +require("src.tools.hex_to_rgba") +require("src.tools.auto_starter")(User_config.autostart) require("src.tools.dbus.bluetooth_dbus")() diff --git a/awesome/src/assets/icons/weather/weather-clouds-night.svg b/awesome/src/assets/icons/weather/weather-clouds-night.svg new file mode 100644 index 0000000..92ac071 --- /dev/null +++ b/awesome/src/assets/icons/weather/weather-clouds-night.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/awesome/src/assets/rules.txt b/awesome/src/assets/rules.txt index bf4237c..d1f8483 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;steam_app_431960;Viewer,;Viewer,;Nvidia-settings;openrgb; \ 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;Viewer,;Viewer,;Nvidia-settings;openrgb;Minecraft;Pavucontrol;jamesdsp; \ No newline at end of file diff --git a/awesome/src/bindings/global_keys.lua b/awesome/src/bindings/global_keys.lua index 873a0a8..16e2f53 100644 --- a/awesome/src/bindings/global_keys.lua +++ b/awesome/src/bindings/global_keys.lua @@ -9,7 +9,7 @@ local modkey = User_config.modkey awful.keygrabber { keybindings = { awful.key { - modifiers = { modkey }, + modifiers = { "Mod1" }, key = "Tab", on_press = function() awesome.emit_signal("window_switcher::select_next") @@ -18,13 +18,13 @@ awful.keygrabber { }, root_keybindings = { awful.key { - modifiers = { modkey }, + modifiers = { "Mod1" }, key = "Tab", on_press = function() end } }, - stop_key = "Mod4", + stop_key = "Mod1", stop_event = "release", start_callback = function() awesome.emit_signal("toggle_window_switcher") @@ -182,7 +182,7 @@ return gears.table.join( { modkey }, "#40", function() - awful.spawn("rofi -show drun -theme ~/.config/rofi/rofi.rasi") + awesome.emit_signal("application_launcher::show") end, { descripton = "Application launcher", group = "Application" } ), @@ -302,14 +302,6 @@ return gears.table.join( end, { description = "Toggle keyboard layout", group = "System" } ), - awful.key( - { modkey }, - "#27", - function() - awesome.emit_signal("application_laucher::show") - end, - { description = "show application launcher", group = "System" } - ), awful.key( { modkey }, "#22", diff --git a/awesome/src/core/notifications.lua b/awesome/src/core/notifications.lua index d70e638..cf6f9f1 100644 --- a/awesome/src/core/notifications.lua +++ b/awesome/src/core/notifications.lua @@ -237,7 +237,7 @@ naughty.connect_signal( widget = wibox.container.arcchart, id = "arc_chart" }, - id = "background", + id = "background1", fg = Theme_config.notification.fg_close, widget = wibox.container.background }, @@ -245,7 +245,7 @@ naughty.connect_signal( width = dpi(20), height = dpi(20), widget = wibox.container.constraint, - id = "const" + id = "const1" }, margins = dpi(10), widget = wibox.container.margin, @@ -336,8 +336,7 @@ naughty.connect_signal( widget = wibox.container.background } - 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 close = w_template:get_children_by_id("background1")[1] local arc = close.arc_chart local timeout = n.timeout @@ -378,7 +377,7 @@ naughty.connect_signal( ) end - Hover_signal(close, Theme_config.notification.bg_close, Theme_config.notification.fg_close) + Hover_signal(close, nil, Theme_config.notification.fg_close) close:connect_signal( "button::press", diff --git a/awesome/src/core/signals.lua b/awesome/src/core/signals.lua index 4f4ebd6..33c0479 100644 --- a/awesome/src/core/signals.lua +++ b/awesome/src/core/signals.lua @@ -2,6 +2,7 @@ -- Awesome Libs local awful = require("awful") local gears = require("gears") +local wibox = require("wibox") screen.connect_signal( "added", @@ -30,6 +31,9 @@ client.connect_signal( gears.shape.rounded_rect(cr, width, height, 10) end end + if c.class == "Brave-browser" then + c.floating = false + end end ) @@ -78,25 +82,33 @@ client.connect_signal( ) --- Takes a wibox.container.background and connects four signals to it ----@diagnostic disable-next-line: undefined-doc-name ----@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 +---@param widget wibox.container.background +---@param bg string | nil +---@param fg string | nil +---@param border_color string | nil +function Hover_signal(widget, bg, fg, border_color) + local old_wibox, old_cursor, old_bg, old_fg, old_border + + local r, g, b + + bg = bg or nil + fg = fg or nil + border_color = border_color or nil local mouse_enter = function() - if bg then - old_bg = widget.bg - if string.len(bg) == 7 then - widget.bg = bg .. 'dd' - else - widget.bg = bg - end + if bg ~= nil then + _, r, g, b, _ = widget.bg:get_rgba() + old_bg = RGB_to_hex(r, g, b) + widget.bg = bg .. "dd" end if fg then - old_fg = widget.fg - widget.fg = fg + _, r, g, b, _ = widget.fg:get_rgba() + old_fg = RGB_to_hex(r, g, b) + widget.fg = fg .. "dd" + end + if border_color then + old_border = widget.border_color + widget.border_color = border_color .. "dd" end local w = mouse.current_wibox if w then @@ -107,13 +119,7 @@ function Hover_signal(widget, bg, fg) local button_press = function() if bg then - if bg then - if string.len(bg) == 7 then - widget.bg = bg .. 'bb' - else - widget.bg = bg - end - end + widget.bg = bg end if fg then widget.fg = fg @@ -122,13 +128,7 @@ function Hover_signal(widget, bg, fg) local button_release = function() if bg then - if bg then - if string.len(bg) == 7 then - widget.bg = bg .. 'dd' - else - widget.bg = bg - end - end + widget.bg = bg end if fg then widget.fg = fg @@ -142,26 +142,22 @@ function Hover_signal(widget, bg, fg) if fg then widget.fg = old_fg end + if border_color then + widget.border_color = old_border + end if old_wibox then old_wibox.cursor = old_cursor old_wibox = nil end end - widget:disconnect_signal("mouse::enter", mouse_enter) - + --[[ 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: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/lib/overflow_widget/overflow.lua b/awesome/src/lib/overflow_widget/overflow.lua index 58c3acb..7e36a5d 100644 --- a/awesome/src/lib/overflow_widget/overflow.lua +++ b/awesome/src/lib/overflow_widget/overflow.lua @@ -426,7 +426,7 @@ local function build_grabber(container, initial_x, initial_y, geo) end local x, y = matrix:transform_point(mouse.x, mouse.y) - local pos = is_y and x and y + local pos = is_y and y or x container:set_scroll_factor((start_pos + (pos - start)) / bar_interval) return true @@ -527,3 +527,5 @@ function overflow.vertical(...) end return setmetatable(overflow, overflow.mt) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/awesome/src/modules/application_launcher/application.lua b/awesome/src/modules/application_launcher/application.lua index fe4299c..9f317d9 100644 --- a/awesome/src/modules/application_launcher/application.lua +++ b/awesome/src/modules/application_launcher/application.lua @@ -5,17 +5,226 @@ -- Awesome Libs local awful = require("awful") local dpi = require("beautiful").xresources.apply_dpi +local desktop_parser = require("src.tools.desktop_parser") local gears = require("gears") local wibox = require("wibox") return function() - local application_list = wibox.widget { + local desktop_files = desktop_parser.Get_all_visible_desktop() + + local application_grid = wibox.widget { homogenous = true, expand = false, spacing = dpi(10), - layout = wibox.container.grid + id = "grid", + forced_num_cols = 8, + forced_num_rows = 7, + orientation = "vertical", + layout = wibox.layout.grid + } + -- Selected application position, default is first at 1,1 + -- The typo *might* be intentional + local curser = { + x = 1, + y = 1 } - return application_list + local filter = "" + + ---Executes only once to create a widget from each desktop file + ---@return table widgets Unsorted widget table + local function get_applications_from_file() + local list = {} + for _, file in ipairs(desktop_files) do + if not file.nodisplay then + local app_widget = wibox.widget { + { + { + { + { + { -- Icon + valign = "center", + halign = "center", + image = xdg_icon_lookup:find_icon(file.icon, 64) or "/home/crylia/Bilder/yes.png", + resize = true, + widget = wibox.widget.imagebox + }, + height = dpi(64), + width = dpi(64), + strategy = "exact", + widget = wibox.container.constraint + }, + { + { -- Name + text = file.name, + align = "center", + valign = "center", + widget = wibox.widget.textbox + }, + strategy = "exact", + width = dpi(170), + -- Prevents widget from overflowing + height = dpi(40), + widget = wibox.container.constraint + }, + layout = wibox.layout.fixed.vertical + }, + halign = "center", + valign = "center", + widget = wibox.container.place + }, + margins = dpi(10), + widget = wibox.container.margin + }, + name = file.name, + comment = file.comment, + exec = file.exec, + keywords = file.keywords, + categories = file.categories, + terminal = file.terminal, + border_color = Theme_config.application_launcher.application.border_color, + border_width = Theme_config.application_launcher.application.border_width, + bg = Theme_config.application_launcher.application.bg, + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, dpi(8)) + end, + widget = wibox.container.background + } + + -- Execute command on left click and hide launcher + app_widget:buttons( + gears.table.join( + awful.button( + {}, + 1, + nil, + function() + awful.spawn.with_shell(file.exec) + awesome.emit_signal("application_launcher::show") + end + ) + ) + ) + table.insert(list, app_widget) + end + end + return list + end + + -- Table to hold all application widgets unsorted + local application_list = get_applications_from_file() + + ---Function to filter the applications and sort them into a widget grid + ---@param search_filter string Filter string from the searchbar + ---@return wibox.layout.grid wibox.layout.grid Sorted grid with all applications matching the filter + local function get_applications(search_filter) + filter = search_filter or filter + --Clear grid from previous widgets + application_grid:reset() + -- Reset to first position + curser = { + x = 1, + y = 1 + } + for _, application in ipairs(application_list) do + -- Match the filter + if string.match(string.lower(application.name), string.lower(filter)) or + string.match(string.lower(application.categories), string.lower(filter)) or + string.match(string.lower(application.keywords), string.lower(filter)) then + application_grid:add(application) + + -- Get the current position in the grid of the application as a table + local pos = application_grid:get_widget_position(application) + + -- Check if the curser is currently at the same position as the application + awesome.connect_signal( + "update::selected", + function() + if curser.y == pos.row and curser.x == pos.col then + application.border_color = Theme_config.application_launcher.application.border_color_active + else + application.border_color = Theme_config.application_launcher.application.border_color + end + end + ) + awesome.emit_signal("update::selected") + Hover_signal(application, Theme_config.application_launcher.application.bg, + Theme_config.application_launcher.application.fg, application.border_color) + end + end + + return application_grid + end + + application_grid = get_applications(filter) + + awesome.connect_signal( + "application::left", + function() + curser.x = curser.x - 1 + if curser.x < 1 then + curser.x = 1 + end + awesome.emit_signal("update::selected") + end + ) + + awesome.connect_signal( + "application::right", + function() + curser.x = curser.x + 1 + local _, grid_cols = application_grid:get_dimension() + if curser.x > grid_cols then + curser.x = grid_cols + end + awesome.emit_signal("update::selected") + end + ) + + awesome.connect_signal( + "application::up", + function() + curser.y = curser.y - 1 + if curser.y < 1 then + curser.y = 1 + end + awesome.emit_signal("update::selected") + end + ) + + awesome.connect_signal( + "application::down", + function() + curser.y = curser.y + 1 + local grid_rows, _ = application_grid:get_dimension() + if curser.y > grid_rows then + curser.y = grid_rows + end + awesome.emit_signal("update::selected") + end + ) + + awesome.connect_signal( + "update::application_list", + function(filter) + application_grid = get_applications(filter) + end + ) + + awesome.connect_signal( + "application_launcher::execute", + function() + awesome.emit_signal("searchbar::stop") + + local selected_widget = application_grid:get_widgets_at(curser.y, curser.x)[1] + if selected_widget.terminal then + awful.spawn.with_shell(selected_widget.exec) + else + awful.spawn(selected_widget.exec) + end + end + ) + + return application_grid end diff --git a/awesome/src/modules/application_launcher/init.lua b/awesome/src/modules/application_launcher/init.lua index e9e79a8..5160b39 100644 --- a/awesome/src/modules/application_launcher/init.lua +++ b/awesome/src/modules/application_launcher/init.lua @@ -13,20 +13,26 @@ local searchbar = require("src.modules.application_launcher.searchbar")() return function(s) - local applicaton_launcher = wibox.widget { { { searchbar, - wibox.widget.inputtextbox, - application_grid, + { + application_grid, + spacing = dpi(10), + layout = require("src.lib.overflow_widget.overflow").vertical, + scrollbar_width = 0, + step = dpi(50), + id = "scroll_bar", + }, + spacing = dpi(10), layout = wibox.layout.fixed.vertical }, margins = dpi(20), widget = wibox.container.margin }, - height = dpi(600), - width = dpi(800), + height = s.geometry.height / 100 * 60, + width = s.geometry.width / 100 * 60, strategy = "exact", widget = wibox.container.constraint } @@ -52,9 +58,14 @@ return function(s) } awesome.connect_signal( - "application_laucher::show", + "application_launcher::show", function() - application_container.visible = not application_container.visible + if mouse.screen == s then + application_container.visible = not application_container.visible + end + if application_container.visible then + awesome.emit_signal("searchbar::start") + end end ) diff --git a/awesome/src/modules/application_launcher/searchbar.lua b/awesome/src/modules/application_launcher/searchbar.lua index 2015305..b5eacc4 100644 --- a/awesome/src/modules/application_launcher/searchbar.lua +++ b/awesome/src/modules/application_launcher/searchbar.lua @@ -6,42 +6,62 @@ local awful = require("awful") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") +local gfs = gears.filesystem +local gtable = gears.table +local gdebug = gears.debug +local gstring = gears.string +local keygrabber = require("awful.keygrabber") local wibox = require("wibox") local icondir = awful.util.getdir("config") .. "src/assets/icons/application_launcher/searchbar/" +local kgrabber + return function() local searchbar = wibox.widget { { { - { - { -- Search icon + { -- Search icon + { { resize = false, - image = icondir .. "search.svg", + valign = "center", + halign = "center", + image = gears.color.recolor_image(icondir .. "search.svg", + Theme_config.application_launcher.searchbar.icon_color), widget = wibox.widget.imagebox }, - strategy = "exact", - widget = wibox.container.constraint + bg = Theme_config.application_launcher.searchbar.icon_background, + widget = wibox.container.background }, + strategy = "exact", + width = dpi(30), + widget = wibox.container.constraint + }, + { { fg = Theme_config.application_launcher.searchbar.fg_hint, - text = "Search", + markup = "Search", valign = "center", align = "center", - widget = wibox.widget.textbox + widget = wibox.widget.textbox, + id = "search_hint" }, - widget = wibox.layout.fixed.horizontal + margins = dpi(5), + widget = wibox.container.margin, + id = "s_margin" }, - margins = dpi(5), - widget = wibox.container.margin + widget = wibox.layout.fixed.horizontal, + id = "s_layout" }, bg = Theme_config.application_launcher.searchbar.bg, fg = Theme_config.application_launcher.searchbar.fg, border_color = Theme_config.application_launcher.searchbar.border_color, border_width = Theme_config.application_launcher.searchbar.border_width, - widget = wibox.container.background + widget = wibox.container.background, + shape = Theme_config.application_launcher.searchbar.shape, + id = "s_background" }, width = dpi(400), height = dpi(40), @@ -49,5 +69,184 @@ return function() widget = wibox.container.constraint } + local old_wibox, old_cursor + local mouse_enter = function() + local w = mouse.current_wibox + if w then + old_cursor, old_wibox = w.cursor, w + w.cursor = "xterm" + end + end + + local mouse_leave = function() + old_wibox.cursor = old_cursor + old_wibox = nil + end + + searchbar:disconnect_signal("mouse::enter", mouse_enter) + searchbar:disconnect_signal("mouse::leave", mouse_leave) + searchbar:connect_signal("mouse::enter", mouse_enter) + searchbar:connect_signal("mouse::leave", mouse_leave) + + local function have_multibyte_char_at(text, position) + return #text:sub(position, position) == -1 + end + + local search_text = searchbar:get_children_by_id("search_hint")[1] + + local function promt_text_with_cursor(text, cursor_pos) + local char, spacer, text_start, text_end + + local cursor_color = Theme_config.application_launcher.searchbar.bg_cursor + local text_color = Theme_config.application_launcher.searchbar.fg_cursor + + if text == "" then + return "Search" + end + + if #text < cursor_pos then + char = " " + spacer = "" + text_start = gstring.xml_escape(text) + text_end = "" + else + local offset = 0 + if have_multibyte_char_at(text, cursor_pos) then + offset = 1 + end + char = gstring.xml_escape(text:sub(cursor_pos, cursor_pos + offset)) + spacer = " " + text_start = gstring.xml_escape(text:sub(1, cursor_pos - 1)) + text_end = gstring.xml_escape(text:sub(cursor_pos + offset + 1)) + end + + return text_start .. + "" .. char .. "" .. text_end .. spacer + end + + local text_string = "" + + ---Start a new keygrabber to simulate an input textbox + local function keygrabber_start() + local cur_pos = #text_string + 1 + + --Draws the string on each keypress + local function update() + search_text:set_markup(promt_text_with_cursor(text_string, cur_pos)) + --Send the string over to the application to filter applications + awesome.emit_signal("update::application_list", text_string) + end + + update() + + kgrabber = keygrabber.run( + function(modifiers, key, event) + awesome.connect_signal("searchbar::stop", function() + keygrabber.stop(kgrabber) + awesome.emit_signal("application_launcher::kgrabber_start") + end) + + local mod = {} + for _, v in ipairs(modifiers) do + mod[v] = true + end + + if event ~= "press" then + return + end + + --Escape cases + if (mod.Control and (key == "c" or key == "g")) + or (not mod.Control and key == "Escape") then + keygrabber.stop(kgrabber) + search_text:set_markup(promt_text_with_cursor("", 1)) + text_string = "" + awesome.emit_signal("application_launcher::show") + elseif (not mod.Control and key == "Return") or + (not mod.Control and key == "KP_Enter") then + keygrabber.stop(kgrabber) + searchbar.s_background.border_color = Theme_config.application_launcher.searchbar.border_color + searchbar.s_background.fg = Theme_config.application_launcher.searchbar.fg_hint + search_text:set_markup(promt_text_with_cursor("", 1)) + text_string = "" + awesome.emit_signal("application_launcher::execute") + awesome.emit_signal("application_launcher::show") + end + + if mod.Control then + elseif mod.Mod1 or mod.Mod3 then + else + --Delete character to the left and move cursor + if key == "BackSpace" then + if cur_pos > 1 then + local offset = 0 + if have_multibyte_char_at(text_string, cur_pos - 1) then + offset = 1 + end + text_string = text_string:sub(1, cur_pos - 2 - offset) .. text_string:sub(cur_pos) + cur_pos = cur_pos - 1 - offset + end + update() + --Delete character to the right + elseif key == "Delete" then + text_string = text_string:sub(1, cur_pos - 1) .. text_string:sub(cur_pos + 1) + update() + -- Move cursor to the left + elseif key == "Left" then + --cur_pos = cur_pos - 1 + awesome.emit_signal("application::left") + -- Move cursor to the right + elseif key == "Right" then + --cur_pos = cur_pos + 1 + awesome.emit_signal("application::right") + elseif key == "Up" then + awesome.emit_signal("application::up") + elseif key == "Down" then + awesome.emit_signal("application::down") + else + --Add key at cursor position + if key:wlen() == 1 then + text_string = text_string:sub(1, cur_pos - 1) .. key .. text_string:sub(cur_pos) + cur_pos = cur_pos + #key + end + update() + end + --Make sure cursor can't leave string bounds + if cur_pos < 1 then + cur_pos = 1 + elseif cur_pos > #text_string + 1 then + cur_pos = #text_string + 1 + end + end + end + ) + end + + --Start the keygrabber when the searchbar is left clicked + searchbar:buttons(gears.table.join( + awful.button({}, 1, function() + if not awful.keygrabber.is_running then + keygrabber_start() + searchbar.s_background.border_color = Theme_config.application_launcher.searchbar.border_active + searchbar.s_background.fg = Theme_config.application_launcher.searchbar.fg + search_text:set_markup(promt_text_with_cursor("", 1)) + end + end) + )) + + awesome.connect_signal( + "searchbar::start", + function() + if not awful.keygrabber.is_running then + keygrabber_start() + searchbar.s_background.border_color = Theme_config.application_launcher.searchbar.border_active + searchbar.s_background.fg = Theme_config.application_launcher.searchbar.fg + search_text:set_markup(promt_text_with_cursor("", 1)) + end + + end + ) + return searchbar end diff --git a/awesome/src/modules/brightness_osd.lua b/awesome/src/modules/brightness_osd.lua index 1681c77..b442436 100644 --- a/awesome/src/modules/brightness_osd.lua +++ b/awesome/src/modules/brightness_osd.lua @@ -115,11 +115,13 @@ return function(s) awesome.connect_signal( "brightness::rerun", function() - brightness_container.visible = true - if hide_brightness_osd.started then - hide_brightness_osd:again() - else - hide_brightness_osd:start() + if mouse.screen == s then + brightness_container.visible = true + if hide_brightness_osd.started then + hide_brightness_osd:again() + else + hide_brightness_osd:start() + end end end ) diff --git a/awesome/src/modules/crylia_bar/dock.lua b/awesome/src/modules/crylia_bar/dock.lua index 3a0e249..48a95a0 100644 --- a/awesome/src/modules/crylia_bar/dock.lua +++ b/awesome/src/modules/crylia_bar/dock.lua @@ -29,8 +29,8 @@ return function(screen, programs) }, id = "icon_container", strategy = "exact", - width = size, - height = size, + width = dpi(size), + height = dpi(size), widget = wibox.container.constraint }, margins = dpi(5), @@ -58,8 +58,7 @@ return function(screen, programs) end end - Hover_signal(dock_element.background, Theme_config.dock.element_focused_hover_bg, - Theme_config.dock.element_focused_hover_fg) + Hover_signal(dock_element.background, Theme_config.dock.element_focused_hover_bg) dock_element:connect_signal( "button::press", @@ -111,7 +110,7 @@ return function(screen, programs) local dock_elements = { layout = wibox.layout.fixed.horizontal } for i, p in ipairs(pr) do - dock_elements[i] = create_dock_element(desktop_parser(p), User_config.dock_icon_size) + dock_elements[i] = create_dock_element(desktop_parser.Get_desktop_values(p), User_config.dock_icon_size) end return dock_elements @@ -141,10 +140,10 @@ return function(screen, programs) local indicators = { layout = wibox.layout.flex.horizontal, spacing = dpi(5) } local col = Theme_config.dock.indicator_bg for i, c in ipairs(clients) do - local icon = desktop_parser(pr) + local icon = desktop_parser.Get_desktop_values(pr) if icon then - local icon_name = icon["Icon"] or "" - if icon_name:match(string.lower(c.class or c.name or nil)) then + local icon_name = string.lower(icon["Icon"] or "") + if icon_name:match(string.lower(c.class or c.name)) then if c == client.focus then col = Theme_config.dock.indicator_focused_bg elseif c.urgent then @@ -171,7 +170,7 @@ return function(screen, programs) container[index] = wibox.widget { indicators, forced_height = dpi(5), - forced_width = dpi(50), + forced_width = dpi(User_config.dock_icon_size), left = dpi(5), right = dpi(5), widget = wibox.container.margin, @@ -193,28 +192,36 @@ return function(screen, programs) local function check_for_dock_hide(s) local clients_on_tag = s.selected_tag:clients() - for _, client in ipairs(clients_on_tag) do - if client.fullscreen then - dock.visible = false - fakedock.visible = false - else - fakedock.visible = true - end - end + + -- If there is no client on the current tag show the dock if #clients_on_tag < 1 then dock.visible = true return end + + -- If there is a maximized client hide the dock and if fullscreened hide the activation area + for _, client in ipairs(clients_on_tag) do + if client.maximized or client.fullscreen then + dock.visible = false + if client.fullscreen then + fakedock.visible = false + awesome.emit_signal("notification_center_activation::toggle", s, false) + end + elseif not client.fullscreen then + fakedock.visible = true + awesome.emit_signal("notification_center_activation::toggle", s, true) + end + end + + + if s == mouse.screen then local minimized = false for _, c in ipairs(clients_on_tag) do - if c.maximized or c.fullscreen then - dock.visible = false - return - end if c.minimized then minimized = true else + minimized = false local y = c:geometry().y local h = c.height if (y + h) >= s.geometry.height - User_config.dock_icon_size - 35 then @@ -245,15 +252,16 @@ return function(screen, programs) fakedock:connect_signal( "mouse::enter", function() - for _, c in ipairs(screen.clients) do - if not c.fullscreen then - dock_intelligent_hide:stop() - dock.visible = true - end - end if #screen.clients < 1 then dock.visible = true dock_intelligent_hide:stop() + return + end + for _, c in ipairs(screen.clients) do + if not c.fullscreen then + dock.visible = true + dock_intelligent_hide:stop() + end end end ) @@ -316,8 +324,8 @@ return function(screen, programs) dock:connect_signal( "mouse::leave", function() + check_for_dock_hide(screen) dock_intelligent_hide:again() - dock.visible = false end ) dock:setup { diff --git a/awesome/src/modules/init.lua b/awesome/src/modules/init.lua index 5806454..bb70c77 100644 --- a/awesome/src/modules/init.lua +++ b/awesome/src/modules/init.lua @@ -19,13 +19,13 @@ awful.screen.connect_for_each_screen( require("src.modules.powermenu")(s) require("src.modules.volume_osd")(s) - --require("src.modules.brightness_osd")(s) - --require("src.modules.bluetooth_controller")(s) + require("src.modules.brightness_osd")(s) + require("src.modules.bluetooth_controller")(s) require("src.modules.titlebar") require("src.modules.volume_controller")(s) require("src.modules.crylia_bar.init")(s) require("src.modules.notification-center.init")(s) require("src.modules.window_switcher.init")(s) - --require("src.modules.application_launcher.init")(s) + require("src.modules.application_launcher.init")(s) end ) diff --git a/awesome/src/modules/notification-center/init.lua b/awesome/src/modules/notification-center/init.lua index 5ffc910..5f69793 100644 --- a/awesome/src/modules/notification-center/init.lua +++ b/awesome/src/modules/notification-center/init.lua @@ -34,6 +34,15 @@ return function(s) layout = wibox.layout.fixed.horizontal }) + awesome.connect_signal( + "notification_center_activation::toggle", + function(screen, hide) + if screen == s then + activation_area.visible = hide + end + end + ) + --#endregion --#region Widgets @@ -70,7 +79,6 @@ return function(s) margins = dpi(10), widget = wibox.container.margin }, - id = "place", widget = wibox.container.place, valign = "bottom", halign = "right", @@ -193,7 +201,6 @@ return function(s) halign = "right", } - -- TODO: Add rubato animation. For this the widget needs to be rewritten to use a single moving square local no_notification_widget = wibox.widget { { { @@ -220,7 +227,6 @@ return function(s) halign = "center", widget = wibox.container.place } - --#endregion --#region Notification center @@ -240,7 +246,6 @@ return function(s) end, } - -- TODO: Currently awesome doesn't come with a scroll container, there is a PR(#3309) and once its merged we can use it local function notification_center_setup() notification_center:setup({ widget = notification_center, @@ -363,7 +368,7 @@ return function(s) end ) - Hover_signal(clear_all_widget, Theme_config.notification_center.clear_all_button.bg, + Hover_signal(clear_all_widget.margin3.background4, Theme_config.notification_center.clear_all_button.bg, Theme_config.notification_center.clear_all_button.fg) --#endregion diff --git a/awesome/src/modules/notification-center/notification_list.lua b/awesome/src/modules/notification-center/notification_list.lua index cf9d34c..ed6d4df 100644 --- a/awesome/src/modules/notification-center/notification_list.lua +++ b/awesome/src/modules/notification-center/notification_list.lua @@ -14,7 +14,8 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/" local nl = {} -nl.notification_list = { layout = wibox.layout.overflow.vertical, scrollbar_width = 0, step = dpi(10), spacing = dpi(20) } +nl.notification_list = { layout = require("src.lib.overflow_widget.overflow").vertical, scrollbar_width = 0, + step = dpi(20), spacing = dpi(20) } -- @param {table} notification -- @return {widget} notifications_list @@ -91,7 +92,6 @@ function nl.create_notification(n) }, margins = dpi(10), widget = wibox.container.margin, - id = "arc_margin" } local timer_close_widget = timer_widget @@ -224,7 +224,7 @@ function nl.create_notification(n) if button == 1 then for i, b in pairs(nl.notification_list) do if b.pk == notification.pk then - table.remove(nl.notification_list, i) + table.remove(nl.notification_list, math.tointeger(i)) awesome.emit_signal("notification_center:update::needed") break end @@ -233,7 +233,7 @@ function nl.create_notification(n) end ) - Hover_signal(close_widget.const.background, Theme_config.notification_center.notification_list.close_bg, + Hover_signal(close_widget.const.background, nil, Theme_config.notification_center.notification_list.close_color) notification:connect_signal( diff --git a/awesome/src/modules/notification-center/song_info.lua b/awesome/src/modules/notification-center/song_info.lua index 96e80e3..6d1fe44 100644 --- a/awesome/src/modules/notification-center/song_info.lua +++ b/awesome/src/modules/notification-center/song_info.lua @@ -55,11 +55,11 @@ return function(s) if stdout:match("On") then awful.spawn.with_shell("playerctl shuffle off") shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg", - Theme_config.notification_center.song_info.shuffle_enabled) + Theme_config.notification_center.song_info.shuffle_disabled) else awful.spawn.with_shell("playerctl shuffle on") shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg", - Theme_config.notification_center.song_info.shuffle_disabled) + Theme_config.notification_center.song_info.shuffle_enabled) end end ) @@ -428,6 +428,7 @@ return function(s) "curl -s " .. url .. " -o /tmp/album_art.jpg && echo /tmp/album_art.jpg && sleep 0.5", function() music_widget:get_children_by_id("imagebox")[1].image = gears.surface.load_uncached("/tmp/album_art.jpg") + or icondir .. "default_image.svg" end ) end @@ -439,8 +440,8 @@ return function(s) function(stdout2) local length = stdout2:gsub("\n", "") if length ~= "" then - local length_formated = string.format("%02d:%02d", math.floor(tonumber(length or 1) / 60000000) or 0, - (math.floor(tonumber(length or 1) / 1000000) % 60) or 0) + local length_formated = string.format("%02d:%02d", math.floor((tonumber(length) or 1) / 60000000) or 0, + (math.floor((tonumber(length) or 1) / 1000000) % 60) or 0) music_widget:get_children_by_id("progressbar1")[1].max_value = tonumber(math.floor(tonumber(length) / 1000000)) music_widget:get_children_by_id("text1")[1].markup = string.format("%s" @@ -467,8 +468,8 @@ return function(s) function(stdout) local time = stdout:gsub("\n", "") if time ~= "" then - local time_formated = string.format("%02d:%02d", math.floor(tonumber(time or "1") / 60), - math.floor(tonumber(time or "1")) % 60) + local time_formated = string.format("%02d:%02d", math.floor((tonumber(time) or 1) / 60), + math.floor(tonumber(time) or 1) % 60) music_widget:get_children_by_id("textbox2")[1].markup = string.format("%s" , Theme_config.notification_center.song_info.duration_fg, time_formated) music_widget:get_children_by_id("progressbar1")[1].value = tonumber(time) diff --git a/awesome/src/modules/notification-center/status_bars.lua b/awesome/src/modules/notification-center/status_bars.lua index e5dd52e..8862cba 100644 --- a/awesome/src/modules/notification-center/status_bars.lua +++ b/awesome/src/modules/notification-center/status_bars.lua @@ -19,7 +19,7 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/" return function() ---Creates a layout with bar widgets based on the given table - ---@param widget_table string{} + ---@param widget_table table ---@return table local function create_bar_layout(widget_table) local bar_layout = { layout = wibox.layout.flex.horizontal, spacing = dpi(10) } @@ -388,7 +388,7 @@ return function() "update::gpu_temp", function(gpu_temp) local temp_icon - local temp_num = tonumber(gpu_temp) + local temp_num = tonumber(gpu_temp) or "NaN" if temp_num then @@ -478,6 +478,9 @@ return function() function(muted, volume) local icon = icondir .. "audio/volume" volume = tonumber(volume) + if not volume then + return + end if muted then icon = icon .. "-mute" else @@ -564,8 +567,14 @@ return function() awesome.connect_signal( "microphone::get", function(muted, volume) + if not volume then + return + end local icon = icondir .. "audio/microphone" volume = tonumber(volume) + if not volume then + return + end if muted or (volume < 1) then icon = icon .. "-off" end diff --git a/awesome/src/modules/titlebar.lua b/awesome/src/modules/titlebar.lua index abdc785..6b5bc09 100644 --- a/awesome/src/modules/titlebar.lua +++ b/awesome/src/modules/titlebar.lua @@ -132,12 +132,9 @@ local create_titlebar = function(c, size) layout = wibox.layout.align.vertical, id = "main" } - Hover_signal(titlebar.main.margin.spacing.closebutton, Theme_config.titlebar.close_button_bg, - Theme_config.titlebar.close_button_fg) - Hover_signal(titlebar.main.margin.spacing.maximizebutton, Theme_config.titlebar.minimize_button_bg, - Theme_config.titlebar.minimize_button_fg) - Hover_signal(titlebar.main.margin.spacing.minimizebutton, Theme_config.titlebar.maximize_button_bg, - Theme_config.titlebar.maximize_button_fg) + Hover_signal(titlebar.main.margin.spacing.closebutton, Theme_config.titlebar.close_button_bg) + Hover_signal(titlebar.main.margin.spacing.maximizebutton, Theme_config.titlebar.minimize_button_bg) + Hover_signal(titlebar.main.margin.spacing.minimizebutton, Theme_config.titlebar.maximize_button_bg) end local create_titlebar_dialog_modal = function(c, size) @@ -190,10 +187,8 @@ local create_titlebar_dialog_modal = function(c, size) layout = wibox.layout.align.vertical, id = "main" } - Hover_signal(titlebar.main.margin.spacing.closebutton, Theme_config.titlebar.close_button_bg, - Theme_config.titlebar.close_button_fg) - Hover_signal(titlebar.main.margin.spacing.minimizebutton, Theme_config.titlebar.minimize_button_bg, - Theme_config.titlebar.minimize_button_fg) + Hover_signal(titlebar.main.margin.spacing.closebutton, Theme_config.titlebar.close_button_bg) + Hover_signal(titlebar.main.margin.spacing.minimizebutton, Theme_config.titlebar.minimize_button_bg) end client.connect_signal( diff --git a/awesome/src/modules/volume_controller.lua b/awesome/src/modules/volume_controller.lua index 55e44b5..3ef3bcc 100644 --- a/awesome/src/modules/volume_controller.lua +++ b/awesome/src/modules/volume_controller.lua @@ -63,7 +63,7 @@ return function(s) function(new_node) if node == new_node then device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg", - Theme_config.volume_controller.device_headphones_selected_icon_color) + Theme_config.volume_controller.device_icon_color) device.bg = Theme_config.volume_controller.device_headphones_selected_bg device.fg = Theme_config.volume_controller.device_headphones_selected_fg else @@ -602,6 +602,9 @@ return function(s) .recolor_image(icondir .. "volume-mute.svg", Theme_config.volume_controller.volume_fg)) else volume = tonumber(volume) + if not volume then + return + end local icon = icondir .. "volume" if volume < 1 then icon = icon .. "-mute" @@ -632,6 +635,9 @@ return function(s) .. "microphone-off.svg", Theme_config.volume_controller.microphone_fg)) else volume = tonumber(volume) + if not volume then + return + end 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].mic_volume.icon:set_image(gears.color.recolor_image(icondir diff --git a/awesome/src/modules/volume_osd.lua b/awesome/src/modules/volume_osd.lua index 59b6b04..892f1d0 100644 --- a/awesome/src/modules/volume_osd.lua +++ b/awesome/src/modules/volume_osd.lua @@ -80,6 +80,9 @@ return function(s) volume_osd_widget:get_children_by_id("progressbar1")[1].value = tonumber(0) else volume = tonumber(volume) + if not volume then + return + end volume_osd_widget:get_children_by_id("progressbar1")[1].value = tonumber(volume) local icon = icondir .. "volume" if volume < 1 then @@ -126,11 +129,13 @@ return function(s) awesome.connect_signal( "widget::volume_osd:rerun", function() - volume_container.visible = true - if hide_volume_osd.started then - hide_volume_osd:again() - else - hide_volume_osd:start() + if mouse.screen == s then + volume_container.visible = true + if hide_volume_osd.started then + hide_volume_osd:again() + else + hide_volume_osd:start() + end end end ) diff --git a/awesome/src/modules/window_switcher/init.lua b/awesome/src/modules/window_switcher/init.lua index f1dd646..8c0fecd 100644 --- a/awesome/src/modules/window_switcher/init.lua +++ b/awesome/src/modules/window_switcher/init.lua @@ -8,264 +8,12 @@ local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") +local window_elements = require("src.modules.window_switcher.window_elements")() + return function(s) - -- Variable to check if client is selected - - local list_update = function(widget, buttons, label, _, objects) - widget:reset() - - local function sort_objects() - local objects_sorted = {} - objects_sorted[1] = objects[1] - local index = 2 - for _, object in ipairs(objects) do - if object ~= nil or object ~= 0 then - if object == client.focus then - objects_sorted[1] = object - else - objects_sorted[index] = object - index = index + 1 - end - end - end - index = 2 - if objects_sorted[1].pid == objects_sorted[2].pid then - table.remove(objects_sorted, 2) - end - return objects_sorted - end - - local objects_sorted = sort_objects() - - local selected = objects_sorted[1].pid - - - for _, object in ipairs(objects_sorted) do - local window_element = wibox.widget { - { - { - { - { -- Icon - { - id = "icon", - image = object.icon, - valign = "center", - halign = "center", - widget = wibox.widget.imagebox - }, - width = dpi(100), - height = dpi(100), - id = "icon_const", - strategy = "exact", - widget = wibox.container.constraint - }, - { - { - text = "Application", - id = "label", - widget = wibox.widget.textbox - }, - id = "place", - valign = "center", - halign = "center", - widget = wibox.container.place - }, - id = "layout1", - spacing = dpi(10), - layout = wibox.layout.fixed.vertical - }, - id = "box", - width = dpi(150), - height = dpi(150), - strategy = "exact", - widget = wibox.container.constraint - }, - id = "margin", - margins = dpi(20), - widget = wibox.container.margin - }, - shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, dpi(12)) - end, - border_color = Theme_config.window_switcher.border_color, - border_width = Theme_config.window_switcher.border_width, - fg = Theme_config.window_switcher.element_fg, - widget = wibox.container.background - } - - local function create_buttons(buttons_t, object_t) - if buttons_t then - local btns = {} - for _, b in ipairs(buttons_t) do - local btn = awful.button { - modifiers = b.modifiers, - button = b.button, - on_press = function() - b:emit_signal('press', object_t) - end, - on_release = function() - b:emit_signal('release', object_t) - end - } - btns[#btns + 1] = btn - end - return btns - end - end - - window_element:buttons(create_buttons(buttons, object)) - local text, _ = label(object, window_element:get_children_by_id("label")[1]) - - local i = 1 - local sel = nil - - local function select_next() - if not object.valid then - return - end - if #objects_sorted >= i then - selected = objects_sorted[i].pid - sel = selected - if selected == object.pid then - window_element.border_color = Theme_config.window_switcher.selected_border_color - window_element.fg = Theme_config.window_switcher.selected_fg - window_element.bg = Theme_config.window_switcher.selected_bg - else - window_element.border_color = Theme_config.window_switcher.border_color - window_element.fg = Theme_config.window_switcher.element_fg - window_element.bg = Theme_config.window_switcher.bg - end - end - if #objects_sorted > i then - i = i + 1 - else - i = 1 - end - end - - local function raise() - if not object.valid then - return - end - if objects_sorted[i] then - if sel == object.pid then - if not object:isvisible() and object.first_tag then - object.first_tag:view_only() - end - object:emit_signal('request::activate') - object:raise() - end - - -- Reset window switcher - i = 1 - selected = objects_sorted[i].pid - sel = selected - if selected == object.pid then - window_element.border_color = Theme_config.window_switcher.selected_border_color - window_element.fg = Theme_config.window_switcher.selected_fg - window_element.bg = Theme_config.window_switcher.bg - else - window_element.border_color = Theme_config.window_switcher.border_color - window_element.fg = Theme_config.window_switcher.element_fg - window_element.bg = Theme_config.window_switcher.selected_bg - end - end - awesome.disconnect_signal( - "window_switcher::select_next", - select_next - ) - awesome.disconnect_signal( - "window_switcher::raise", - raise - ) - end - - awesome.connect_signal( - "window_switcher::select_next", - select_next - ) - - awesome.connect_signal( - "window_switcher::raise", - raise - ) - - - object:connect_signal( - "unmanage", - function(c) - if object.valid then - i = 1 - objects_sorted[1] = objects_sorted[#objects_sorted] - objects_sorted[#objects_sorted] = nil - for _, obj in ipairs(objects_sorted) do - if obj.valid then - if obj.pid == c.pid then - table.remove(objects_sorted, _) - break - end - end - end - end - end - ) - - if text == nil or text == "" then - window_element:get_children_by_id("label")[1].text = "Application" - else - local text_full = text:match(">(.-)<") - if text_full then - if object.class == nil then - text = object.name - else - text = object.class:sub(1, 20) - end - end - window_element:get_children_by_id("label")[1].text = object.name - end - if selected == object.pid then - window_element.border_color = Theme_config.window_switcher.selected_border_color - window_element.fg = Theme_config.window_switcher.selected_fg - window_element.bg = Theme_config.window_switcher.selected_bg - end - - window_element:get_children_by_id("icon")[1]:set_image(xdg_icon_lookup:find_icon(object.class, 64)) - - widget:add(window_element) - widget:set_spacing(dpi(20)) - end - return widget - end - - local window_switcher = awful.widget.tasklist( - s, - awful.widget.tasklist.source.all_clients, - awful.util.table.join( - awful.button( - {}, - 1, - function(c) - if c == client.focus then - c.minimized = true - else - c.minimized = false - if not c:isvisible() and c.first_tag then - c.first_tag:view_only() - end - c:emit_signal('request::activate') - c:raise() - end - end - ) - ), - {}, - list_update, - wibox.layout.fixed.horizontal() - ) - - local window_switcher_margin = wibox.widget { - window_switcher, + local window_switcher_list = wibox.widget { + window_elements, margins = dpi(20), widget = wibox.container.margin } @@ -285,6 +33,11 @@ return function(s) border_width = Theme_config.window_switcher.border_width } + window_switcher_container:setup { + window_switcher_list, + layout = wibox.layout.fixed.vertical + } + awesome.connect_signal( "toggle_window_switcher", function() @@ -293,9 +46,4 @@ return function(s) end end ) - - window_switcher_container:setup { - window_switcher_margin, - layout = wibox.layout.fixed.vertical - } end diff --git a/awesome/src/modules/window_switcher/window_elements.lua b/awesome/src/modules/window_switcher/window_elements.lua new file mode 100644 index 0000000..8e40fa2 --- /dev/null +++ b/awesome/src/modules/window_switcher/window_elements.lua @@ -0,0 +1,179 @@ +--------------------------------- +-- This is the window_switcher -- +--------------------------------- + +-- Awesome Libs +local awful = require("awful") +local dpi = require("beautiful").xresources.apply_dpi +local gears = require("gears") +local wibox = require("wibox") + +return function() + + local elements = wibox.widget { + layout = wibox.layout.fixed.horizontal, + spacing = dpi(20), + id = "switcher" + } + + local selected = 0 + + local function create_elements(fn) + fn = fn or "" + + elements:reset() + + local clients = client.get() + local clients_sorted = {} + + if client.focus then + clients_sorted[1] = client.focus + end + + for _, client in ipairs(clients) do + if client ~= clients_sorted[1] then + table.insert(clients_sorted, client) + end + end + + selected = selected + + for i, client in ipairs(clients_sorted) do + local window_element = wibox.widget { + { + { + { + { -- Icon + { + id = "icon", + --!ADD FALLBACK ICON!-- + image = xdg_icon_lookup:find_icon(client.class, 64) or client.icon, + valign = "center", + halign = "center", + widget = wibox.widget.imagebox + }, + width = dpi(100), + height = dpi(100), + id = "icon_const", + strategy = "exact", + widget = wibox.container.constraint + }, + { + { + text = client.name, + id = "label", + widget = wibox.widget.textbox + }, + id = "place", + valign = "center", + halign = "center", + widget = wibox.container.place + }, + id = "layout1", + spacing = dpi(10), + layout = wibox.layout.fixed.vertical + }, + id = "box", + width = dpi(150), + height = dpi(150), + strategy = "exact", + widget = wibox.container.constraint + }, + id = "margin", + margins = dpi(20), + widget = wibox.container.margin + }, + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, dpi(12)) + end, + border_color = Theme_config.window_switcher.border_color, + border_width = Theme_config.window_switcher.border_width, + bg = Theme_config.window_switcher.element_bg, + fg = Theme_config.window_switcher.element_fg, + widget = wibox.container.background + } + + if i == selected then + window_element.border_color = Theme_config.window_switcher.selected_border_color + window_element.fg = Theme_config.window_switcher.selected_fg + window_element.bg = Theme_config.window_switcher.selected_bg + else + window_element.border_color = Theme_config.window_switcher.border_color + window_element.fg = Theme_config.window_switcher.element_fg + window_element.bg = Theme_config.window_switcher.bg + end + + elements:add(window_element) + end + + if fn == "next" then + if selected >= #clients_sorted then + selected = 1 + else + selected = selected + 1 + end + + for i, element in ipairs(elements.children) do + if i == selected then + element.border_color = Theme_config.window_switcher.selected_border_color + element.fg = Theme_config.window_switcher.selected_fg + element.bg = Theme_config.window_switcher.selected_bg + else + element.border_color = Theme_config.window_switcher.border_color + element.fg = Theme_config.window_switcher.element_fg + element.bg = Theme_config.window_switcher.bg + end + end + elseif fn == "raise" then + local c = clients_sorted[selected] + if not c:isvisible() and c.first_tag then + c.first_tag:view_only() + end + c:emit_signal('request::activate') + c:raise() + + --reset selected + selected = 0 + end + return elements + end + + elements = create_elements() + + awesome.connect_signal( + "window_switcher::select_next", + function() + elements = create_elements("next") + end + ) + + awesome.connect_signal( + "window_switcher::raise", + function() + elements = create_elements("raise") + end + ) + + client.connect_signal( + "manage", + function() + elements = create_elements() + end + ) + + client.connect_signal( + "unmanage", + function() + elements = create_elements() + end + ) + + awesome.connect_signal( + "window_switcher::update", + function() + elements = create_elements() + end + ) + + return elements +end diff --git a/awesome/src/theme/theme_config.lua b/awesome/src/theme/theme_config.lua index 657246b..b910f20 100644 --- a/awesome/src/theme/theme_config.lua +++ b/awesome/src/theme/theme_config.lua @@ -341,11 +341,11 @@ Theme_config.dock = { element_focused_hover_fg = color["White"], bg = color["Grey900"], indicator_bg = color["Grey600"], - indicator_bg_focus = color["YellowA200"], - indicator_bg_urgent = color["RedA200"], - indicator_bg_maximized = color["GreenA200"], - indicator_bg_minimized = color["BlueA200"], - indicator_bg_fullscreen = color["PurpleA200"], + indicator_focused_bg = color["YellowA200"], + indicator_urgent_bg = color["RedA200"], + indicator_maximized_bg = color["GreenA200"], + indicator_bg_mindicator_minimized_bginimized = color["BlueA200"], + indicator_fullscreen_bg = color["PurpleA200"], } Theme_config.left_bar = { @@ -442,14 +442,29 @@ Theme_config.application_launcher = { border_color = color["Grey800"], border_width = dpi(4), application = { - + border_color = color["Grey800"], + border_color_active = color["Purple200"], + border_width = dpi(2), + bg = "#313131", + hover_bg = color["Grey700"], }, searchbar = { bg = color["Grey900"], - fg = color["Green200"], - fg_hint = color["Grey800"], - border_color = color["Red200"], + fg = color["Grey100"], + fg_hint = color["Grey700"], + fg_cursor = color["Grey900"], + bg_cursor = color["Grey100"], + border_color = color["Grey800"], border_width = dpi(2), + icon_color = color["Grey900"], + icon_background = color["LightBlue200"], + hover_bg = color["Grey800"], + hover_fg = color["Purple200"], + hover_border = color["Grey700"], + border_active = color["LightBlue200"], + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, dpi(4)) + end, } } --#endregion diff --git a/awesome/src/theme/user_config.lua b/awesome/src/theme/user_config.lua index eab553c..f99656b 100644 --- a/awesome/src/theme/user_config.lua +++ b/awesome/src/theme/user_config.lua @@ -24,7 +24,7 @@ User_config = { "discord", "/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1", "setxkbmap -option caps:swapescape", - "whatsdesk" + "jamesdsp" }, --[[ @@ -81,7 +81,7 @@ User_config = { ]] -- dock_programs = { "com.alacritty.Alacritty.desktop", - "firefox.desktop", + "com.brave.Browser.desktop", "steam.desktop", "discord.desktop", "com.spotify.Client.desktop", @@ -89,11 +89,11 @@ User_config = { "arduino-arduinoide.desktop", "us.zoom.Zoom.desktop", "thunderbird.desktop", - "com.ultimaker.cura.desktop", + "appimagekit_5de59b772d786d6e98102a035c80e40c-Ultimaker_Cura.desktop", "blender.desktop", "freecad.desktop", "The Witcher 3 Wild Hunt.desktop", - --"windows_11.desktop" + "Microsoft Flight Simulator.desktop" }, --[[ diff --git a/awesome/src/tools/desktop_parser.lua b/awesome/src/tools/desktop_parser.lua index 48e8967..982e52e 100644 --- a/awesome/src/tools/desktop_parser.lua +++ b/awesome/src/tools/desktop_parser.lua @@ -1,6 +1,8 @@ local gears = require("gears") local GLib = require("lgi").GLib +local m = {} + ---Will return every $XDG_DATA_DIRS ---@return table local function get_paths() @@ -18,13 +20,98 @@ local function get_paths() return dirs end +---Returns every found .desktop file that has NoDesktop=false or unset +---@return table +function m.Get_all_visible_desktop() + local dirs = get_paths() + local desktops = {} + for _, dir in ipairs(dirs) do + local files = io.popen('find "' .. dir .. '" -type f,l') + if files then + for file in files:lines() do + if gears.filesystem.file_readable(file) then + --[[ local symlink = lfs.symlinkattributes(file, "target") + if symlink then + file = dir .. symlink + end ]] + local handler = io.open(file, "r") + if not handler then + return {} + end + while true do + local line = handler:read() + if not line then break end + if line:match("^%[Desktop Entry%]") then + local name, comment, icon, exec, keywords, terminal, categories, nodisplay = "", "", "", "", "", "", "", + false + while true do + local prop = handler:read() or nil + if ((not prop) and name ~= "") or prop:match("^%[(.+)%]") then + local desktop_table = { + name = name or "", + comment = comment or "", + icon = icon or "", + exec = exec or "", + keywords = keywords or "", + terminal = terminal or false, + categories = categories or "", + nodisplay = nodisplay or false, + file = file + } + table.insert(desktops, desktop_table) + break + end + + if prop:match("^Name=") then + name = prop:match("Name=(.+)") + end + if prop:match("^Comment=") then + comment = prop:match("Comment=(.+)") + end + if prop:match("^Icon=") then + icon = prop:match("Icon=(.+)") + end + if prop:match("^Exec=") then + exec = prop:match("Exec=(.+)"):gsub("%%u", ""):gsub("%%U", ""):gsub("%%f", ""):gsub("%%F", ""):gsub("%%i" + , ""):gsub("%%c", ""):gsub("%%k", "") + end + if prop:match("^Keywords=") then + keywords = prop:match("Keywords=(.+)") + end + if prop:match("^Terminal=") then + terminal = prop:match("Terminal=(.+)") + end + if prop:match("^Categories=") then + categories = prop:match("Categories=(.+)") + end + if prop:match("^NoDisplay=") then + nodisplay = prop:match("NoDisplay=(.+)") + if nodisplay == "false" then + nodisplay = false + else + nodisplay = true + end + end + end + break + end + end + handler:close() + end + end + files:close() + end + end + return desktops +end + ---Returns every .desktop file into a table ---@param file table .desktop files ---@return table -return function(file) +function m.Get_desktop_values(file) if not file or file == "" then - return + return {} end local handler = nil @@ -37,7 +124,7 @@ return function(file) end if not handler then - return + return {} end local desktop_table = {} @@ -48,7 +135,7 @@ return function(file) break end - if line:match("[Desktop Entry]") then + if line:match("^%[Desktop Entry%]") then while true do local property = handler:read() if not property then @@ -62,13 +149,17 @@ return function(file) if property:match("^Name=") then desktop_table["Name"] = property:match("Name=(.+)") elseif property:match("^Exec") then - -- Second match is to remove the %u and %F some applications use to open a URI. It's not needed here - desktop_table["Exec"] = property:match("Exec=(.+)"):gsub("%%u", ""):gsub("%%F", "") + -- Second match is to remove the %u, %U and %f, %F some applications use to open a URI/URL. It's not needed here + desktop_table["Exec"] = property:match("Exec=(.+)"):gsub("%%u", ""):gsub("%%U", ""):gsub("%%f", ""):gsub("%%F" + , ""):gsub("%%i", ""):gsub("%%c", ""):gsub("%%k", "") elseif property:match("^Icon=") then desktop_table["Icon"] = property:match("Icon=(.+)") end end end end + handler:close() return desktop_table end + +return m diff --git a/awesome/src/tools/helpers/audio.lua b/awesome/src/tools/helpers/audio.lua index 6a0123f..75602ab 100644 --- a/awesome/src/tools/helpers/audio.lua +++ b/awesome/src/tools/helpers/audio.lua @@ -35,6 +35,9 @@ awesome.connect_signal( awful.spawn.easy_async_with_shell( "./.config/awesome/src/scripts/vol.sh mute", function(stdout) + if stdout == "" or stdout == nil then + return + end local muted = false if stdout:match("yes") then muted = true @@ -42,6 +45,9 @@ awesome.connect_signal( awful.spawn.easy_async_with_shell( "./.config/awesome/src/scripts/vol.sh volume", function(stdout2) + if stdout == "" or stdout == nil then + return + end awesome.emit_signal("audio::get", muted, stdout2:gsub("%%", ""):gsub("\n", "") or 0) end ) @@ -63,6 +69,9 @@ awesome.connect_signal( awful.spawn.easy_async_with_shell( "./.config/awesome/src/scripts/mic.sh volume", function(stdout2) + if stdout2 == nil or stdout2 == "awful" then + return + end awesome.emit_signal("microphone::get", muted, stdout2:gsub("%%", ""):gsub("\n", "") or 0) end ) diff --git a/awesome/src/tools/helpers/cpu_temp.lua b/awesome/src/tools/helpers/cpu_temp.lua index 37b0007..6756474 100644 --- a/awesome/src/tools/helpers/cpu_temp.lua +++ b/awesome/src/tools/helpers/cpu_temp.lua @@ -6,9 +6,22 @@ watch( 3, function(_, stdout) local temp = tonumber(stdout:match("%d+")) - awesome.emit_signal( - "update::cpu_temp", - temp - ) + if not temp or temp == "" then + awful.spawn.easy_async_with_shell( + "paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp)", + function(stdout2) + temp = math.floor((tonumber(stdout2:match("x86_pkg_temp(.%d+)")) / 1000) + 0.5) + awesome.emit_signal( + "update::cpu_temp", + temp + ) + end + ) + else + awesome.emit_signal( + "update::cpu_temp", + temp + ) + end end ) diff --git a/awesome/src/tools/hex_to_rgba.lua b/awesome/src/tools/hex_to_rgba.lua new file mode 100644 index 0000000..99699a9 --- /dev/null +++ b/awesome/src/tools/hex_to_rgba.lua @@ -0,0 +1,8 @@ +function RGB_to_hex(r, g, b) + r = r or 0 + g = g or 0 + b = b or 0 + + return string.format("#%02X%02X%02X", math.floor((r * 255) + 0.5), math.floor((g * 255) + 0.5), + math.floor((b * 255) + 0.5)) +end diff --git a/awesome/src/tools/xdg_icon_lookup.lua b/awesome/src/tools/xdg_icon_lookup.lua index e893ade..ed81916 100644 --- a/awesome/src/tools/xdg_icon_lookup.lua +++ b/awesome/src/tools/xdg_icon_lookup.lua @@ -67,7 +67,7 @@ end ---Look for an fallback icon ---@param iconname any ----@return string +---@return string|nil nil local function lookup_fallback_icon(self, iconname) for _, dir in ipairs(self.base_directories) do for _, ext in ipairs(self.file_extension) do @@ -77,6 +77,7 @@ local function lookup_fallback_icon(self, iconname) end end end + return nil end ---Checkes if the size equals the actual icon size @@ -133,7 +134,7 @@ end ---Checks each and every sub directory for an icon ---@param iconname any ---@param size any ----@return string path_to_icon +---@return string|unknown|nil path_to_icon local function lookup_icon(self, iconname, size) local already_checked = {} for _, subdir in ipairs(self.theme_index:get_subdirectories()) do @@ -175,21 +176,23 @@ end ---@param icon any ---@param size any ---@param self any ----@return string path_to_icon +---@return string|unknown|nil path_to_icon local function find_icon_helper(self, icon, size) local filename = lookup_icon(self, icon, size) if filename then return filename end + -- Exists purely for clients in hope to find a matching icon. filename = lookup_icon(self, icon:lower(), size) if filename then return filename end - for _, parent in ipairs(self.theme_index:get_inherits()) do + -- !Disabled for now until memory leak can be fixed. + --[[ for _, parent in ipairs(self.theme_index:get_inherits()) do if parent == "hicolor" then return end filename = find_icon_helper(xdg_icon_lookup(parent, self.base_directories), icon, size) if filename then return filename end - end + end ]] return nil end @@ -198,14 +201,21 @@ local iconcache = {} ---Takes an icon and its props and theme to search for it inside the theme ---@param icon any ---@param size any ----@return string path_to_icon +---@return string|nil path_to_icon function xdg_icon_lookup:find_icon(icon, size) + size = size or 64 + if icon_cache[icon] == "" then return nil end if iconcache[icon] then return iconcache[icon] end if not icon or icon == "" then return nil end + if gears.filesystem.file_readable(icon) then + iconcache[icon] = icon + return icon + end + local filename = find_icon_helper(self, icon, size) if filename then iconcache[icon] = filename diff --git a/awesome/src/widgets/audio.lua b/awesome/src/widgets/audio.lua index 9ec8a33..c9baa2e 100644 --- a/awesome/src/widgets/audio.lua +++ b/awesome/src/widgets/audio.lua @@ -68,6 +68,9 @@ return function(s) audio_widget.container.audio_layout.spacing = dpi(5) audio_widget.container.audio_layout.label.visible = true volume = tonumber(volume) + if not volume then + return + end if volume < 1 then icon = icon .. "-mute" audio_widget.container.audio_layout.spacing = dpi(0) diff --git a/awesome/src/widgets/battery.lua b/awesome/src/widgets/battery.lua index 5687271..bb8d9f9 100644 --- a/awesome/src/widgets/battery.lua +++ b/awesome/src/widgets/battery.lua @@ -99,6 +99,7 @@ return function(battery_kind) return device end end + return nil end local tooltip = awful.tooltip { @@ -123,7 +124,7 @@ return function(battery_kind) battery_time = device.time_to_full end - battery_time = math.floor(battery_time / 3600) .. "h, " .. math.floor((battery_time / 60) % 60) .. "m" + local battery_string = math.floor(battery_time / 3600) .. "h, " .. math.floor((battery_time / 60) % 60) .. "m" if battery_temp == 0.0 then battery_temp = "NaN" @@ -141,7 +142,7 @@ return function(battery_kind) tooltip.markup = "Battery Status: " .. battery_status .. "\nRemaining time: " - .. battery_time .. "\nTemperature: " + .. battery_string .. "\nTemperature: " .. battery_temp .. "" local icon = 'battery' diff --git a/awesome/src/widgets/layout_list.lua b/awesome/src/widgets/layout_list.lua index b22338a..7cc36a3 100644 --- a/awesome/src/widgets/layout_list.lua +++ b/awesome/src/widgets/layout_list.lua @@ -47,7 +47,7 @@ return function() } -- Signals - Hover_signal(layout, Theme_config.layout_list.bg, Theme_config.layout_list.fg) + Hover_signal(layout, Theme_config.layout_list.bg) layout:connect_signal( "button::press", diff --git a/awesome/src/widgets/systray.lua b/awesome/src/widgets/systray.lua index ee85a61..8a64eca 100644 --- a/awesome/src/widgets/systray.lua +++ b/awesome/src/widgets/systray.lua @@ -29,7 +29,7 @@ return function(s) bg = Theme_config.systray.bg } -- Signals - Hover_signal(systray.container, Theme_config.systray.bg, Theme_config.systray.bg) + Hover_signal(systray, Theme_config.systray.bg) awesome.connect_signal("systray::update", function() local num_entries = awesome.systray() diff --git a/rofi/rofi.rasi b/rofi/rofi.rasi deleted file mode 100644 index 7eb2195..0000000 --- a/rofi/rofi.rasi +++ /dev/null @@ -1,112 +0,0 @@ -configuration { - font: "JetBrainsMono NF 12"; - show-icons: true; - icon-theme: "Papirus-Dark"; - display-drun: ""; - drun-display-format: "{name}"; - disable-history: false; - sidebar-mode: false; -} - -* { - background: #00000060; - background-alt: #00000000; - background-bar: #f2f2f215; - foreground: #f2f2f2EE; - accent: #ffffff66; -} - -window { - transparency: "real"; - background-color: @background; - text-color: @foreground; - border: 0px; - border-radius: 0px; - width: 100%; - height: 100%; -} - -prompt { - enabled: true; - padding: 0.30% -0.5% 0% 0.5%; - background-color: @background-alt; - text-color: @foreground; - font: "JetBrainsMono Nerd Font 12"; -} - -entry { - background-color: @background-alt; - text-color: @foreground; - placeholder-color: @foreground; - expand: true; - horizontal-align: 0; - placeholder: "Search"; - padding: 0% 0% 0% 0%; - blink: true; -} - -inputbar { - children: [ prompt, entry ]; - background-color: @background-bar; - text-color: @foreground; - expand: false; - border: 0.1%; - border-radius: 8px; - border-color: @accent; - margin: 0% 25% 0% 25%; - padding: 1%; -} - -listview { - background-color: @background-alt; - columns: 7; - lines: 4; - spacing: 2%; - cycle: false; - dynamic: true; - layout: vertical; -} - -mainbox { - background-color: @background-alt; - border: 0% 0% 0% 0%; - border-radius: 0% 0% 0% 0%; - border-color: @accent; - children: [ inputbar, listview ]; - spacing: 8%; - padding: 10% 8.5% 10% 8.5%; -} - -element { - background-color: @background-alt; - text-color: @foreground; - orientation: vertical; - border-radius: 0%; - padding: 2.5% 0% 2.5% 0%; -} - -element-icon { - background-color: @background-alt; - text-color: inherit; - horizontal-align: 0.5; - vertical-align: 0.5; - size: 81px; - border: 0px; -} - -element-text { - background-color: @background-alt; - text-color: inherit; - expand: true; - horizontal-align: 0.5; - vertical-align: 0.5; - margin: 0.5% 0.5% -0.5% 0.5%; -} - -element selected { - background-color: @background-bar; - text-color: @foreground; - border: 0% 0% 0% 0%; - border-radius: 12px; - border-color: @accent; -} diff --git a/rofi/window.rasi b/rofi/window.rasi deleted file mode 100644 index 58d6ce6..0000000 --- a/rofi/window.rasi +++ /dev/null @@ -1,85 +0,0 @@ -configuration { - font: "JetBrainsMono NF 12"; - show-icons: true; - icon-theme: "Papirus-Dark"; - display-drun: ""; - drun-display-format: "{name}"; - disable-history: false; - sidebar-mode: false; -} - - -* { - background: #00000000; - background-alt: #00000000; - background-bar: #f2f2f215; - foreground: #f2f2f2EE; - accent: #3DAEE966; -} - -window { - transparency: "real"; - background-color: #21212188; - text-color: @foreground; - border: 1px; - border-radius: 25px; - //width: 26%; - location: center; - x-offset: 0; - y-offset: 0; -} - -prompt, entry, inputbar { - enabled: false; -} - -listview { - background-color: @background-alt; - columns: 100; - lines: 1; - spacing: 1%; - cycle: false; - dynamic: true; - layout: vertical; -} - -mainbox { - background-color: @background-alt; - border: 0% 0% 0% 0%; - border-color: @accent; - children: [ inputbar, listview ]; - spacing: 2%; - padding: 2% 1% 2% 1%; -} - -element { - background-color: @background-alt; - text-color: @foreground; - orientation: vertical; - padding: 2.5% 0% 2.5% 0%; -} - -element-icon { - background-color: @background-alt; - text-color: inherit; - horizontal-align: 0.5; - vertical-align: 0.5; - size: 6%; -} - -element-text { - background-color: @background-alt; - text-color: inherit; - expand: false; - horizontal-align: 0.5; - vertical-align: 0.5; - margin: 0.5% 0.5% -0.5% 0.5%; -} - -element selected { - background-color: #40404088; - text-color: @foreground; - border: 0% 0% 0% 0%; - border-radius: 12px; - border-color: @accent; -}