mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
Merge remote-tracking branch 'blueyed/expand-tilde-path-in-beautiful-init'
This commit is contained in:
commit
ca434a7e3a
1 changed files with 6 additions and 3 deletions
|
@ -76,17 +76,20 @@ end
|
|||
function beautiful.init(path)
|
||||
if path then
|
||||
local success
|
||||
|
||||
-- try and grab user's $HOME directory and expand '~'
|
||||
local homedir = os.getenv("HOME")
|
||||
path = path:gsub("^~/", homedir .. "/")
|
||||
|
||||
success, theme = pcall(function() return dofile(path) end)
|
||||
|
||||
if not success then
|
||||
return print("E: beautiful: error loading theme file " .. theme)
|
||||
elseif theme then
|
||||
-- try and grab user's $HOME directory
|
||||
local homedir = os.getenv("HOME")
|
||||
-- expand '~'
|
||||
if homedir then
|
||||
for k, v in pairs(theme) do
|
||||
if type(v) == "string" then theme[k] = v:gsub("~", homedir) end
|
||||
if type(v) == "string" then theme[k] = v:gsub("^~/", homedir .. "/") end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue