2022-07-16 17:41:00 -07:00
|
|
|
-- AwesomeWM modules
|
2021-08-01 07:24:26 -07:00
|
|
|
gears = require("gears")
|
|
|
|
awful = require("awful")
|
|
|
|
naughty = require("naughty")
|
|
|
|
beautiful = require("beautiful")
|
|
|
|
menubar = require("menubar")
|
|
|
|
wibox = require("wibox")
|
|
|
|
require("awful.autofocus")
|
2022-07-16 17:41:00 -07:00
|
|
|
conf_dir = gears.filesystem.get_configuration_dir()
|
2021-08-01 07:24:26 -07:00
|
|
|
|
|
|
|
|
2022-07-16 17:41:00 -07:00
|
|
|
-- A "relative require" hack. Does the same thing as `require`,
|
2022-07-16 14:13:03 -07:00
|
|
|
-- But takes a relative path.
|
|
|
|
-- Called with req_rel(..., "module")
|
|
|
|
function req_rel(ddd, modname)
|
|
|
|
local parent_folder = (ddd):match("(.-)[^%.]+$")
|
|
|
|
return require(parent_folder .. modname)
|
|
|
|
end
|
2021-08-01 07:24:26 -07:00
|
|
|
|
|
|
|
-- Quick debug function
|
|
|
|
debug_message = function(msg)
|
|
|
|
naughty.notify({title = "Debug message:", text = tostring(msg)})
|
|
|
|
end
|
|
|
|
|
2022-07-16 17:41:00 -07:00
|
|
|
-- Order matters.
|
2022-07-16 19:06:55 -07:00
|
|
|
config = require("config")
|
2021-08-01 07:24:26 -07:00
|
|
|
beautiful.init(require("theme"))
|
2022-07-16 17:10:17 -07:00
|
|
|
|
2022-07-16 17:41:00 -07:00
|
|
|
|
2022-07-16 14:13:03 -07:00
|
|
|
-- Load key bindings
|
2022-07-17 21:18:00 -07:00
|
|
|
local keys = require("core.keybinds")
|
|
|
|
local buttons = {}
|
2022-07-16 14:13:03 -07:00
|
|
|
|
2022-07-16 19:06:55 -07:00
|
|
|
|
2022-07-16 14:13:03 -07:00
|
|
|
-- Load modules
|
2022-07-16 19:06:55 -07:00
|
|
|
-- Every config table key (except "core") represents a module we should load.
|
2022-07-16 14:13:03 -07:00
|
|
|
modules = {}
|
2022-07-16 19:06:55 -07:00
|
|
|
for k, v in pairs(config) do
|
|
|
|
if (k == "core") then
|
|
|
|
goto skip_module
|
|
|
|
elseif (config[k].enabled == false) then
|
|
|
|
goto skip_module
|
|
|
|
elseif (config[k].enabled == nil) then
|
|
|
|
debug_message("Module " .. k .. " is not explicitly enabled")
|
|
|
|
goto skip_module
|
|
|
|
end
|
|
|
|
|
|
|
|
modules[k] = require("modules." .. k)
|
2022-07-16 14:13:03 -07:00
|
|
|
|
|
|
|
-- If module defines keybinds, load keybinds.
|
2022-07-16 19:06:55 -07:00
|
|
|
if (modules[k]["keybinds"] ~= nil) then
|
2022-07-16 14:13:03 -07:00
|
|
|
keys = gears.table.join(
|
|
|
|
keys,
|
2022-07-16 19:06:55 -07:00
|
|
|
modules[k]["keybinds"]
|
2022-07-16 14:13:03 -07:00
|
|
|
)
|
|
|
|
end
|
2022-07-16 19:06:55 -07:00
|
|
|
|
|
|
|
::skip_module::
|
2022-07-16 14:13:03 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Run all module init methods
|
|
|
|
for _, mod in ipairs(modules) do
|
|
|
|
if (mod["init"] ~= nil) then
|
|
|
|
mod["init"]()
|
|
|
|
end
|
|
|
|
end
|
2022-07-16 19:06:55 -07:00
|
|
|
core = require("core")
|
2022-07-16 14:13:03 -07:00
|
|
|
|
|
|
|
|
2022-07-16 17:41:00 -07:00
|
|
|
-- Finalize keybinds
|
2022-07-16 14:13:03 -07:00
|
|
|
root.keys(keys)
|
|
|
|
root.buttons(buttons)
|
|
|
|
|
2021-08-01 07:24:26 -07:00
|
|
|
|
2022-07-16 14:13:03 -07:00
|
|
|
|
2022-06-14 07:52:02 -07:00
|
|
|
-- Autostart
|
2022-07-16 19:06:55 -07:00
|
|
|
for i, v in ipairs(config.core.startup_commands) do
|
2022-06-14 07:52:02 -07:00
|
|
|
awful.spawn(v)
|
|
|
|
end
|
2021-08-01 07:24:26 -07:00
|
|
|
|
|
|
|
|
|
|
|
-- Enable hotkeys help widget for VIM and other apps
|
|
|
|
-- when client with a matching name is opened:
|
|
|
|
--require("awful.hotkeys_popup.keys")
|
|
|
|
|
2022-07-16 17:10:17 -07:00
|
|
|
core.start()
|
2021-08-01 07:24:26 -07:00
|
|
|
|
|
|
|
-- Check for errors
|
2022-07-16 17:41:00 -07:00
|
|
|
dofile(conf_dir .. "errors.lua")
|
2021-08-01 07:24:26 -07:00
|
|
|
|
2022-07-16 19:06:55 -07:00
|
|
|
menubar.utils.terminal = config.core.terminal
|
2021-08-01 07:24:26 -07:00
|
|
|
|
|
|
|
-- Load client methods
|
|
|
|
awful.rules.rules = require("clients.rules")
|
2022-07-16 17:41:00 -07:00
|
|
|
dofile(conf_dir .. "clients/signals.lua")
|
2021-08-01 07:24:26 -07:00
|
|
|
require("clients.render")
|