beautiful: allow extra spaces in theme file

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Damien Leone 2008-08-07 08:18:58 +02:00 committed by Julien Danjou
parent cbfc510fbf
commit 03645feec0
2 changed files with 26 additions and 20 deletions

View File

@ -23,12 +23,17 @@ local theme = {}
--- Split line in two if it contains the '=' character.
-- @param line The line to split.
-- @return nil if the '=' character is not in the string
-- if the string begins with '#' which is a comment
local function split_line(line)
local split_val = line:find('=')
if split_val and line:sub(1, 1) ~= '#' and line:sub(1, 2) ~= '--' then
return line:sub(1, split_val - 1), line:sub(split_val + 1, -1)
-- Remove spaces in key and extra spaces before value
local value = line:sub(split_val + 1, -1)
while value:sub(1, 1) == ' ' do
value = value:sub(2, -1)
end
return line:sub(1, split_val - 1):gsub(' ', ''), value
end
end

View File

@ -2,25 +2,26 @@
-- Default awesome theme --
---------------------------
# Lines beginning with '#' are comments.
# You do not need to add quotes.
font=sans 8
font = sans 8
bg_normal=#222222
bg_focus=#535d6c
bg_urgent=#ff0000
bg_normal = #222222
bg_focus = #535d6c
bg_urgent = #ff0000
fg_normal=#aaaaaa
fg_focus=#ffffff
fg_urgent=#ffffff
fg_normal = #aaaaaa
fg_focus = #ffffff
fg_urgent = #ffffff
border_width=1
border_normal=#000000
border_focus=#535d6c
border_marked=#91231C
border_width = 1
border_normal = #000000
border_focus = #535d6c
border_marked = #91231c
# You can't change that variable name, because beautiful
# will check if 'wallpaper_cmd' is defined before setting
# the wallpaper.
# Don't forget to set your own command here
wallpaper_cmd=xsetroot -solid darkgrey
# You can use your own command to
# set your wallpaper
wallpaper_cmd = xsetroot -solid darkgrey
# You can add as many variables as
# you wish and access them by using
# beautiful.variable in your rc.lua
#bg_widget = #cc0000