How to separate Awesome’s `rc.lua` configuration into multiple files

awesomeconfigurationfilesluawindow-manager

I've just moved to Awesome WM from OpenBox. I like that it's very extensible, customizable and I have huge control about window layout. I like structured and organized things and I'd like to separate that huge .config/awesome/rc.lua configuration into multiple files.

Best Answer

You can simply place code in a separate file and include it with

dofile("somefile.lua")

Note: The working directory is $HOME. To specify a file relative to rc.lua you can use

dofile(awful.util.getdir("config") .. "/" .. "somefile.lua")

If it's more than just some code and it might be used by others as well, it might make sense to create a lua module which can be included with

somemodule = require("somemodule")
Related Question