add local conf feature to confgen.lua

This commit is contained in:
LordMZTE 2023-01-21 00:01:23 +01:00
parent 878fa57567
commit eb7513b2f6
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
4 changed files with 13 additions and 2 deletions

View file

@ -1 +0,0 @@
bookmarks

View file

@ -278,3 +278,4 @@ bar {
}
}
<% opt.getDeviceConf("i3") %>

View file

@ -1 +0,0 @@
*.lock

View file

@ -6,3 +6,15 @@ cg.addPath ".cargo"
for k, v in pairs(require "cg_opts") do
cg.opt[k] = v
end
-- This function is called in templates to allow adding device-specific configs.
cg.opt.getDeviceConf = function(id)
local path = os.getenv "HOME" .. "/.config/mzte_localconf/" .. id
local file = io.open(path, "r")
if file == nil then
return ""
end
return file:read "*a"
end