From 03645feec062c0475e170794b967098a28cf1e9b Mon Sep 17 00:00:00 2001 From: Damien Leone Date: Thu, 7 Aug 2008 08:18:58 +0200 Subject: [PATCH] beautiful: allow extra spaces in theme file Signed-off-by: Julien Danjou --- lib/beautiful.lua | 9 +++++++-- themes/default | 37 +++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/lib/beautiful.lua b/lib/beautiful.lua index 6b50d7cd..03af00c9 100644 --- a/lib/beautiful.lua +++ b/lib/beautiful.lua @@ -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 diff --git a/themes/default b/themes/default index b393e6c7..ee78ecff 100644 --- a/themes/default +++ b/themes/default @@ -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