mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-06-01 08:07:48 +02:00
confgen: correctly fetch hostname
This commit is contained in:
parent
da8207936c
commit
450179c801
|
@ -91,7 +91,7 @@ conky.config = {
|
|||
};
|
||||
|
||||
conky.text = [[
|
||||
${alignc}${color0}${font2}<% opt.system "hostname" %>${font}
|
||||
${alignc}${color0}${font2}<% opt.read "/etc/hostname" %>${font}
|
||||
${voffset 6}${alignc}${color0}${font3}${time %b %d, %Y}${font}${color}
|
||||
${voffset 18}${goto 12}${color5}CPU${goto 50}
|
||||
${goto 12}$cpu%
|
||||
|
|
18
confgen.lua
18
confgen.lua
|
@ -23,22 +23,32 @@ end
|
|||
|
||||
cg.opt = merge(cg.opt, require "cg_opts")
|
||||
|
||||
local local_opts = loadfile(os.getenv "HOME" .. "/.config/mzte_localconf/opts.lua")
|
||||
|
||||
if local_opts then
|
||||
cg.opt = merge(cg.opt, local_opts())
|
||||
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
|
||||
if not file then
|
||||
return ""
|
||||
end
|
||||
|
||||
return file:read "*a"
|
||||
end
|
||||
|
||||
local local_opts = loadfile(os.getenv "HOME" .. "/.config/mzte_localconf/opts.lua")
|
||||
-- Returns the contents of a file
|
||||
cg.opt.read = function(fname)
|
||||
local file = io.open(fname, "r")
|
||||
if not file then
|
||||
return nil
|
||||
end
|
||||
|
||||
if local_opts then
|
||||
cg.opt = merge(cg.opt, local_opts())
|
||||
return file:read "*a"
|
||||
end
|
||||
|
||||
-- Get the output of a system command
|
||||
|
|
Loading…
Reference in a new issue