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 ----------------------------------------------------------------------------
15 local setmetatable
= setmetatable
16 local util
= require("awful.util")
29 --- Init function, should be runned at the beginning of configuration file.
30 -- @param path The theme file path.
34 success
, theme
= pcall(function() return dofile(path
) end)
37 return print("E: beautiful: error loading theme file " .. theme
)
39 -- try and grab user's $HOME directory
40 local homedir
= os
.getenv("HOME")
43 for k
, v
in pairs(theme
) do
44 if type(v
) == "string" then theme
[k
] = v
:gsub("~", homedir
) end
49 if theme
.wallpaper_cmd
then
50 for s
= 1, capi
.screen
.count() do
51 util
.spawn(theme
.wallpaper_cmd
[util
.cycle(#theme
.wallpaper_cmd
, s
)], false, s
)
54 if theme
.font
then capi
.awesome
.font
= theme
.font
end
55 if theme
.fg_normal
then capi
.awesome
.fg
= theme
.fg_normal
end
56 if theme
.bg_normal
then capi
.awesome
.bg
= theme
.bg_normal
end
58 return print("E: beautiful: error loading theme file " .. path
)
61 return print("E: beautiful: error loading theme: no path specified")
65 --- Get the current theme.
66 -- @return The current theme table.
71 setmetatable(_M
, { __index
= function(t
, k
) return theme
[k
] end })
73 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80