dotfiles/awesome/rc.lua

72 lines
2.0 KiB
Lua
Raw Normal View History

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-06-05 16:56:01 +02:00
local beautiful = require("beautiful")
2022-07-19 15:24:06 +02:00
2023-06-05 16:40:17 +02:00
-- Local imports
local grid = require("components.layout.grid")
2022-07-19 15:24:06 +02:00
2023-06-05 16:56:01 +02:00
-- Import theme
beautiful.init(gears.filesystem.get_configuration_dir() .. "theme.lua")
2023-06-05 16:40:17 +02:00
-- Load components
require("components.notifications")
require("components.screen")
require("utils.signals")
-- Autofocus a new client when previously focused one is closed
require("awful.autofocus")
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 = {
2023-09-06 16:28:37 +02:00
"numlockx on",
"nm-applet",
"xcape -e \"Super_L=Super_L|XF86Launch5\" -t 5000",
gears.filesystem.get_configuration_dir() .. "/scripts/setup_display.sh",
2023-07-19 13:38:50 +02:00
"feh --no-fehbg --bg-fill " .. gears.filesystem.get_configuration_dir() .. "/images/wallpaper.png",
2022-07-19 19:45:11 +02:00
}
2022-07-19 15:24:06 +02:00
2023-05-25 21:25:49 +02:00
-- Define layouts
awful.layout.layouts = {
2023-09-06 16:28:37 +02:00
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,
grid,
2023-05-25 21:25:49 +02:00
}
2022-07-19 19:45:11 +02:00
-- 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
2023-06-05 16:40:17 +02:00
-- Run commands only if it's not already running.
2022-07-23 19:31:38 +02:00
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
-- Start timers
gears.timer {
timeout = 60,
call_now = true,
autostart = true,
callback = function()
awful.spawn.with_shell({"xmodmap", "/home/user/.Xmodmap"}) -- If not repeated it sometimes just stops working
end
}
2022-07-19 19:45:11 +02:00
-- 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)