Files
dotfiles/hammerspoon/host_config.lua
Jim Myhrberg fd94bd2774 chore(hammerspoon): minor refactor to host_config setup
Allows it to require any file off of disk by using loadfile instead of
require.
2023-04-23 16:27:31 +01:00

20 lines
407 B
Lua

local function require_file(path)
local ok, module = pcall(loadfile, path)
return (ok and module and module() or nil)
end
local obj = {}
function obj:init()
local hostname = hs.host.localizedName()
local conf_file = 'hosts/' .. hostname .. '.lua'
local hostmod = require_file(conf_file)
if hostmod then
print('loading host config: ' .. conf_file)
hostmod.init()
end
end
return obj