Skip to content

Instantly share code, notes, and snippets.

@jerinphilip
Created September 5, 2015 15:50
Show Gist options
  • Save jerinphilip/f55ecca428b6d007c2cf to your computer and use it in GitHub Desktop.
Save jerinphilip/f55ecca428b6d007c2cf to your computer and use it in GitHub Desktop.
Wallpaper cycling.
diff --git a/awesome/rc.lua b/awesome/rc.lua
index 7587d6b..7d2d3a2 100644
--- a/awesome/rc.lua
+++ b/awesome/rc.lua
@@ -560,3 +560,32 @@ end
battery_timer = timer({timeout=100})
battery_timer:connect_signal("timeout", function() check_battery() end)
battery_timer:start()
+
+
+-- Wallpaper Cycling
+function wallpaper_cycle()
+ wp_index = 1
+ wp_timeout = 10
+ wp_path = "/home/jerin/Downloads/GOT/"
+ wp_files = {}
+ for img in string.gmatch(awful.util.pread("ls -1 "..wp_path), "([^\n]+)\n") do
+ table.insert(wp_files, img)
+ naughty.notify({title="Output", text=img})
+ end
+ naughty.notify({title="Output", text=awful.util.pread("ls -1 "..wp_path)})
+
+ wp_timer = timer { timeout = wp_timeout }
+ wp_timer:connect_signal("timeout", function ()
+ gears.wallpaper.maximized( wp_path..wp_files[wp_index], s, true)
+ wp_timer:stop()
+ wp_index = ( wp_index + 1 ) % (#wp_files)
+
+ wp_timer.timeout = wp_timeout
+ wp_timer:start()
+ end)
+
+ wp_timer:start()
+
+end
+
+wallpaper_cycle()
diff --git a/awesome/rc.lua b/awesome/rc.lua
index 7587d6b..7d2d3a2 100644
--- a/awesome/rc.lua
+++ b/awesome/rc.lua
@@ -560,3 +560,32 @@ end
battery_timer = timer({timeout=100})
battery_timer:connect_signal("timeout", function() check_battery() end)
battery_timer:start()
+
+
+-- Wallpaper Cycling
+function wallpaper_cycle()
+ wp_index = 1
+ wp_timeout = 10
+ wp_path = "/home/jerin/Downloads/GOT/"
+ wp_files = {}
+ for img in string.gmatch(awful.util.pread("ls -1 "..wp_path), "([^\n]+)\n") do
+ table.insert(wp_files, img)
+ naughty.notify({title="Output", text=img})
+ end
+ naughty.notify({title="Output", text=awful.util.pread("ls -1 "..wp_path)})
+
+ wp_timer = timer { timeout = wp_timeout }
+ wp_timer:connect_signal("timeout", function ()
+ gears.wallpaper.maximized( wp_path..wp_files[wp_index], s, true)
+ wp_timer:stop()
+ wp_index = ( wp_index + 1 ) % (#wp_files)
+
+ wp_timer.timeout = wp_timeout
+ wp_timer:start()
+ end)
+
+ wp_timer:start()
+
+end
+
+wallpaper_cycle()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment