From 8dcb8694e56bb87af8be3ed14e8f33e5ce463161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Sat, 23 Jul 2022 19:31:38 +0200 Subject: [PATCH] Formatting --- awesome/components/exit-screen.lua | 226 ++--- awesome/components/notifications.lua | 74 +- awesome/components/pastel/top-panel.lua | 84 +- awesome/keys.lua | 1024 +++++++++++------------ awesome/pastel.lua | 44 +- awesome/rc.lua | 110 +-- awesome/rules.lua | 172 ++-- awesome/widgets/clickable-container.lua | 56 +- awesome/widgets/folder.lua | 96 +-- awesome/widgets/layout-box.lua | 47 +- awesome/widgets/task-list.lua | 316 +++---- 11 files changed, 1124 insertions(+), 1125 deletions(-) diff --git a/awesome/components/exit-screen.lua b/awesome/components/exit-screen.lua index 20d29bc..3178369 100644 --- a/awesome/components/exit-screen.lua +++ b/awesome/components/exit-screen.lua @@ -31,30 +31,30 @@ local exit_screen = {} local icon_size = dpi(90) local build_button = function(icon) - local button = wibox.widget { - wibox.widget { - wibox.widget { + local button = wibox.widget { + wibox.widget { wibox.widget { - image = icon, - widget = wibox.widget.imagebox + wibox.widget { + image = icon, + widget = wibox.widget.imagebox + }, + top = dpi(16), + bottom = dpi(16), + left = dpi(16), + right = dpi(16), + widget = wibox.container.margin }, - top = dpi(16), - bottom = dpi(16), - left = dpi(16), - right = dpi(16), - widget = wibox.container.margin - }, - shape = gears.shape.circle, - forced_width = icon_size, - forced_height = icon_size, - widget = clickable_container - }, - left = dpi(24), - right = dpi(24), - widget = wibox.container.margin - } + shape = gears.shape.circle, + forced_width = icon_size, + forced_height = icon_size, + widget = clickable_container + }, + left = dpi(24), + right = dpi(24), + widget = wibox.container.margin + } - return button + return button end @@ -66,102 +66,102 @@ end local exit_screen_grabber local function suspend_command() - exit_screen.hide() - awful.spawn.with_shell(apps.lock .. " & systemctl suspend") + exit_screen.hide() + awful.spawn.with_shell(apps.lock .. " & systemctl suspend") end local function exit_command() - awesome.quit() + awesome.quit() end local function lock_command() - exit_screen.hide() - awful.spawn.with_shell("sleep 1 && " .. apps.lock) + exit_screen.hide() + awful.spawn.with_shell("sleep 1 && " .. apps.lock) end local function poweroff_command() - awful.spawn.with_shell("poweroff") - awful.keygrabber.stop(exit_screen_grabber) + awful.spawn.with_shell("poweroff") + awful.keygrabber.stop(exit_screen_grabber) end local function reboot_command() - awful.spawn.with_shell("reboot") - awful.keygrabber.stop(exit_screen_grabber) + awful.spawn.with_shell("reboot") + awful.keygrabber.stop(exit_screen_grabber) end local poweroff = build_button(ICON_DIR .. "power.png", "Shutdown") poweroff:connect_signal( - "button::release", - function() - poweroff_command() - end + "button::release", + function() + poweroff_command() + end ) local reboot = build_button(ICON_DIR .. "restart.png", "Restart") reboot:connect_signal( - "button::release", - function() - reboot_command() - end + "button::release", + function() + reboot_command() + end ) local suspend = build_button(ICON_DIR .. "sleep.png", "Sleep") suspend:connect_signal( - "button::release", - function() - suspend_command() - end + "button::release", + function() + suspend_command() + end ) local exit = build_button(ICON_DIR .. "logout.png", "Logout") exit:connect_signal( - "button::release", - function() - exit_command() - end + "button::release", + function() + exit_command() + end ) local lock = build_button(ICON_DIR .. "lock.png", "Lock") lock:connect_signal( - "button::release", - function() - lock_command() - end + "button::release", + function() + lock_command() + end ) -- subscribe to the show_exit_screen signal -- show the exit screen when signal is broadcasted awesome.connect_signal("show_exit_screen", - function() - exit_screen_grabber = awful.keygrabber.run( - function(_, key, event) - if event == "release" then - return - end + function() + exit_screen_grabber = awful.keygrabber.run( + function(_, key, event) + if event == "release" then + return + end - if key == "s" then - suspend_command() - elseif key == "e" then - exit_command() - elseif key == "l" then - lock_command() - elseif key == "p" then - poweroff_command() - elseif key == "r" then - reboot_command() - elseif key == "Escape" or key == "q" or key == "x" then - exit_screen.hide() + if key == "s" then + suspend_command() + elseif key == "e" then + exit_command() + elseif key == "l" then + lock_command() + elseif key == "p" then + poweroff_command() + elseif key == "r" then + reboot_command() + elseif key == "Escape" or key == "q" or key == "x" then + exit_screen.hide() + end end - end - ) - exit_screen.widget.visible = true - end + ) + exit_screen.widget.visible = true + end ) -- hide exit screen function exit_screen.hide() - awful.keygrabber.stop(exit_screen_grabber) - exit_screen.widget.visible = false + awful.keygrabber.stop(exit_screen_grabber) + exit_screen.widget.visible = false end @@ -174,52 +174,52 @@ local screen_geometry = awful.screen.focused().geometry -- Create the widget exit_screen.widget = wibox({ - x = screen_geometry.x, - y = screen_geometry.y, - visible = false, - ontop = true, - type = "splash", - height = screen_geometry.height, - width = screen_geometry.width + x = screen_geometry.x, + y = screen_geometry.y, + visible = false, + ontop = true, + type = "splash", + height = screen_geometry.height, + width = screen_geometry.width }) exit_screen.widget:buttons( - gears.table.join( - -- Middle click - Hide exit_screen - awful.button({}, 2, - function() - exit_screen.hide() - end - ), - -- Right click - Hide exit_screen - awful.button({}, 3, - function() - exit_screen.hide() - end - ) - ) + gears.table.join( + -- Middle click - Hide exit_screen + awful.button({}, 2, + function() + exit_screen.hide() + end + ), + -- Right click - Hide exit_screen + awful.button({}, 3, + function() + exit_screen.hide() + end + ) + ) ) -- Item placement exit_screen.widget:setup { - nil, - { - nil, - { - poweroff, - reboot, - suspend, - exit, - lock, - layout = wibox.layout.fixed.horizontal - }, - nil, - expand = "none", - layout = wibox.layout.align.horizontal - }, - nil, - expand = "none", - layout = wibox.layout.align.vertical + nil, + { + nil, + { + poweroff, + reboot, + suspend, + exit, + lock, + layout = wibox.layout.fixed.horizontal + }, + nil, + expand = "none", + layout = wibox.layout.align.horizontal + }, + nil, + expand = "none", + layout = wibox.layout.align.vertical } return exit_screen diff --git a/awesome/components/notifications.lua b/awesome/components/notifications.lua index afbce2e..41df383 100644 --- a/awesome/components/notifications.lua +++ b/awesome/components/notifications.lua @@ -32,14 +32,14 @@ naughty.config.defaults.margin = dpi(16) naughty.config.defaults.border_width = 0 naughty.config.defaults.position = "top_right" naughty.config.defaults.shape = function(cr, w, h) - gears.shape.rounded_rect(cr, w, h, dpi(6)) + gears.shape.rounded_rect(cr, w, h, dpi(6)) end naughty.config.padding = dpi(7) naughty.config.spacing = dpi(7) naughty.config.icon_dirs = { - "/usr/share/icons/Tela-dark", - "/usr/share/pixmaps/" + "/usr/share/icons/Tela-dark", + "/usr/share/pixmaps/" } naughty.config.icon_formats = {"png", "svg"} @@ -48,25 +48,25 @@ naughty.config.presets.low.timeout = 3 naughty.config.presets.critical.timeout = 0 naughty.config.presets.normal = { - font = beautiful.title_font, - fg = beautiful.fg_normal, - bg = beautiful.bg_normal, - position = "top_right" + font = beautiful.title_font, + fg = beautiful.fg_normal, + bg = beautiful.bg_normal, + position = "top_right" } naughty.config.presets.low = { - font = beautiful.title_font, - fg = beautiful.fg_normal, - bg = beautiful.bg_normal, - position = "top_right" + font = beautiful.title_font, + fg = beautiful.fg_normal, + bg = beautiful.bg_normal, + position = "top_right" } naughty.config.presets.critical = { - font = "SF Display Bold 10", - fg = "#ffffff", - bg = "#ff0000", - position = "top_right", - timeout = 0 + font = "SF Display Bold 10", + fg = "#ffffff", + bg = "#ff0000", + position = "top_right", + timeout = 0 } naughty.config.presets.ok = naughty.config.presets.normal @@ -80,29 +80,29 @@ naughty.config.presets.warn = naughty.config.presets.critical if awesome.startup_errors then - naughty.notify({ - preset = naughty.config.presets.critical, - title = "Oops, there were errors during startup!", - text = awesome.startup_errors - }) + naughty.notify({ + preset = naughty.config.presets.critical, + title = "Oops, there were errors during startup!", + text = awesome.startup_errors + }) end do - local in_error = false - awesome.connect_signal( - "debug::error", - function(err) - if in_error then - return - end - in_error = true + local in_error = false + awesome.connect_signal( + "debug::error", + function(err) + if in_error then + return + end + in_error = true - naughty.notify({ - preset = naughty.config.presets.critical, - title = "Oops, an error happened!", - text = tostring(err) - }) - in_error = false - end - ) + naughty.notify({ + preset = naughty.config.presets.critical, + title = "Oops, an error happened!", + text = tostring(err) + }) + in_error = false + end + ) end diff --git a/awesome/components/pastel/top-panel.lua b/awesome/components/pastel/top-panel.lua index f0c3cec..cc03f55 100644 --- a/awesome/components/pastel/top-panel.lua +++ b/awesome/components/pastel/top-panel.lua @@ -82,55 +82,55 @@ local cpu_widget = wibox.widget{ -- =================================================================== top_panel.create = function(s) - local panel = awful.wibar({ - screen = s, - position = "top", - ontop = true, - height = beautiful.top_panel_height, - width = s.geometry.width, - bg = theme.bg_normal .. "99" - }) + local panel = awful.wibar({ + screen = s, + position = "top", + ontop = true, + height = beautiful.top_panel_height, + width = s.geometry.width, + bg = theme.bg_normal .. "99" + }) - panel:setup { - expand = "none", - layout = wibox.layout.align.horizontal, - task_list.create(s), - nil, - { - layout = wibox.layout.fixed.horizontal, - pl(wibox.widget{}, theme.bg_normal .. "00", theme.top_panel_powerline), - pl(wibox.container.margin(wibox.widget.systray(), 0, 0, 5, 5), theme.top_panel_powerline, theme.bg_normal), - pl(volume_widget({widget_type='icon_and_text'}), theme.bg_normal, theme.top_panel_powerline), - pl(awful.widget.watch('bash -c "sensors | grep Tctl | cut -f 10 -d \' \' | cut -c 2-"', 5), theme.top_panel_powerline, theme.bg_normal), - pl(memory_widget, theme.bg_normal, theme.top_panel_powerline), - pl(cpu_widget, theme.top_panel_powerline, theme.bg_normal), - pl(frequency_widget, theme.bg_normal, theme.top_panel_powerline), - pl(updates_indicator, theme.top_panel_powerline, theme.bg_normal), - pl(require("widgets.layout-box"), theme.bg_normal, theme.top_panel_powerline), - pl(wibox.widget.textclock('%a %b %d, %H:%M:%S', 1), theme.top_panel_powerline, theme.top_panel_powerline), - } - } + panel:setup { + expand = "none", + layout = wibox.layout.align.horizontal, + task_list.create(s), + nil, + { + layout = wibox.layout.fixed.horizontal, + pl(wibox.widget{}, theme.bg_normal .. "00", theme.top_panel_powerline), + pl(wibox.container.margin(wibox.widget.systray(), 0, 0, 5, 5), theme.top_panel_powerline, theme.bg_normal), + pl(volume_widget({widget_type='icon_and_text'}), theme.bg_normal, theme.top_panel_powerline), + pl(awful.widget.watch('bash -c "sensors | grep Tctl | cut -f 10 -d \' \' | cut -c 2-"', 5), theme.top_panel_powerline, theme.bg_normal), + pl(memory_widget, theme.bg_normal, theme.top_panel_powerline), + pl(cpu_widget, theme.top_panel_powerline, theme.bg_normal), + pl(frequency_widget, theme.bg_normal, theme.top_panel_powerline), + pl(updates_indicator, theme.top_panel_powerline, theme.bg_normal), + pl(require("widgets.layout-box"), theme.bg_normal, theme.top_panel_powerline), + pl(wibox.widget.textclock('%a %b %d, %H:%M:%S', 1), theme.top_panel_powerline, theme.top_panel_powerline), + } + } - -- =================================================================== - -- Functionality - -- =================================================================== + -- =================================================================== + -- Functionality + -- =================================================================== - -- hide panel when client is fullscreen - local function change_panel_visibility(client) - if client.screen == s then - panel.ontop = not client.fullscreen - end - end + -- hide panel when client is fullscreen + local function change_panel_visibility(client) + if client.screen == s then + panel.ontop = not client.fullscreen + end + end - -- connect panel visibility function to relevant signals - client.connect_signal("property::fullscreen", change_panel_visibility) - client.connect_signal("focus", change_panel_visibility) + -- connect panel visibility function to relevant signals + client.connect_signal("property::fullscreen", change_panel_visibility) + client.connect_signal("focus", change_panel_visibility) - updates_indicator:connect_signal("button::press", function(c, _, _, button) - awful.spawn('bash -c "WINIT_X11_SCALE_FACTOR=1 alacritty -e bash -c \"yay ; echo \'\\nDone, press any key to exit...\' ; read\""') - end) + updates_indicator:connect_signal("button::press", function(c, _, _, button) + awful.spawn('bash -c "WINIT_X11_SCALE_FACTOR=1 alacritty -e bash -c \"yay ; echo \'\\nDone, press any key to exit...\' ; read\""') + end) end diff --git a/awesome/keys.lua b/awesome/keys.lua index c503cba..a1699cc 100644 --- a/awesome/keys.lua +++ b/awesome/keys.lua @@ -1,9 +1,9 @@ --- ██╗ ██╗███████╗██╗ ██╗███████╗ --- ██║ ██╔╝██╔════╝╚██╗ ██╔╝██╔════╝ --- █████╔╝ █████╗ ╚████╔╝ ███████╗ --- ██╔═██╗ ██╔══╝ ╚██╔╝ ╚════██║ --- ██║ ██╗███████╗ ██║ ███████║ --- ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝ +-- ██╗ ██╗███████╗██╗ ██╗███████╗ +-- ██║ ██╔╝██╔════╝╚██╗ ██╔╝██╔════╝ +-- █████╔╝ █████╗ ╚████╔╝ ███████╗ +-- ██╔═██╗ ██╔══╝ ╚██╔╝ ╚════██║ +-- ██║ ██╗███████╗ ██║ ███████║ +-- ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝ -- =================================================================== @@ -33,28 +33,28 @@ local keys = {} -- Move given client to given direction local function move_client(c, direction) - -- If client is floating, move to edge - if c.floating or (awful.layout.get(mouse.screen) == awful.layout.suit.floating) then - local workarea = awful.screen.focused().workarea - if direction == "up" then - c:geometry({nil, y = workarea.y + beautiful.useless_gap * 2, nil, nil}) - elseif direction == "down" then - c:geometry({nil, y = workarea.height + workarea.y - c:geometry().height - beautiful.useless_gap * 2 - beautiful.border_width * 2, nil, nil}) - elseif direction == "left" then - c:geometry({x = workarea.x + beautiful.useless_gap * 2, nil, nil, nil}) - elseif direction == "right" then - c:geometry({x = workarea.width + workarea.x - c:geometry().width - beautiful.useless_gap * 2 - beautiful.border_width * 2, nil, nil, nil}) - end - -- Otherwise swap the client in the tiled layout - elseif awful.layout.get(mouse.screen) == awful.layout.suit.max then - if direction == "up" or direction == "left" then - awful.client.swap.byidx(-1, c) - elseif direction == "down" or direction == "right" then - awful.client.swap.byidx(1, c) - end - else - awful.client.swap.bydirection(direction, c, nil) - end + -- If client is floating, move to edge + if c.floating or (awful.layout.get(mouse.screen) == awful.layout.suit.floating) then + local workarea = awful.screen.focused().workarea + if direction == "up" then + c:geometry({nil, y = workarea.y + beautiful.useless_gap * 2, nil, nil}) + elseif direction == "down" then + c:geometry({nil, y = workarea.height + workarea.y - c:geometry().height - beautiful.useless_gap * 2 - beautiful.border_width * 2, nil, nil}) + elseif direction == "left" then + c:geometry({x = workarea.x + beautiful.useless_gap * 2, nil, nil, nil}) + elseif direction == "right" then + c:geometry({x = workarea.width + workarea.x - c:geometry().width - beautiful.useless_gap * 2 - beautiful.border_width * 2, nil, nil, nil}) + end + -- Otherwise swap the client in the tiled layout + elseif awful.layout.get(mouse.screen) == awful.layout.suit.max then + if direction == "up" or direction == "left" then + awful.client.swap.byidx(-1, c) + elseif direction == "down" or direction == "right" then + awful.client.swap.byidx(1, c) + end + else + awful.client.swap.bydirection(direction, c, nil) + end end @@ -63,35 +63,35 @@ local floating_resize_amount = dpi(20) local tiling_resize_factor = 0.05 local function resize_client(c, direction) - if awful.layout.get(mouse.screen) == awful.layout.suit.floating or (c and c.floating) then - if direction == "up" then - c:relative_move(0, 0, 0, -floating_resize_amount) - elseif direction == "down" then - c:relative_move(0, 0, 0, floating_resize_amount) - elseif direction == "left" then - c:relative_move(0, 0, -floating_resize_amount, 0) - elseif direction == "right" then - c:relative_move(0, 0, floating_resize_amount, 0) - end - else - if direction == "up" then - awful.client.incwfact(-tiling_resize_factor) - elseif direction == "down" then - awful.client.incwfact(tiling_resize_factor) - elseif direction == "left" then - awful.tag.incmwfact(-tiling_resize_factor) - elseif direction == "right" then - awful.tag.incmwfact(tiling_resize_factor) - end - end + if awful.layout.get(mouse.screen) == awful.layout.suit.floating or (c and c.floating) then + if direction == "up" then + c:relative_move(0, 0, 0, -floating_resize_amount) + elseif direction == "down" then + c:relative_move(0, 0, 0, floating_resize_amount) + elseif direction == "left" then + c:relative_move(0, 0, -floating_resize_amount, 0) + elseif direction == "right" then + c:relative_move(0, 0, floating_resize_amount, 0) + end + else + if direction == "up" then + awful.client.incwfact(-tiling_resize_factor) + elseif direction == "down" then + awful.client.incwfact(tiling_resize_factor) + elseif direction == "left" then + awful.tag.incmwfact(-tiling_resize_factor) + elseif direction == "right" then + awful.tag.incmwfact(tiling_resize_factor) + end + end end -- raise focused client local function raise_client() - if client.focus then - client.focus:raise() - end + if client.focus then + client.focus:raise() + end end @@ -102,27 +102,27 @@ end -- Mouse buttons on the desktop keys.desktopbuttons = gears.table.join( - -- left click on desktop to hide notification - awful.button({}, 1, - function () - naughty.destroy_all_notifications() - end - ) + -- left click on desktop to hide notification + awful.button({}, 1, + function () + naughty.destroy_all_notifications() + end + ) ) -- Mouse buttons on the client keys.clientbuttons = gears.table.join( - -- Raise client - awful.button({}, 1, - function(c) - client.focus = c - c:raise() - end - ), + -- Raise client + awful.button({}, 1, + function(c) + client.focus = c + c:raise() + end + ), - -- Move and Resize Client - awful.button({modkey}, 1, awful.mouse.client.move), - awful.button({modkey}, 3, awful.mouse.client.resize) + -- Move and Resize Client + awful.button({modkey}, 1, awful.mouse.client.move), + awful.button({modkey}, 3, awful.mouse.client.resize) ) @@ -132,375 +132,375 @@ keys.clientbuttons = gears.table.join( keys.globalkeys = gears.table.join( - -- ========================================= - -- SPAWN APPLICATION KEY BINDINGS - -- ========================================= + -- ========================================= + -- SPAWN APPLICATION KEY BINDINGS + -- ========================================= - -- Spawn terminal - awful.key({modkey}, "Return", - function() - awful.spawn(apps.terminal) - end, - {description = "open a terminal", group = "launcher"} - ), - -- Spawn browser - awful.key({modkey}, "b", - function() - awful.spawn("firefox-developer-edition") - end, - {description = "Open Firefox", group = "launcher"} - ), - -- launch rofi - awful.key({modkey}, "d", - function() - awful.spawn(apps.launcher) - end, - {description = "application launcher", group = "launcher"} - ), - -- launch clipman - awful.key({modkey}, "c", - function() - awful.spawn('bash -c "CM_LAUNCHER=rofi clipmenu"') - end, - {description = "Clipboard manager", group = "launcher"} - ), + -- Spawn terminal + awful.key({modkey}, "Return", + function() + awful.spawn(apps.terminal) + end, + {description = "open a terminal", group = "launcher"} + ), + -- Spawn browser + awful.key({modkey}, "b", + function() + awful.spawn("firefox-developer-edition") + end, + {description = "Open Firefox", group = "launcher"} + ), + -- launch rofi + awful.key({modkey}, "d", + function() + awful.spawn(apps.launcher) + end, + {description = "application launcher", group = "launcher"} + ), + -- launch clipman + awful.key({modkey}, "c", + function() + awful.spawn('bash -c "CM_LAUNCHER=rofi clipmenu"') + end, + {description = "Clipboard manager", group = "launcher"} + ), - -- Quake - awful.key({ }, "F9", function () awful.screen.focused().quake:toggle() end), + -- Quake + awful.key({ }, "F9", function () awful.screen.focused().quake:toggle() end), - -- ========================================= - -- FUNCTION KEYS - -- ========================================= + -- ========================================= + -- FUNCTION KEYS + -- ========================================= - -- Brightness - awful.key({}, "XF86MonBrightnessUp", - function() - awful.spawn("xbacklight -inc 10", false) - end, - {description = "+10%", group = "hotkeys"} - ), - awful.key({}, "XF86MonBrightnessDown", - function() - awful.spawn("xbacklight -dec 10", false) - end, - {description = "-10%", group = "hotkeys"} - ), + -- Brightness + awful.key({}, "XF86MonBrightnessUp", + function() + awful.spawn("xbacklight -inc 10", false) + end, + {description = "+10%", group = "hotkeys"} + ), + awful.key({}, "XF86MonBrightnessDown", + function() + awful.spawn("xbacklight -dec 10", false) + end, + {description = "-10%", group = "hotkeys"} + ), - -- ALSA volume control - awful.key({}, "XF86AudioRaiseVolume", - function() - volume_widget:inc(5) - end, - {description = "volume up", group = "hotkeys"} - ), - awful.key({}, "XF86AudioLowerVolume", - function() - volume_widget:dec(5) - end, - {description = "volume down", group = "hotkeys"} - ), - awful.key({}, "XF86AudioMute", - function() - volume_widget:toggle() - end, - {description = "toggle mute", group = "hotkeys"} - ), - awful.key({}, "XF86AudioNext", - function() - awful.spawn("mpc next", false) - end, - {description = "next music", group = "hotkeys"} - ), - awful.key({}, "XF86AudioPrev", - function() - awful.spawn("mpc prev", false) - end, - {description = "previous music", group = "hotkeys"} - ), - awful.key({}, "XF86AudioPlay", - function() - awful.spawn("mpc toggle", false) - end, - {description = "play/pause music", group = "hotkeys"} - ), + -- ALSA volume control + awful.key({}, "XF86AudioRaiseVolume", + function() + volume_widget:inc(5) + end, + {description = "volume up", group = "hotkeys"} + ), + awful.key({}, "XF86AudioLowerVolume", + function() + volume_widget:dec(5) + end, + {description = "volume down", group = "hotkeys"} + ), + awful.key({}, "XF86AudioMute", + function() + volume_widget:toggle() + end, + {description = "toggle mute", group = "hotkeys"} + ), + awful.key({}, "XF86AudioNext", + function() + awful.spawn("mpc next", false) + end, + {description = "next music", group = "hotkeys"} + ), + awful.key({}, "XF86AudioPrev", + function() + awful.spawn("mpc prev", false) + end, + {description = "previous music", group = "hotkeys"} + ), + awful.key({}, "XF86AudioPlay", + function() + awful.spawn("mpc toggle", false) + end, + {description = "play/pause music", group = "hotkeys"} + ), - -- Screenshot on prtscn using scrot - awful.key({}, "Print", - function() - awful.util.spawn(apps.screenshot, false) - end - ), + -- Screenshot on prtscn using scrot + awful.key({}, "Print", + function() + awful.util.spawn(apps.screenshot, false) + end + ), - -- ========================================= - -- RELOAD / QUIT AWESOME - -- ========================================= + -- ========================================= + -- RELOAD / QUIT AWESOME + -- ========================================= - -- Reload Awesome - awful.key({modkey, "Shift"}, "r", - awesome.restart, - {description = "reload awesome", group = "awesome"} - ), + -- Reload Awesome + awful.key({modkey, "Shift"}, "r", + awesome.restart, + {description = "reload awesome", group = "awesome"} + ), - -- Quit Awesome - awful.key({modkey}, "Escape", - function() - -- emit signal to show the exit screen - awesome.emit_signal("show_exit_screen") - end, - {description = "toggle exit screen", group = "hotkeys"} - ), + -- Quit Awesome + awful.key({modkey}, "Escape", + function() + -- emit signal to show the exit screen + awesome.emit_signal("show_exit_screen") + end, + {description = "toggle exit screen", group = "hotkeys"} + ), - awful.key({}, "XF86PowerOff", - function() - -- emit signal to show the exit screen - awesome.emit_signal("show_exit_screen") - end, - {description = "toggle exit screen", group = "hotkeys"} - ), + awful.key({}, "XF86PowerOff", + function() + -- emit signal to show the exit screen + awesome.emit_signal("show_exit_screen") + end, + {description = "toggle exit screen", group = "hotkeys"} + ), - -- ========================================= - -- CLIENT FOCUSING - -- ========================================= + -- ========================================= + -- 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 (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 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() - awful.client.focus.byidx(1) - end, - {description = "focus next by index", group = "client"} - ), - awful.key({modkey, "Shift"}, "Tab", - function() - awful.client.focus.byidx(-1) - end, - {description = "focus previous by index", group = "client"} - ), + -- Focus client by index (cycle through clients) + awful.key({modkey}, "Tab", + function() + awful.client.focus.byidx(1) + end, + {description = "focus next by index", group = "client"} + ), + awful.key({modkey, "Shift"}, "Tab", + function() + awful.client.focus.byidx(-1) + end, + {description = "focus previous by index", group = "client"} + ), - -- ========================================= - -- SCREEN FOCUSING - -- ========================================= + -- ========================================= + -- SCREEN FOCUSING + -- ========================================= - -- Focus screen by index (cycle through screens) - awful.key({modkey}, "s", - function() - awful.screen.focus_relative(1) - end - ), + -- Focus screen by index (cycle through screens) + awful.key({modkey}, "s", + function() + awful.screen.focus_relative(1) + end + ), - -- ========================================= - -- CLIENT RESIZING - -- ========================================= + -- ========================================= + -- CLIENT RESIZING + -- ========================================= - awful.key({modkey, "Control"}, "Down", - function(c) - resize_client(client.focus, "down") - end - ), - awful.key({modkey, "Control"}, "Up", - function(c) - resize_client(client.focus, "up") - end - ), - awful.key({modkey, "Control"}, "Left", - function(c) - resize_client(client.focus, "left") - end - ), - awful.key({modkey, "Control"}, "Right", - function(c) - resize_client(client.focus, "right") - end - ), - awful.key({modkey, "Control"}, "j", - function(c) - resize_client(client.focus, "down") - end - ), - awful.key({ modkey, "Control" }, "k", - function(c) - resize_client(client.focus, "up") - end - ), - awful.key({modkey, "Control"}, "h", - function(c) - resize_client(client.focus, "left") - end - ), - awful.key({modkey, "Control"}, "l", - function(c) - resize_client(client.focus, "right") - end - ), + awful.key({modkey, "Control"}, "Down", + function(c) + resize_client(client.focus, "down") + end + ), + awful.key({modkey, "Control"}, "Up", + function(c) + resize_client(client.focus, "up") + end + ), + awful.key({modkey, "Control"}, "Left", + function(c) + resize_client(client.focus, "left") + end + ), + awful.key({modkey, "Control"}, "Right", + function(c) + resize_client(client.focus, "right") + end + ), + awful.key({modkey, "Control"}, "j", + function(c) + resize_client(client.focus, "down") + end + ), + awful.key({ modkey, "Control" }, "k", + function(c) + resize_client(client.focus, "up") + end + ), + awful.key({modkey, "Control"}, "h", + function(c) + resize_client(client.focus, "left") + end + ), + awful.key({modkey, "Control"}, "l", + function(c) + resize_client(client.focus, "right") + end + ), - -- ========================================= - -- NUMBER OF MASTER / COLUMN CLIENTS - -- ========================================= + -- ========================================= + -- NUMBER OF MASTER / COLUMN CLIENTS + -- ========================================= - -- Number of master clients - awful.key({modkey, altkey}, "h", - function() - awful.tag.incnmaster( 1, nil, true) - end, - {description = "increase the number of master clients", group = "layout"} - ), - awful.key({ modkey, altkey }, "l", - function() - awful.tag.incnmaster(-1, nil, true) - end, - {description = "decrease the number of master clients", group = "layout"} - ), - awful.key({ modkey, altkey }, "Left", - function() - awful.tag.incnmaster( 1, nil, true) - end, - {description = "increase the number of master clients", group = "layout"} - ), - awful.key({ modkey, altkey }, "Right", - function() - awful.tag.incnmaster(-1, nil, true) - end, - {description = "decrease the number of master clients", group = "layout"} - ), + -- Number of master clients + awful.key({modkey, altkey}, "h", + function() + awful.tag.incnmaster( 1, nil, true) + end, + {description = "increase the number of master clients", group = "layout"} + ), + awful.key({ modkey, altkey }, "l", + function() + awful.tag.incnmaster(-1, nil, true) + end, + {description = "decrease the number of master clients", group = "layout"} + ), + awful.key({ modkey, altkey }, "Left", + function() + awful.tag.incnmaster( 1, nil, true) + end, + {description = "increase the number of master clients", group = "layout"} + ), + awful.key({ modkey, altkey }, "Right", + function() + awful.tag.incnmaster(-1, nil, true) + end, + {description = "decrease the number of master clients", group = "layout"} + ), - -- Number of columns - awful.key({modkey, altkey}, "k", - function() - awful.tag.incncol(1, nil, true) - end, - {description = "increase the number of columns", group = "layout"} - ), - awful.key({modkey, altkey}, "j", - function() - awful.tag.incncol(-1, nil, true) - end, - {description = "decrease the number of columns", group = "layout"} - ), - awful.key({modkey, altkey}, "Up", - function() - awful.tag.incncol(1, nil, true) - end, - {description = "increase the number of columns", group = "layout"} - ), - awful.key({modkey, altkey}, "Down", - function() - awful.tag.incncol(-1, nil, true) - end, - {description = "decrease the number of columns", group = "layout"} - ), + -- Number of columns + awful.key({modkey, altkey}, "k", + function() + awful.tag.incncol(1, nil, true) + end, + {description = "increase the number of columns", group = "layout"} + ), + awful.key({modkey, altkey}, "j", + function() + awful.tag.incncol(-1, nil, true) + end, + {description = "decrease the number of columns", group = "layout"} + ), + awful.key({modkey, altkey}, "Up", + function() + awful.tag.incncol(1, nil, true) + end, + {description = "increase the number of columns", group = "layout"} + ), + awful.key({modkey, altkey}, "Down", + function() + awful.tag.incncol(-1, nil, true) + end, + {description = "decrease the number of columns", group = "layout"} + ), - -- ========================================= - -- GAP CONTROL - -- ========================================= + -- ========================================= + -- GAP CONTROL + -- ========================================= - -- Gap control - awful.key({modkey, "Shift"}, "minus", - function() - awful.tag.incgap(5, nil) - end, - {description = "increment gaps size for the current tag", group = "gaps"} - ), - awful.key({modkey}, "minus", - function() - awful.tag.incgap(-5, nil) - end, - {description = "decrement gap size for the current tag", group = "gaps"} - ), + -- Gap control + awful.key({modkey, "Shift"}, "minus", + function() + awful.tag.incgap(5, nil) + end, + {description = "increment gaps size for the current tag", group = "gaps"} + ), + awful.key({modkey}, "minus", + function() + awful.tag.incgap(-5, nil) + end, + {description = "decrement gap size for the current tag", group = "gaps"} + ), - -- ========================================= - -- LAYOUT SELECTION - -- ========================================= + -- ========================================= + -- LAYOUT SELECTION + -- ========================================= - -- select next layout - awful.key({modkey}, "space", - function() - awful.layout.inc(1) - end, - {description = "select next", group = "layout"} - ), - -- select previous layout - awful.key({modkey, "Shift"}, "space", - function() - awful.layout.inc(-1) - end, - {description = "select previous", group = "layout"} - ), + -- select next layout + awful.key({modkey}, "space", + function() + awful.layout.inc(1) + end, + {description = "select next", group = "layout"} + ), + -- select previous layout + awful.key({modkey, "Shift"}, "space", + function() + awful.layout.inc(-1) + end, + {description = "select previous", group = "layout"} + ), - -- ========================================= - -- CLIENT MINIMIZATION - -- ========================================= + -- ========================================= + -- CLIENT MINIMIZATION + -- ========================================= - -- restore minimized client - awful.key({modkey, "Shift"}, "n", - function() - local c = awful.client.restore() - -- Focus restored client - if c then - client.focus = c - c:raise() - end - end, - {description = "restore minimized", group = "client"} - ) + -- restore minimized client + awful.key({modkey, "Shift"}, "n", + function() + local c = awful.client.restore() + -- Focus restored client + if c then + client.focus = c + c:raise() + end + end, + {description = "restore minimized", group = "client"} + ) ) @@ -510,117 +510,117 @@ keys.globalkeys = gears.table.join( keys.clientkeys = gears.table.join( - -- Move to edge or swap by direction - awful.key({modkey, "Shift"}, "Down", - function(c) - move_client(c, "down") - end - ), - awful.key({modkey, "Shift"}, "Up", - function(c) - move_client(c, "up") - end - ), - awful.key({modkey, "Shift"}, "Left", - function(c) - move_client(c, "left") - end - ), - awful.key({modkey, "Shift"}, "Right", - function(c) - move_client(c, "right") - end - ), - awful.key({modkey, "Shift"}, "j", - function(c) - move_client(c, "down") - end - ), - awful.key({modkey, "Shift"}, "k", - function(c) - move_client(c, "up") - end - ), - awful.key({modkey, "Shift"}, "h", - function(c) - move_client(c, "left") - end - ), - awful.key({modkey, "Shift"}, "l", - function(c) - move_client(c, "right") - end - ), + -- Move to edge or swap by direction + awful.key({modkey, "Shift"}, "Down", + function(c) + move_client(c, "down") + end + ), + awful.key({modkey, "Shift"}, "Up", + function(c) + move_client(c, "up") + end + ), + awful.key({modkey, "Shift"}, "Left", + function(c) + move_client(c, "left") + end + ), + awful.key({modkey, "Shift"}, "Right", + function(c) + move_client(c, "right") + end + ), + awful.key({modkey, "Shift"}, "j", + function(c) + move_client(c, "down") + end + ), + awful.key({modkey, "Shift"}, "k", + function(c) + move_client(c, "up") + end + ), + awful.key({modkey, "Shift"}, "h", + function(c) + move_client(c, "left") + end + ), + awful.key({modkey, "Shift"}, "l", + function(c) + move_client(c, "right") + end + ), - -- toggle fullscreen - -- awful.key({modkey}, "f", - -- function(c) - -- c.fullscreen = not c.fullscreen - -- end, - -- {description = "toggle fullscreen", group = "client"} - -- ), + -- toggle fullscreen + -- awful.key({modkey}, "f", + -- function(c) + -- c.fullscreen = not c.fullscreen + -- end, + -- {description = "toggle fullscreen", group = "client"} + -- ), - -- close client - awful.key({modkey}, "q", - function(c) - c:kill() - end, - {description = "close", group = "client"} - ), + -- close client + awful.key({modkey}, "q", + function(c) + c:kill() + end, + {description = "close", group = "client"} + ), - -- float client - awful.key({modkey}, "f", - function(c) - awful.client.floating.toggle(c) - end, - {description = "float", group = "client"} - ), + -- float client + awful.key({modkey}, "f", + function(c) + awful.client.floating.toggle(c) + end, + {description = "float", group = "client"} + ), - -- Minimize - awful.key({modkey}, "n", - function(c) - c.minimized = true - end, - {description = "minimize", group = "client"} - ), + -- Minimize + awful.key({modkey}, "n", + function(c) + c.minimized = true + end, + {description = "minimize", group = "client"} + ), - -- Maximize - awful.key({modkey}, "m", - function(c) - c.maximized = not c.maximized - c:raise() - end, - {description = "(un)maximize", group = "client"} - ) + -- Maximize + awful.key({modkey}, "m", + function(c) + c.maximized = not c.maximized + c:raise() + end, + {description = "(un)maximize", group = "client"} + ) ) -- Bind all key numbers to tags for i = 1, 9 do - keys.globalkeys = gears.table.join(keys.globalkeys, - -- Switch to tag - awful.key({modkey}, "#" .. i + 9, - function() - local screen = awful.screen.focused() - local tag = screen.tags[i] - if tag then - tag:view_only() - end - end, - {description = "view tag #"..i, group = "tag"} - ), - -- Move client to tag - awful.key({modkey, "Shift"}, "#" .. i + 9, - function() - if client.focus then - local tag = client.focus.screen.tags[i] - if tag then - client.focus:move_to_tag(tag) - end - end - end, - {description = "move focused client to tag #"..i, group = "tag"} - ) - ) + keys.globalkeys = gears.table.join(keys.globalkeys, + -- Switch to tag + awful.key({modkey}, "#" .. i + 9, + function() + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + tag:view_only() + end + end, + {description = "view tag #"..i, group = "tag"} + ), + -- Move client to tag + awful.key({modkey, "Shift"}, "#" .. i + 9, + function() + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:move_to_tag(tag) + end + end + end, + {description = "move focused client to tag #"..i, group = "tag"} + ) + ) end return keys diff --git a/awesome/pastel.lua b/awesome/pastel.lua index b223082..c051c2d 100644 --- a/awesome/pastel.lua +++ b/awesome/pastel.lua @@ -24,33 +24,33 @@ local pastel = {} pastel.initialize = function() - -- Import components - require("components.pastel.wallpaper") - require("components.exit-screen") + -- Import components + require("components.pastel.wallpaper") + require("components.exit-screen") - -- Import panels - local top_panel = require("components.pastel.top-panel") + -- Import panels + local top_panel = require("components.pastel.top-panel") - -- Set up each screen (add tags & panels) - awful.screen.connect_for_each_screen(function(s) - for i = 1, 9, 1 - do - awful.tag.add(i, { - icon_only = true, - layout = awful.layout.suit.tile, - screen = s, - selected = i == 1 - }) - end + -- Set up each screen (add tags & panels) + awful.screen.connect_for_each_screen(function(s) + for i = 1, 9, 1 + do + awful.tag.add(i, { + icon_only = true, + layout = awful.layout.suit.tile, + screen = s, + selected = i == 1 + }) + end - s.quake = quake + s.quake = quake - -- Only add the top panel on the primary screen - if s.index == 1 then - top_panel.create(s) - end + -- Only add the top panel on the primary screen + if s.index == 1 then + top_panel.create(s) + end - end) + end) end return pastel diff --git a/awesome/rc.lua b/awesome/rc.lua index a6dca53..004bf8a 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -20,27 +20,27 @@ local theme_config_dir = gears.filesystem.get_configuration_dir() .. "/configura -- define default apps (global variable so other components can access it) apps = { - network_manager = "nm-connection-editor", -- recommended: nm-connection-editor - power_manager = "", -- recommended: xfce4-power-manager - terminal = 'bash -c "WINIT_X11_SCALE_FACTOR=1 alacritty"', - launcher = "/home/user/.toggle_rofi.sh", - lock = "i3lock", - screenshot = "scrot -e 'mv $f ~/Pictures/Screenshots/ 2>/dev/null'", - filebrowser = "nautilus" + network_manager = "nm-connection-editor", -- recommended: nm-connection-editor + power_manager = "", -- recommended: xfce4-power-manager + terminal = 'bash -c "WINIT_X11_SCALE_FACTOR=1 alacritty"', + launcher = "/home/user/.toggle_rofi.sh", + lock = "i3lock", + screenshot = "scrot -e 'mv $f ~/Pictures/Screenshots/ 2>/dev/null'", + filebrowser = "nautilus" } -- define wireless and ethernet interface names for the network widget -- use `ip link` command to determine these network_interfaces = { - lan = 'enp4s0' + lan = 'enp4s0' } -- List of apps to run on start-up local run_on_start_up = { - "numlockx on", - "bluetoothctl power on", - "nm-applet", - "blueman-applet" + "numlockx on", + "bluetoothctl power on", + "nm-applet", + "blueman-applet" } -- =================================================================== @@ -53,13 +53,13 @@ require("components.notifications") -- Run all the apps listed in run_on_start_up for _, app in ipairs(run_on_start_up) do - local findme = app - local firstspace = app:find(" ") - if firstspace then - findme = app:sub(0, firstspace - 1) - end - -- pipe commands to bash to allow command to be shell agnostic - awful.spawn.with_shell(string.format("echo 'pgrep -u $USER -x %s > /dev/null || (%s)' | bash -", findme, app), false) + local findme = app + local firstspace = app:find(" ") + if firstspace then + findme = app:sub(0, firstspace - 1) + end + -- pipe commands to bash to allow command to be shell agnostic + awful.spawn.with_shell(string.format("echo 'pgrep -u $USER -x %s > /dev/null || (%s)' | bash -", findme, app), false) end -- Import theme @@ -81,36 +81,36 @@ awful.rules.rules = create_rules(keys.clientkeys, keys.clientbuttons) -- Define layouts awful.layout.layouts = { - awful.layout.suit.floating, - awful.layout.suit.tile, - awful.layout.suit.tile.left, - awful.layout.suit.tile.bottom, - awful.layout.suit.tile.top, - awful.layout.suit.fair, - awful.layout.suit.fair.horizontal, + awful.layout.suit.floating, + awful.layout.suit.tile, + awful.layout.suit.tile.left, + awful.layout.suit.tile.bottom, + awful.layout.suit.tile.top, + awful.layout.suit.fair, + awful.layout.suit.fair.horizontal, } -- remove gaps if layout is set to max tag.connect_signal('property::layout', function(t) - local current_layout = awful.tag.getproperty(t, 'layout') - if (current_layout == awful.layout.suit.max) then - t.gap = 0 - else - t.gap = beautiful.useless_gap - end + local current_layout = awful.tag.getproperty(t, 'layout') + if (current_layout == awful.layout.suit.max) then + t.gap = 0 + else + t.gap = beautiful.useless_gap + end end) -- Signal function to execute when a new client appears. client.connect_signal("manage", function (c) - -- Set the window as a slave (put it at the end of others instead of setting it as master) - if not awesome.startup then - awful.client.setslave(c) - end + -- Set the window as a slave (put it at the end of others instead of setting it as master) + if not awesome.startup then + awful.client.setslave(c) + end - if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then - -- Prevent clients from being unreachable after screen count changes. - awful.placement.no_offscreen(c) - end + if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then + -- Prevent clients from being unreachable after screen count changes. + awful.placement.no_offscreen(c) + end end) @@ -124,7 +124,7 @@ require("awful.autofocus") -- Focus clients under mouse client.connect_signal("mouse::enter", function(c) - c:emit_signal("request::activate", "mouse_enter", {raise = false}) + c:emit_signal("request::activate", "mouse_enter", {raise = false}) end) @@ -146,24 +146,24 @@ collectgarbage("setpause", 110) collectgarbage("setstepmul", 1000) require("awesomewm-vim-tmux-navigator") { - up = {"Up", "k"}, - down = {"Down", "j"}, - left = {"Left", "h"}, - right = {"Right", "l"}, - mod = "Mod4", - mod_keysym = "Super_L", - -- experimental = true + up = {"Up", "k"}, + down = {"Down", "j"}, + left = {"Left", "h"}, + right = {"Right", "l"}, + mod = "Mod4", + mod_keysym = "Super_L", + -- experimental = true } local handle_single_win = function(focused) - local hide = focused.maximized or focused.fullscreen - for i, c in ipairs(client.get()) do - if not c.floating and c.screen == focused.screen then - c.minimized = hide - end - end + local hide = focused.maximized or focused.fullscreen + for i, c in ipairs(client.get()) do + if not c.floating and c.screen == focused.screen then + c.minimized = hide + end + end - focused.minimized = false + focused.minimized = false end -- -- client.connect_signal("property::fullscreen", handle_single_win) diff --git a/awesome/rules.lua b/awesome/rules.lua index 438a625..3f45b05 100644 --- a/awesome/rules.lua +++ b/awesome/rules.lua @@ -28,97 +28,97 @@ local rules = {} -- return a table of client rules including provided keys / buttons function rules.create(clientkeys, clientbuttons) - return { - -- All clients will match this rule. - { - rule = {}, - properties = { - titlebars_enabled = beautiful.titlebars_enabled, - border_width = beautiful.border_width, - border_color = beautiful.border_normal, - focus = awful.client.focus.filter, - raise = true, - keys = clientkeys, - buttons = clientbuttons, - screen = awful.screen.preferred, - placement = awful.placement.centered - }, - }, - -- Floating clients. - { - rule_any = { - instance = { - "DTA", - "copyq", + return { + -- All clients will match this rule. + { + rule = {}, + properties = { + titlebars_enabled = beautiful.titlebars_enabled, + border_width = beautiful.border_width, + border_color = beautiful.border_normal, + focus = awful.client.focus.filter, + raise = true, + keys = clientkeys, + buttons = clientbuttons, + screen = awful.screen.preferred, + placement = awful.placement.centered }, - class = { - "Nm-connection-editor" - }, - name = { - "Event Tester", - "Steam Guard - Computer Authorization Required" - }, - role = { - "pop-up", - "GtkFileChooserDialog" - }, - type = { - "dialog" - } - }, properties = {floating = true} - }, + }, + -- Floating clients. + { + rule_any = { + instance = { + "DTA", + "copyq", + }, + class = { + "Nm-connection-editor" + }, + name = { + "Event Tester", + "Steam Guard - Computer Authorization Required" + }, + role = { + "pop-up", + "GtkFileChooserDialog" + }, + type = { + "dialog" + } + }, properties = {floating = true} + }, - -- Fullscreen clients - { - rule_any = { - class = { - "Terraria.bin.x86", + -- Fullscreen clients + { + rule_any = { + class = { + "Terraria.bin.x86", + }, + }, properties = {fullscreen = true} + }, + + -- "Switch to tag" + -- These clients make you switch to their tag when they appear + { + rule_any = { + class = { + "Firefox" + }, + }, properties = {switchtotag = true} + }, + + -- Visualizer + { + rule_any = {name = {"cava"}}, + properties = { + floating = true, + maximized_horizontal = true, + sticky = true, + ontop = false, + skip_taskbar = true, + below = true, + focusable = false, + height = screen_height * 0.40, + opacity = 0.6 }, - }, properties = {fullscreen = true} - }, + callback = function (c) + decorations.hide(c) + awful.placement.bottom(c) + end + }, - -- "Switch to tag" - -- These clients make you switch to their tag when they appear - { - rule_any = { - class = { - "Firefox" - }, - }, properties = {switchtotag = true} - }, + -- File chooser dialog + { + rule_any = {role = {"GtkFileChooserDialog"}}, + properties = {floating = true, width = screen_width * 0.55, height = screen_height * 0.65} + }, - -- Visualizer - { - rule_any = {name = {"cava"}}, - properties = { - floating = true, - maximized_horizontal = true, - sticky = true, - ontop = false, - skip_taskbar = true, - below = true, - focusable = false, - height = screen_height * 0.40, - opacity = 0.6 - }, - callback = function (c) - decorations.hide(c) - awful.placement.bottom(c) - end - }, - - -- File chooser dialog - { - rule_any = {role = {"GtkFileChooserDialog"}}, - properties = {floating = true, width = screen_width * 0.55, height = screen_height * 0.65} - }, - - -- Pavucontrol & Bluetooth Devices - { - rule_any = {class = {"Pavucontrol"}, name = {"Bluetooth Devices"}}, - properties = {floating = true, width = screen_width * 0.55, height = screen_height * 0.45} - }, - } + -- Pavucontrol & Bluetooth Devices + { + rule_any = {class = {"Pavucontrol"}, name = {"Bluetooth Devices"}}, + properties = {floating = true, width = screen_width * 0.55, height = screen_height * 0.45} + }, + } end -- return module table diff --git a/awesome/widgets/clickable-container.lua b/awesome/widgets/clickable-container.lua index 936a693..6504fe2 100644 --- a/awesome/widgets/clickable-container.lua +++ b/awesome/widgets/clickable-container.lua @@ -27,47 +27,47 @@ local wibox = require('wibox') function build(widget) local container = - wibox.widget { - widget, - widget = wibox.container.background + wibox.widget { + widget, + widget = wibox.container.background } local old_cursor, old_wibox container:connect_signal( - 'mouse::enter', - function() - container.bg = '#ffffff11' - local w = _G.mouse.current_wibox - if w then - old_cursor, old_wibox = w.cursor, w - w.cursor = 'hand1' - end - end + 'mouse::enter', + function() + container.bg = '#ffffff11' + local w = _G.mouse.current_wibox + if w then + old_cursor, old_wibox = w.cursor, w + w.cursor = 'hand1' + end + end ) container:connect_signal( - 'mouse::leave', - function() - container.bg = '#ffffff00' - if old_wibox then - old_wibox.cursor = old_cursor - old_wibox = nil - end - end + 'mouse::leave', + function() + container.bg = '#ffffff00' + if old_wibox then + old_wibox.cursor = old_cursor + old_wibox = nil + end + end ) container:connect_signal( - 'button::press', - function() - container.bg = '#ffffff22' - end + 'button::press', + function() + container.bg = '#ffffff22' + end ) container:connect_signal( - 'button::release', - function() - container.bg = '#ffffff11' - end + 'button::release', + function() + container.bg = '#ffffff11' + end ) return container diff --git a/awesome/widgets/folder.lua b/awesome/widgets/folder.lua index 50b0e61..ba1d075 100644 --- a/awesome/widgets/folder.lua +++ b/awesome/widgets/folder.lua @@ -30,14 +30,14 @@ local folder = {} -- 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 + 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 @@ -47,50 +47,50 @@ end function folder.create(directory) - local docu_widget = wibox.widget { - { - id = "icon", - widget = wibox.widget.imagebox, - resize = true - }, - layout = wibox.layout.align.horizontal - } + 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 - ) - ) - ) + 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 + -- 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"} - }) + 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 + docu_widget.icon:set_image(PATH_TO_ICONS .. folder_name:lower() .. ".png") + return docu_button end return folder diff --git a/awesome/widgets/layout-box.lua b/awesome/widgets/layout-box.lua index a682320..c24e953 100644 --- a/awesome/widgets/layout-box.lua +++ b/awesome/widgets/layout-box.lua @@ -10,7 +10,6 @@ -- =================================================================== -local clickable_container = require('widgets.clickable-container') local awful = require('awful') @@ -21,31 +20,31 @@ local awful = require('awful') -- Create an imagebox widget which will contains an icon indicating which layout we're using. -- We need one layoutbox per screen. -local layout_box = clickable_container(awful.widget.layoutbox(s)) +local layout_box = awful.widget.layoutbox(s) layout_box:buttons( - awful.util.table.join( - awful.button({}, 1, - function() - awful.layout.inc(1) - end - ), - awful.button({}, 3, - function() - awful.layout.inc(-1) - end - ), - awful.button({}, 4, - function() - awful.layout.inc(1) - end - ), - awful.button({}, 5, - function() - awful.layout.inc(-1) - end - ) - ) + awful.util.table.join( + awful.button({}, 1, + function() + awful.layout.inc(1) + end + ), + awful.button({}, 3, + function() + awful.layout.inc(-1) + end + ), + awful.button({}, 4, + function() + awful.layout.inc(1) + end + ), + awful.button({}, 5, + function() + awful.layout.inc(-1) + end + ) + ) ) return layout_box diff --git a/awesome/widgets/task-list.lua b/awesome/widgets/task-list.lua index 83befd2..b36efbc 100644 --- a/awesome/widgets/task-list.lua +++ b/awesome/widgets/task-list.lua @@ -1,9 +1,9 @@ --- ████████╗ █████╗ ███████╗██╗ ██╗ ██╗ ██╗███████╗████████╗ --- ╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝ ██║ ██║██╔════╝╚══██╔══╝ --- ██║ ███████║███████╗█████╔╝ ██║ ██║███████╗ ██║ --- ██║ ██╔══██║╚════██║██╔═██╗ ██║ ██║╚════██║ ██║ --- ██║ ██║ ██║███████║██║ ██╗ ███████╗██║███████║ ██║ --- ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚══════╝╚═╝╚══════╝ ╚═╝ +-- ████████╗ █████╗ ███████╗██╗ ██╗ ██╗ ██╗███████╗████████╗ +-- ╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝ ██║ ██║██╔════╝╚══██╔══╝ +-- ██║ ███████║███████╗█████╔╝ ██║ ██║███████╗ ██║ +-- ██║ ██╔══██║╚════██║██╔═██╗ ██║ ██║╚════██║ ██║ +-- ██║ ██║ ██║███████║██║ ██╗ ███████╗██║███████║ ██║ +-- ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚══════╝╚═╝╚══════╝ ╚═╝ -- =================================================================== -- Initialization @@ -31,118 +31,118 @@ local task_list = {} local function create_buttons(buttons, object) - if buttons then - local btns = {} - for _, b in ipairs(buttons) do - -- Create a proxy button object: it will receive the real - -- press and release events, and will propagate them to the - -- button object the user provided, but with the object as - -- argument. - local btn = capi.button {modifiers = b.modifiers, button = b.button} - btn:connect_signal('press', - function() - object.minimized = not object.minimized - end - ) - btns[#btns + 1] = btn - end - return btns - end + if buttons then + local btns = {} + for _, b in ipairs(buttons) do + -- Create a proxy button object: it will receive the real + -- press and release events, and will propagate them to the + -- button object the user provided, but with the object as + -- argument. + local btn = capi.button {modifiers = b.modifiers, button = b.button} + btn:connect_signal('press', + function() + object.minimized = not object.minimized + end + ) + btns[#btns + 1] = btn + end + return btns + end end local function list_update(w, buttons, label, data, objects) - -- update the widgets, creating them if needed - w:reset() - local index = 0 - local count = 0 - for _ in pairs(objects) do - count = count + 1 - end - for i, o in ipairs(objects) do - index = index + 1 - local ib, cb, tb, cbm, bgb, tbm, ibm, tt, l, ll - ib = wibox.widget.imagebox() - tb = wibox.widget.textbox() - cb = wibox.container.margin(wibox.widget.imagebox(ICON_DIR .. "close.svg"), dpi(9), dpi(9), dpi(9), dpi(9)) - cb.shape = gears.shape.circle - cbm = wibox.container.margin(cb, dpi(0), dpi(0), dpi(0), dpi(0)) -- 4, 8 ,12 ,12 -- close button - cbm:buttons(gears.table.join(awful.button({}, 1, nil, - function() - o.kill(o) - end - ))) - bgb = wibox.container.background() - tbm = wibox.container.margin(tb, dpi(4), dpi(4)) - ibm = wibox.container.margin(ib, dpi(5), dpi(5), dpi(5), dpi(5)) -- 12 is default top and bottom margin --app icon - l = wibox.layout.fixed.horizontal() - ll = wibox.layout.fixed.horizontal() + -- update the widgets, creating them if needed + w:reset() + local index = 0 + local count = 0 + for _ in pairs(objects) do + count = count + 1 + end + for i, o in ipairs(objects) do + index = index + 1 + local ib, cb, tb, cbm, bgb, tbm, ibm, tt, l, ll + ib = wibox.widget.imagebox() + tb = wibox.widget.textbox() + cb = wibox.container.margin(wibox.widget.imagebox(ICON_DIR .. "close.svg"), dpi(9), dpi(9), dpi(9), dpi(9)) + cb.shape = gears.shape.circle + cbm = wibox.container.margin(cb, dpi(0), dpi(0), dpi(0), dpi(0)) -- 4, 8 ,12 ,12 -- close button + cbm:buttons(gears.table.join(awful.button({}, 1, nil, + function() + o.kill(o) + end + ))) + bgb = wibox.container.background() + tbm = wibox.container.margin(tb, dpi(4), dpi(4)) + ibm = wibox.container.margin(ib, dpi(5), dpi(5), dpi(5), dpi(5)) -- 12 is default top and bottom margin --app icon + l = wibox.layout.fixed.horizontal() + ll = wibox.layout.fixed.horizontal() - -- All of this is added in a fixed widget - l:fill_space(true) - l:add(ibm) - l:add(tbm) - ll:add(l) - ll:add(cbm) + -- All of this is added in a fixed widget + l:fill_space(true) + l:add(ibm) + l:add(tbm) + ll:add(l) + ll:add(cbm) - if (index % 2 == 0) then - local end_color = (count == index or objects[index+1].minimized) and "#12151c" or theme.top_panel_powerline - local main_color = o.minimized and "#12151c" or theme.bg_normal - bgb:set_widget(pl(ll, main_color, end_color, true)) - else - local end_color = (count == index or objects[index+1].minimized) and "#12151c" or theme.bg_normal - local main_color = o.minimized and "#12151c" or theme.top_panel_powerline - bgb:set_widget(pl(ll, main_color, end_color, true)) - end + if (index % 2 == 0) then + local end_color = (count == index or objects[index+1].minimized) and "#12151c" or theme.top_panel_powerline + local main_color = o.minimized and "#12151c" or theme.bg_normal + bgb:set_widget(pl(ll, main_color, end_color, true)) + else + local end_color = (count == index or objects[index+1].minimized) and "#12151c" or theme.bg_normal + local main_color = o.minimized and "#12151c" or theme.top_panel_powerline + bgb:set_widget(pl(ll, main_color, end_color, true)) + end - l:buttons(create_buttons(buttons, o)) + l:buttons(create_buttons(buttons, o)) - -- Tooltip to display whole title, if it was truncated - tt = awful.tooltip({ - objects = {tb}, - mode = 'outside', - align = 'bottom', - delay_show = 1, - }) + -- Tooltip to display whole title, if it was truncated + tt = awful.tooltip({ + objects = {tb}, + mode = 'outside', + align = 'bottom', + delay_show = 1, + }) - local text, bg, bg_image, icon, args = label(o, tb) - args = args or {} + local text, bg, bg_image, icon, args = label(o, tb) + args = args or {} - -- The text might be invalid, so use pcall. - if text == nil or text == '' then - tbm:set_margins(0) - else - -- truncate when title is too long - local text_only = text:match('>(.*)<') - if (text_only:len() > 25) then - text = text:gsub('>(.*)<', '>' .. utf8.char(utf8.codepoint(text_only, 1, 25)) .. '...<') - tt:set_text(text) - tt:add_to_object(tb) - else - tt:remove_from_object(tb) - end - if not tb:set_markup_silently(text) then - tb:set_markup('<Invalid text>') - end - end - -- bgb:set_bg(bg) - if type(bg_image) == 'function' then - -- TODO: Why does this pass nil as an argument? - bg_image = bg_image(tb, o, nil, objects, i) - end - -- bgb:set_bgimage(bg_image) - if icon then - ib.image = icon - else - ibm:set_margins(0) - end + -- The text might be invalid, so use pcall. + if text == nil or text == '' then + tbm:set_margins(0) + else + -- truncate when title is too long + local text_only = text:match('>(.*)<') + if (text_only:len() > 25) then + text = text:gsub('>(.*)<', '>' .. utf8.char(utf8.codepoint(text_only, 1, 25)) .. '...<') + tt:set_text(text) + tt:add_to_object(tb) + else + tt:remove_from_object(tb) + end + if not tb:set_markup_silently(text) then + tb:set_markup('<Invalid text>') + end + end + -- bgb:set_bg(bg) + if type(bg_image) == 'function' then + -- TODO: Why does this pass nil as an argument? + bg_image = bg_image(tb, o, nil, objects, i) + end + -- bgb:set_bgimage(bg_image) + if icon then + ib.image = icon + else + ibm:set_margins(0) + end - bgb.shape = args.shape - bgb.shape_border_width = args.shape_border_width - bgb.shape_border_color = args.shape_border_color + bgb.shape = args.shape + bgb.shape_border_width = args.shape_border_width + bgb.shape_border_color = args.shape_border_color - w:add(bgb) - end + w:add(bgb) + end end @@ -152,67 +152,67 @@ end local tasklist_buttons = awful.util.table.join( - awful.button({}, 1, - function(c) - if c == client.focus then - c.minimized = true - else - -- Without this, the following - -- :isvisible() makes no sense - c.minimized = false - if not c:isvisible() and c.first_tag then - c.first_tag:view_only() - end - -- This will also un-minimize - -- the client, if needed - client.focus = c - c:raise() - end - end - ), - awful.button({}, 2, - function(c) - c.kill(c) - end - ), - awful.button({}, 4, - function() - awful.client.focus.byidx(1) - end - ), - awful.button({}, 5, - function() - awful.client.focus.byidx(-1) - end - ) + awful.button({}, 1, + function(c) + if c == client.focus then + c.minimized = true + else + -- Without this, the following + -- :isvisible() makes no sense + c.minimized = false + if not c:isvisible() and c.first_tag then + c.first_tag:view_only() + end + -- This will also un-minimize + -- the client, if needed + client.focus = c + c:raise() + end + end + ), + awful.button({}, 2, + function(c) + c.kill(c) + end + ), + awful.button({}, 4, + function() + awful.client.focus.byidx(1) + end + ), + awful.button({}, 5, + function() + awful.client.focus.byidx(-1) + end + ) ) local filter = function(c, _) - local tags = c.screen.tags - for _, t in ipairs(tags) do - if t.selected then - local ctags = c:tags() - for _, v in ipairs(ctags) do - if v == t then - return true + local tags = c.screen.tags + for _, t in ipairs(tags) do + if t.selected then + local ctags = c:tags() + for _, v in ipairs(ctags) do + if v == t then + return true + end end - end - end - end - return false + end + end + return false end task_list.create = function(s) - return awful.widget.tasklist( - s, - filter, - tasklist_buttons, - {}, - list_update, - wibox.layout.fixed.horizontal() - ) + return awful.widget.tasklist( + s, + filter, + tasklist_buttons, + {}, + list_update, + wibox.layout.fixed.horizontal() + ) end return task_list