From ac8af660058992c2b8c51f08c0cfd261ab0a9444 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Thu, 25 May 2017 04:40:45 -0400 Subject: [PATCH] beautiful: Save the theme path Fix #1508 --- lib/beautiful/init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/beautiful/init.lua b/lib/beautiful/init.lua index 78d25fec8..3a39d6621 100644 --- a/lib/beautiful/init.lua +++ b/lib/beautiful/init.lua @@ -17,6 +17,7 @@ local lgi = require("lgi") local Pango = lgi.Pango local PangoCairo = lgi.PangoCairo local gears_debug = require("gears.debug") +local Gio = require("lgi").Gio local protected_call = require("gears.protected_call") local xresources = require("beautiful.xresources") @@ -94,6 +95,9 @@ local active_font --- The Awesome icon path. -- @beautiful beautiful.awesome_icon +--- The current theme path (if any) +-- @tfield string beautiful.theme_path + --- Load a font from a string or a font description. -- -- @see https://developer.gnome.org/pango/stable/pango-Fonts.html#pango-font-description-from-string @@ -187,6 +191,8 @@ function beautiful.init(config) if type(config) == 'string' then -- 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 theme = protected_call(dofile, config) elseif type(config) == 'table' then theme = config