1 ----------------------------------------------------------------------------
2 -- @author Damien Leone <damien.leone@gmail.com>
3 -- @author Julien Danjou <julien@danjou.info>
4 -- @copyright 2008-2009 Damien Leone, Julien Danjou
5 -- @release @AWESOME_VERSION@
6 ----------------------------------------------------------------------------
16 local setmetatable
= setmetatable
17 local util
= require("awful.util")
18 local package
= package
32 --- Init function, should be runned at the beginning of configuration file.
33 -- @param path The theme file path.
37 success
, theme
= pcall(function() return dofile(path
) end)
40 return print("E: beautiful: error loading theme file " .. theme
)
42 -- try and grab user's $HOME directory
43 local homedir
= os
.getenv("HOME")
46 for k
, v
in pairs(theme
) do
47 if type(v
) == "string" then theme
[k
] = v
:gsub("~", homedir
) end
52 if theme
.wallpaper_cmd
then
53 for s
= 1, capi
.screen
.count() do
54 util
.spawn(theme
.wallpaper_cmd
[util
.cycle(#theme
.wallpaper_cmd
, s
)], false, s
)
57 if theme
.font
then capi
.awesome
.font
= theme
.font
end
58 if theme
.fg_normal
then capi
.awesome
.fg
= theme
.fg_normal
end
59 if theme
.bg_normal
then capi
.awesome
.bg
= theme
.bg_normal
end
61 return print("E: beautiful: error loading theme file " .. path
)
64 return print("E: beautiful: error loading theme: no path specified")
68 --- Get the current theme.
69 -- @return The current theme table.
74 setmetatable(_M
, { __index
= function(t
, k
) return theme
[k
] end })
76 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80