Random wallpaper
This commit is contained in:
parent
60d3bc36ae
commit
63f517dbfb
|
@ -1,3 +1,6 @@
|
||||||
|
local os = require('os')
|
||||||
|
local math = require('math')
|
||||||
|
|
||||||
-- Standard awesome library
|
-- Standard awesome library
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
|
@ -18,6 +21,26 @@ home = os.getenv('HOME')
|
||||||
os.execute('xset m 16/1 0')
|
os.execute('xset m 16/1 0')
|
||||||
os.setlocale("fr_FR.UTF-8")
|
os.setlocale("fr_FR.UTF-8")
|
||||||
|
|
||||||
|
local wallpaper_root = home .. "/Pictures/current-wallpapers/"
|
||||||
|
local max_wallpaper_index = 192
|
||||||
|
math.randomseed(os.time())
|
||||||
|
|
||||||
|
current_wallpaper_index = math.floor(1 + math.random() * (max_wallpaper_index))
|
||||||
|
|
||||||
|
function update_wallpaper()
|
||||||
|
for s = 1, screen.count() do
|
||||||
|
current_wallpaper_index = current_wallpaper_index + 1
|
||||||
|
if current_wallpaper_index > max_wallpaper_index then
|
||||||
|
current_wallpaper_index = 1
|
||||||
|
end
|
||||||
|
local wallpaper = wallpaper_root .. string.format("%04d", current_wallpaper_index) .. '.jpg'
|
||||||
|
gears.wallpaper.maximized(wallpaper, s, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local wallpaper_timer = timer({timeout=600})
|
||||||
|
wallpaper_timer:connect_signal("timeout", update_wallpaper)
|
||||||
|
|
||||||
-- Run xsession if exists
|
-- Run xsession if exists
|
||||||
function file_exists(name)
|
function file_exists(name)
|
||||||
local f=io.open(name,"r")
|
local f=io.open(name,"r")
|
||||||
|
@ -699,4 +722,8 @@ end)
|
||||||
|
|
||||||
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
||||||
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
||||||
|
|
||||||
|
wallpaper_timer:start()
|
||||||
|
update_wallpaper()
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
Loading…
Reference in New Issue