From 145f111fee6f652c9cda08a6721bd84b9e5fd4b3 Mon Sep 17 00:00:00 2001
From: Maxim Koltsov <maksbotan@gentoo.org>
Date: Sun, 13 May 2012 00:08:25 +0400
Subject: [PATCH] Beautiful: support for overriding theme's wallpaper_cmd

---
 awesomerc.lua.in     |    5 ++++-
 lib/beautiful.lua.in |    6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/awesomerc.lua.in b/awesomerc.lua.in
index c48aa13..b225561 100644
--- a/awesomerc.lua.in
+++ b/awesomerc.lua.in
@@ -33,8 +33,11 @@ end
 -- }}}
 
 -- {{{ Variable definitions
+-- Command to set wallpaper, if unset theme wallpaper is used
+-- wallpaper_cmd = { "awsetbg PATH_TO_YOUR_WALLPAPER.png" }
+
 -- Themes define colours, icons, and wallpapers
-beautiful.init("@AWESOME_THEMES_PATH@/default/theme.lua")
+beautiful.init("@AWESOME_THEMES_PATH@/default/theme.lua", wallpaper_cmd)
 
 -- This is used later as the default terminal and editor to run.
 terminal = "xterm"
diff --git a/lib/beautiful.lua.in b/lib/beautiful.lua.in
index 3840961..fbd6a9d 100644
--- a/lib/beautiful.lua.in
+++ b/lib/beautiful.lua.in
@@ -42,7 +42,8 @@ end
 
 --- Init function, should be runned at the beginning of configuration file.
 -- @param path The theme file path.
-function init(path)
+-- @param wallpaper_cmd Wallpaper command to be used instead of theme's one
+function init(path, wallpaper_cmd)
     if path then
         local success
         success, theme = pcall(function() return dofile(path) end)
@@ -60,6 +61,9 @@ function init(path)
             end
 
             -- setup wallpaper
+            if wallpaper_cmd then
+                theme.wallpaper_cmd = wallpaper_cmd
+            end
             if wallpaper_is_valid(theme.wallpaper_cmd) then
                 for s = 1, capi.screen.count() do
                     util.spawn(theme.wallpaper_cmd[util.cycle(#theme.wallpaper_cmd, s)], false, s)
-- 
1.7.8.6
