Merge pull request #1791 from Elv13/impl_1508
beautiful: Save the theme path
This commit is contained in:
commit
caff37d867
|
@ -17,6 +17,7 @@ local lgi = require("lgi")
|
||||||
local Pango = lgi.Pango
|
local Pango = lgi.Pango
|
||||||
local PangoCairo = lgi.PangoCairo
|
local PangoCairo = lgi.PangoCairo
|
||||||
local gears_debug = require("gears.debug")
|
local gears_debug = require("gears.debug")
|
||||||
|
local Gio = require("lgi").Gio
|
||||||
local protected_call = require("gears.protected_call")
|
local protected_call = require("gears.protected_call")
|
||||||
|
|
||||||
local xresources = require("beautiful.xresources")
|
local xresources = require("beautiful.xresources")
|
||||||
|
@ -94,6 +95,9 @@ local active_font
|
||||||
--- The Awesome icon path.
|
--- The Awesome icon path.
|
||||||
-- @beautiful beautiful.awesome_icon
|
-- @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.
|
--- 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
|
-- @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
|
if type(config) == 'string' then
|
||||||
-- Expand the '~' $HOME shortcut
|
-- Expand the '~' $HOME shortcut
|
||||||
config = config:gsub("^~/", homedir .. "/")
|
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)
|
theme = protected_call(dofile, config)
|
||||||
elseif type(config) == 'table' then
|
elseif type(config) == 'table' then
|
||||||
theme = config
|
theme = config
|
||||||
|
|
Loading…
Reference in New Issue