From: Don Armstrong Date: Wed, 30 Jul 2014 00:24:56 +0000 (-0700) Subject: ignore volume_alsa for the time being; fix the wallpaper signal X-Git-Url: https://git.donarmstrong.com/?p=x_base.git;a=commitdiff_plain;h=c6744b5188d7112d7dad888be8b9da056ca08953 ignore volume_alsa for the time being; fix the wallpaper signal --- diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index a3b3b94..98cfff2 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -7,26 +7,16 @@ require("beautiful") -- Notification library require("naughty") -require("obvious.volume_alsa") +-- require("obvious.volume_alsa") require("obvious.battery") -- Load Debian menu entries require("debian.menu") -- from https://github.com/tony/awesome-config/blob/master/helpers.lua -function clean(string) - s = string.gsub(string, '^%s+', '') - s = string.gsub(s, '%s+$', '') - s = string.gsub(s, '[\n\r]+', ' ') - return s -end function file_exists(file) - local cmd = "/bin/dash -c 'if [ -e " .. file .. " ]; then echo true; fi;'" - local fh = io.popen(cmd) - - s = clean(fh:read('*a')) - + s = awful.util.pread("/bin/dash -c 'if [ -e " .. file .. " ]; then echo true; fi;'"):gsub("\n","") if s == 'true' then return true else return nil end end @@ -42,34 +32,6 @@ home = os.getenv("HOME") hostname = awful.util.pread("hostname -f"):gsub("\n", "") -wallpaper_dir = home .. "/media/photos/gallery.donarmstrong.com/" -if (not file_exists(wallpaper_dir)) then - wallpaper_dir = "/usr/share/awesome/themes/default/background.png" -end - -wallpaper_cmd = "find " .. wallpaper_dir .. - " -xtype f \\( -iname '*.jpg' -o -iname '*.png' \\) " .. - " -not -name '.*' -print0 | shuf -n" .. screen.count() .. " -z | xargs -0 feh --bg-max" - --- set up the wallpaper timer -wallpaper_timer = timer { timeout = 0 } -wallpaper_timer:add_signal("timeout", - function() - -- tell awsetbg to randomly choose a wallpaper from your wallpaper directory - if file_exists(wallpaper_dir) and whereis_app('feh') then - os.execute(wallpaper_cmd) - end - -- stop the timer (we don't need multiple instances running at the same time) - mytimer:stop() - - -- define the interval in which the next wallpaper change should occur in seconds - -- (in this case anytime between 10 and 20 minutes) - --restart the timer - mytimer.timeout = math.random(600,1200) - mytimer:start() - end -) - -- Default modkey. -- Usually, Mod4 is the key with a logo between Control and Alt. -- If you do not like this or do not have such a key, @@ -129,7 +91,7 @@ mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), -- Create a textclock widget mytextclock = awful.widget.textclock({ align = "right" }, " %c ", 1) -myvolumealsa = obvious.volume_alsa() +-- myvolumealsa = obvious.volume_alsa() mybattery = obvious.battery() -- Create a systray @@ -205,7 +167,7 @@ for s = 1, screen.count() do }, mylayoutbox[s], mytextclock, - myvolumealsa, +-- myvolumealsa, mybattery, s == 1 and mysystray or nil, mytasklist[s], @@ -425,3 +387,31 @@ end client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end) client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) -- }}} + + +wallpaper_dir = home .. "/media/photos/gallery.donarmstrong.com/" +if (not file_exists(wallpaper_dir)) then + wallpaper_dir = "/usr/share/awesome/themes/default/background.png" +end + +wallpaper_cmd = "find " .. wallpaper_dir .. + " -xtype f \\( -iname '*.jpg' -o -iname '*.png' \\) " .. + " -not -name '.*' -print0 | shuf -n" .. screen.count() .. " -z | xargs -0 feh --bg-max" + +-- set up the wallpaper timer +wallpaper_timer = timer({ timeout = 0 }) +wallpaper_timer:add_signal("timeout", + function() + -- tell awsetbg to randomly choose a wallpaper from your wallpaper directory + os.execute(wallpaper_cmd) + -- stop the timer (we don't need multiple instances running at the same time) + wallpaper_timer:stop() + + -- define the interval in which the next wallpaper change should occur in seconds + -- (in this case anytime between 10 and 20 minutes) + --restart the timer + wallpaper_timer.timeout = math.random(600,1200) + wallpaper_timer:start() + end +) +wallpaper_timer:start();