From 994f1f72effc5f0c702b3dc788d44621623b9747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Sat, 20 May 2023 23:04:33 +0200 Subject: [PATCH] Cleanup --- awesome/components/notifications.lua | 1 - awesome/components/pastel/top-panel.lua | 4 +- awesome/components/pastel/wallpaper.lua | 1 - awesome/keys.lua | 92 +++--------------------- awesome/scripts/setup_display.sh | 2 + awesome/widgets/clickable-container.lua | 2 +- awesome/widgets/folder.lua | 96 ------------------------- awesome/widgets/tag-list.lua | 12 ++-- awesome/widgets/task-list.lua | 4 +- nvim/lua/lsp_config.lua | 8 ++- 10 files changed, 28 insertions(+), 194 deletions(-) delete mode 100644 awesome/widgets/folder.lua diff --git a/awesome/components/notifications.lua b/awesome/components/notifications.lua index 41df383..a4b7ecc 100644 --- a/awesome/components/notifications.lua +++ b/awesome/components/notifications.lua @@ -13,7 +13,6 @@ local naughty = require("naughty") local beautiful = require("beautiful") local gears = require("gears") -local wibox = require("wibox") local awful = require("awful") local dpi = beautiful.xresources.apply_dpi diff --git a/awesome/components/pastel/top-panel.lua b/awesome/components/pastel/top-panel.lua index 5348571..ff51088 100644 --- a/awesome/components/pastel/top-panel.lua +++ b/awesome/components/pastel/top-panel.lua @@ -150,14 +150,14 @@ top_panel.create = function(s) end) -- connect panel visibility function to relevant signals - updates_indicator:connect_signal("button::press", function(c, _, _, button) + updates_indicator:connect_signal("button::press", function(_, _, _, _) local update_command = 'WINIT_X11_SCALE_FACTOR=1 alacritty -e bash -c "yay ; echo \'\nDone, press any key to exit...\' ; read"' awful.spawn.easy_async_with_shell(update_command, function(_) watch_timer:emit_signal("timeout") end) end) - clock:connect_signal("button::press", function(c, _, _, button) + clock:connect_signal("button::press", function(_, _, _, _) awful.spawn('gnome-calendar') end) diff --git a/awesome/components/pastel/wallpaper.lua b/awesome/components/pastel/wallpaper.lua index 319d98f..d7c142d 100644 --- a/awesome/components/pastel/wallpaper.lua +++ b/awesome/components/pastel/wallpaper.lua @@ -12,7 +12,6 @@ local awful = require("awful") local gears = require("gears") -local naughty = require("naughty") -- =================================================================== diff --git a/awesome/keys.lua b/awesome/keys.lua index df935fe..bd58dc2 100644 --- a/awesome/keys.lua +++ b/awesome/keys.lua @@ -65,14 +65,6 @@ local function resize_client(c, direction) end --- raise focused client -local function raise_client() - if client.focus then - client.focus:raise() - end -end - - -- =================================================================== -- Mouse bindings -- =================================================================== @@ -312,70 +304,6 @@ keys.globalkeys = gears.table.join( {description = "Launch the calculator", group = "hotkeys"} ), - -- ========================================= - -- CLIENT FOCUSING - -- ========================================= - - -- Focus client by direction (hjkl keys) - -- awful.key({modkey}, "j", - -- function() - -- awful.client.focus.bydirection("down") - -- raise_client() - -- end, - -- {description = "focus down", group = "client"} - -- ), - -- awful.key({modkey}, "k", - -- function() - -- awful.client.focus.bydirection("up") - -- raise_client() - -- end, - -- {description = "focus up", group = "client"} - -- ), - -- awful.key({modkey}, "h", - -- function() - -- awful.client.focus.bydirection("left") - -- raise_client() - -- end, - -- {description = "focus left", group = "client"} - -- ), - -- awful.key({modkey}, "l", - -- function() - -- awful.client.focus.bydirection("right") - -- raise_client() - -- end, - -- {description = "focus right", group = "client"} - -- ), - - -- Focus client by direction (arrow keys) - -- awful.key({modkey}, "Down", - -- function() - -- awful.client.focus.bydirection("down") - -- raise_client() - -- end, - -- {description = "focus down", group = "client"} - -- ), - -- awful.key({modkey}, "Up", - -- function() - -- awful.client.focus.bydirection("up") - -- raise_client() - -- end, - -- {description = "focus up", group = "client"} - -- ), - -- awful.key({modkey}, "Left", - -- function() - -- awful.client.focus.bydirection("left") - -- raise_client() - -- end, - -- {description = "focus left", group = "client"} - -- ), - -- awful.key({modkey}, "Right", - -- function() - -- awful.client.focus.bydirection("right") - -- raise_client() - -- end, - -- {description = "focus right", group = "client"} - -- ), - -- Focus client by index (cycle through clients) awful.key({modkey}, "Tab", function() @@ -406,42 +334,42 @@ keys.globalkeys = gears.table.join( -- ========================================= awful.key({modkey, "Control"}, "Down", - function(c) + function(_) resize_client(client.focus, "down") end ), awful.key({modkey, "Control"}, "Up", - function(c) + function(_) resize_client(client.focus, "up") end ), awful.key({modkey, "Control"}, "Left", - function(c) + function(_) resize_client(client.focus, "left") end ), awful.key({modkey, "Control"}, "Right", - function(c) + function(_) resize_client(client.focus, "right") end ), awful.key({modkey, "Control"}, "j", - function(c) + function(_) resize_client(client.focus, "down") end ), awful.key({ modkey, "Control" }, "k", - function(c) + function(_) resize_client(client.focus, "up") end ), awful.key({modkey, "Control"}, "h", - function(c) + function(_) resize_client(client.focus, "left") end ), awful.key({modkey, "Control"}, "l", - function(c) + function(_) resize_client(client.focus, "right") end ), @@ -554,8 +482,8 @@ keys.clientkeys = gears.table.join( awful.key({modkey}, "q", function(c) c:kill() - for i, c in ipairs(client.get()) do - c.minimized = false + for _, i in ipairs(client.get()) do + i.minimized = false end end, {description = "close", group = "client"} diff --git a/awesome/scripts/setup_display.sh b/awesome/scripts/setup_display.sh index 8c1b6a1..89633b1 100755 --- a/awesome/scripts/setup_display.sh +++ b/awesome/scripts/setup_display.sh @@ -1,3 +1,5 @@ +#!/bin/zsh + declare -i count=3 declare -i seconds=0.5 diff --git a/awesome/widgets/clickable-container.lua b/awesome/widgets/clickable-container.lua index 6504fe2..d5576f6 100644 --- a/awesome/widgets/clickable-container.lua +++ b/awesome/widgets/clickable-container.lua @@ -25,7 +25,7 @@ local wibox = require('wibox') -- =================================================================== -function build(widget) +local function build(widget) local container = wibox.widget { widget, diff --git a/awesome/widgets/folder.lua b/awesome/widgets/folder.lua deleted file mode 100644 index ba1d075..0000000 --- a/awesome/widgets/folder.lua +++ /dev/null @@ -1,96 +0,0 @@ --- ███████╗ ██████╗ ██╗ ██████╗ ███████╗██████╗ --- ██╔════╝██╔═══██╗██║ ██╔══██╗██╔════╝██╔══██╗ --- █████╗ ██║ ██║██║ ██║ ██║█████╗ ██████╔╝ --- ██╔══╝ ██║ ██║██║ ██║ ██║██╔══╝ ██╔══██╗ --- ██║ ╚██████╔╝███████╗██████╔╝███████╗██║ ██║ --- ╚═╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝ - --- =================================================================== --- Initialization --- =================================================================== - - -local awful = require("awful") -local wibox = require("wibox") -local clickable_container = require("widgets.clickable-container") -local gears = require("gears") -local dpi = require("beautiful").xresources.apply_dpi - -local HOME_DIR = os.getenv("HOME") -local PATH_TO_ICONS = HOME_DIR .. "/.config/awesome/icons/folders/" - --- define module table -local folder = {} - - --- =================================================================== --- Helper Functions --- =================================================================== - - --- split a string into a list based on a deliminator -local function split_string(inputstr, delim) - if delim == nil then - delim = "%s" - end - local t={} - for str in string.gmatch(inputstr, "([^"..delim.."]+)") do - table.insert(t, str) - end - return t -end - - --- =================================================================== --- Functionality --- =================================================================== - - -function folder.create(directory) - local docu_widget = wibox.widget { - { - id = "icon", - widget = wibox.widget.imagebox, - resize = true - }, - layout = wibox.layout.align.horizontal - } - - local docu_button = clickable_container(wibox.container.margin(docu_widget, dpi(8), dpi(8), dpi(8), dpi(8))) - docu_button:buttons( - gears.table.join( - awful.button({}, 1, nil, - function() - awful.spawn.easy_async_with_shell(apps.filebrowser .. " " .. directory, function(stderr) end, 1) - end - ) - ) - ) - - -- determine hover name & icon to use - -- icon name must correspond with name of folder - local folder_name = "" - if directory == HOME_DIR then - folder_name = "Home" - elseif directory == "trash://" then - folder_name = "Trash" - else - local dir_list = split_string(directory, "/") - folder_name = dir_list[#dir_list] - end - - awful.tooltip({ - objects = {docu_button}, - mode = "outside", - align = "right", - timer_function = function() - return folder_name - end, - preferred_positions = {"right", "left", "top", "bottom"} - }) - - docu_widget.icon:set_image(PATH_TO_ICONS .. folder_name:lower() .. ".png") - return docu_button -end - -return folder diff --git a/awesome/widgets/tag-list.lua b/awesome/widgets/tag-list.lua index a819e3f..b564d25 100644 --- a/awesome/widgets/tag-list.lua +++ b/awesome/widgets/tag-list.lua @@ -1,16 +1,14 @@ local awful = require("awful") -local gears = require("gears") local wibox = require("wibox") local theme = require("theme") -local naughty = require("naughty") local tag_list = {} tag_list.create = function(s) local filter = function(tag) - count = 0 - for idx, tag in ipairs(s.tags) do - if #tag:clients() > 0 or tag.selected then + local count = 0 + for _, t in ipairs(s.tags) do + if #t:clients() > 0 or t.selected then count = count + 1 end end @@ -21,7 +19,7 @@ tag_list.create = function(s) awful.button({}, 1, function(c) c.selected = true - for idx, tag in ipairs(s.tags) do + for _, tag in ipairs(s.tags) do if tag.index ~= c.index then tag.selected = false end @@ -46,7 +44,7 @@ tag_list.create = function(s) id = 'background_role', widget = wibox.container.background, - create_callback = function(self, c3, index, objects) + create_callback = function(self, c3, _, _) self:get_children_by_id('index_role')[1].markup = ' '..c3.name..' ' self:connect_signal('mouse::enter', function() if self.bg ~= theme.top_panel_powerline then diff --git a/awesome/widgets/task-list.lua b/awesome/widgets/task-list.lua index 6774db3..ee0d698 100644 --- a/awesome/widgets/task-list.lua +++ b/awesome/widgets/task-list.lua @@ -51,7 +51,7 @@ local function create_buttons(buttons, object) end -local function list_update(w, buttons, label, data, objects) +local function list_update(w, buttons, label, _, objects) -- update the widgets, creating them if needed w:reset() local index = 0 @@ -112,7 +112,7 @@ local function list_update(w, buttons, label, data, objects) delay_show = 1, }) - local text, bg, bg_image, icon, args = label(o, tb) + local text, _, bg_image, icon, args = label(o, tb) args = args or {} -- The text might be invalid, so use pcall. diff --git a/nvim/lua/lsp_config.lua b/nvim/lua/lsp_config.lua index e6b4492..1f7e240 100644 --- a/nvim/lua/lsp_config.lua +++ b/nvim/lua/lsp_config.lua @@ -191,11 +191,15 @@ require('lspconfig').lua_ls.setup { }, diagnostics = { -- Get the language server to recognize the `vim` global - globals = {'vim'}, + globals = {'vim', 'use', 'awesome', 'client', 'root'}, }, workspace = { -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), + library = { + ['/usr/share/nvim/runtime/lua'] = true, + ['/usr/share/nvim/runtime/lua/lsp'] = true, + ['/usr/share/awesome/lib'] = true + } }, -- Do not send telemetry data containing a randomized but unique identifier telemetry = {