Make beautiful.theme_path actually work

Commit ac8af66005 added beautiful.theme_path, which is used to save the
directory that contains the theme file that was loaded. Just two months
later, commit ca12473584 broke this code by adding a __newindex
metamethod. This caused the assignment to beautiful.theme_path to be
redirected to the theme. However, the theme is immediately replaced by
beautiful.init() after setting up the theme_path, so this assignment got
lost.

Fix this by using rawset() to bypass the metamethod.

Fixes: https://github.com/awesomeWM/awesome/issues/2573
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2019-01-14 09:16:13 +01:00
parent 708e522d56
commit 69a0de3f03
1 changed files with 1 additions and 1 deletions

View File

@ -194,7 +194,7 @@ function beautiful.init(config)
-- Expand the '~' $HOME shortcut
config = config:gsub("^~/", homedir .. "/")
local dir = Gio.File.new_for_path(config):get_parent()
beautiful.theme_path = dir and (dir:get_path().."/") or nil
rawset(beautiful, "theme_path", dir and (dir:get_path().."/") or nil)
theme = protected_call(dofile, config)
elseif type(config) == 'table' then
theme = config