2022-07-19 19:45:11 +02:00
|
|
|
-- █████╗ ██╗ ██╗███████╗███████╗ ██████╗ ███╗ ███╗███████╗
|
|
|
|
-- ██╔══██╗██║ ██║██╔════╝██╔════╝██╔═══██╗████╗ ████║██╔════╝
|
|
|
|
-- ███████║██║ █╗ ██║█████╗ ███████╗██║ ██║██╔████╔██║█████╗
|
|
|
|
-- ██╔══██║██║███╗██║██╔══╝ ╚════██║██║ ██║██║╚██╔╝██║██╔══╝
|
|
|
|
-- ██║ ██║╚███╔███╔╝███████╗███████║╚██████╔╝██║ ╚═╝ ██║███████╗
|
|
|
|
-- ╚═╝ ╚═╝ ╚══╝╚══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
|
2022-07-19 15:24:06 +02:00
|
|
|
|
2022-07-19 19:45:11 +02:00
|
|
|
|
|
|
|
-- Standard awesome libraries
|
2022-07-19 15:24:06 +02:00
|
|
|
local gears = require("gears")
|
|
|
|
local awful = require("awful")
|
2023-05-25 21:25:49 +02:00
|
|
|
local grid = require("layout.grid")
|
2022-07-19 15:24:06 +02:00
|
|
|
|
|
|
|
|
2022-07-19 19:45:11 +02:00
|
|
|
-- ===================================================================
|
|
|
|
-- User Configuration
|
|
|
|
-- ===================================================================
|
2022-07-19 15:24:06 +02:00
|
|
|
|
|
|
|
|
2022-07-19 19:45:11 +02:00
|
|
|
-- define default apps (global variable so other components can access it)
|
|
|
|
apps = {
|
2022-08-06 21:02:49 +02:00
|
|
|
terminal = 'bash -c "WINIT_X11_SCALE_FACTOR=1 alacritty"',
|
2023-01-27 17:47:47 +01:00
|
|
|
launcher = "/home/user/.toggle_rofi.sh",
|
2022-07-23 19:31:38 +02:00
|
|
|
screenshot = "scrot -e 'mv $f ~/Pictures/Screenshots/ 2>/dev/null'",
|
2022-07-19 15:24:06 +02:00
|
|
|
}
|
2022-07-19 19:45:11 +02:00
|
|
|
|
|
|
|
-- List of apps to run on start-up
|
|
|
|
local run_on_start_up = {
|
2022-07-23 19:31:38 +02:00
|
|
|
"numlockx on",
|
|
|
|
"nm-applet",
|
2022-07-29 20:48:32 +02:00
|
|
|
"xcape -e \"Super_L=Super_L|XF86Launch5\" -t 5000",
|
2022-11-09 23:39:00 +01:00
|
|
|
"xmodmap /home/user/.Xmodmap",
|
|
|
|
os.getenv("XDG_CONFIG_HOME") .. "/awesome/scripts/setup_display.sh"
|
2022-07-19 19:45:11 +02:00
|
|
|
}
|
2022-07-19 15:24:06 +02:00
|
|
|
|
2022-07-19 19:45:11 +02:00
|
|
|
-- ===================================================================
|
|
|
|
-- Initialization
|
|
|
|
-- ===================================================================
|
|
|
|
|
2023-05-25 21:25:49 +02:00
|
|
|
-- Define layouts
|
|
|
|
awful.layout.layouts = {
|
|
|
|
grid,
|
|
|
|
awful.layout.suit.tile,
|
|
|
|
awful.layout.suit.floating,
|
|
|
|
grid.horizontal,
|
|
|
|
awful.layout.suit.fair.horizontal,
|
|
|
|
awful.layout.suit.tile.left,
|
|
|
|
awful.layout.suit.tile.bottom,
|
|
|
|
awful.layout.suit.tile.top,
|
|
|
|
}
|
|
|
|
|
2022-07-19 19:45:11 +02:00
|
|
|
|
|
|
|
-- Import notification appearance
|
|
|
|
require("components.notifications")
|
|
|
|
|
|
|
|
-- Run all the apps listed in run_on_start_up
|
|
|
|
for _, app in ipairs(run_on_start_up) do
|
2022-07-23 19:31:38 +02:00
|
|
|
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)
|
2022-07-19 15:24:06 +02:00
|
|
|
end
|
|
|
|
|
2022-07-19 19:45:11 +02:00
|
|
|
-- Import theme
|
|
|
|
local beautiful = require("beautiful")
|
|
|
|
beautiful.init(gears.filesystem.get_configuration_dir() .. "theme.lua")
|
|
|
|
|
|
|
|
-- Initialize theme
|
|
|
|
local selected_theme = require("pastel")
|
|
|
|
selected_theme.initialize()
|
|
|
|
|
|
|
|
-- Import Keybinds
|
|
|
|
local keys = require("keys")
|
|
|
|
root.keys(keys.globalkeys)
|
|
|
|
root.buttons(keys.desktopbuttons)
|
|
|
|
|
|
|
|
-- Import rules
|
|
|
|
local create_rules = require("rules").create
|
|
|
|
awful.rules.rules = create_rules(keys.clientkeys, keys.clientbuttons)
|
|
|
|
|
2023-05-21 00:35:23 +02:00
|
|
|
-- ===================================================================
|
|
|
|
-- Client Focusing
|
|
|
|
-- ===================================================================
|
|
|
|
|
|
|
|
|
|
|
|
-- Autofocus a new client when previously focused one is closed
|
|
|
|
require("awful.autofocus")
|
|
|
|
|
|
|
|
-- Focus clients under mouse
|
|
|
|
client.connect_signal("mouse::enter", function(c)
|
|
|
|
c:emit_signal("request::activate", "mouse_enter", {raise = false})
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
2022-07-19 15:24:06 +02:00
|
|
|
-- Signal function to execute when a new client appears.
|
|
|
|
client.connect_signal("manage", function (c)
|
2022-07-23 19:31:38 +02:00
|
|
|
-- 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
|
2022-07-19 15:24:06 +02:00
|
|
|
|
2023-05-21 00:35:23 +02:00
|
|
|
gears.timer.delayed_call(function()
|
|
|
|
local geometry = c:geometry()
|
|
|
|
local x = geometry.x + geometry.width/2
|
|
|
|
local y = geometry.y + geometry.height/2
|
|
|
|
mouse.coords({x = x, y = y}, true)
|
|
|
|
end)
|
2022-07-19 15:24:06 +02:00
|
|
|
end)
|
|
|
|
|
2022-07-19 19:45:11 +02:00
|
|
|
-- ===================================================================
|
|
|
|
-- Screen Change Functions (ie multi monitor)
|
|
|
|
-- ===================================================================
|
|
|
|
|
|
|
|
|
|
|
|
-- Reload config when screen geometry changes
|
|
|
|
screen.connect_signal("property::geometry", awesome.restart)
|
|
|
|
|
|
|
|
|
|
|
|
-- ===================================================================
|
|
|
|
-- Garbage collection (allows for lower memory consumption)
|
|
|
|
-- ===================================================================
|
|
|
|
|
|
|
|
|
|
|
|
collectgarbage("setpause", 110)
|
|
|
|
collectgarbage("setstepmul", 1000)
|
|
|
|
|
|
|
|
require("awesomewm-vim-tmux-navigator") {
|
2022-07-23 19:31:38 +02:00
|
|
|
up = {"Up", "k"},
|
|
|
|
down = {"Down", "j"},
|
|
|
|
left = {"Left", "h"},
|
|
|
|
right = {"Right", "l"},
|
|
|
|
mod = "Mod4",
|
|
|
|
mod_keysym = "Super_L",
|
2022-07-27 01:43:14 +02:00
|
|
|
experimental = true
|
2022-07-19 19:45:11 +02:00
|
|
|
}
|
|
|
|
|
2023-05-21 00:35:23 +02:00
|
|
|
local function move_mouse_onto_focused_client()
|
|
|
|
local c = client.focus
|
|
|
|
if c then
|
|
|
|
local geometry = c:geometry()
|
|
|
|
local x = geometry.x + geometry.width/2
|
|
|
|
local y = geometry.y + geometry.height/2
|
|
|
|
mouse.coords({x = x, y = y}, true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2022-07-31 13:04:34 +02:00
|
|
|
client.connect_signal("property::maximized", function(focused)
|
2022-07-23 19:31:38 +02:00
|
|
|
local hide = focused.maximized or focused.fullscreen
|
|
|
|
for i, c in ipairs(client.get()) do
|
2022-11-09 23:39:00 +01:00
|
|
|
if not c.floating and c.screen == focused.screen and c.first_tag == focused.first_tag then
|
|
|
|
c.minimized = hide
|
|
|
|
end
|
2022-07-23 19:31:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
focused.minimized = false
|
2022-07-31 13:04:34 +02:00
|
|
|
end)
|
|
|
|
|
2022-08-31 11:01:09 +02:00
|
|
|
client.connect_signal("unmanage", function(unmanaged)
|
|
|
|
if unmanaged.maximized then
|
|
|
|
for i, c in ipairs(client.get()) do
|
|
|
|
if not c.floating and c.screen == unmanaged.screen then
|
|
|
|
c.minimized = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
2022-07-31 13:04:34 +02:00
|
|
|
client.connect_signal("focus", function(c)
|
2023-05-26 10:40:48 +02:00
|
|
|
if #c.screen.clients > 1 then
|
|
|
|
c.border_color = beautiful.border_focus
|
|
|
|
end
|
|
|
|
move_mouse_onto_focused_client()
|
2022-07-31 13:04:34 +02:00
|
|
|
end)
|
|
|
|
|
|
|
|
client.connect_signal("unfocus", function(c)
|
|
|
|
c.border_color = beautiful.border_normal
|
|
|
|
end)
|