mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-24 18:58:33 +02:00
wallpaper: replace lua timer by a systemd timer
This commit is contained in:
parent
66d130e702
commit
a528e2f242
6 changed files with 25 additions and 27 deletions
1
rc.lua
1
rc.lua
|
@ -63,7 +63,6 @@ loadrc("appearance") -- theme and appearance settings
|
|||
loadrc("debug") -- debugging primitive `dbg()`
|
||||
|
||||
loadrc("bindings") -- keybindings
|
||||
loadrc("wallpaper") -- wallpaper settings
|
||||
loadrc("widgets") -- widgets configuration
|
||||
loadrc("tags") -- tags handling
|
||||
loadrc("xlock") -- lock screen
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
-- Change wallpaper
|
||||
|
||||
local wtimer = timer { timeout = 0 }
|
||||
|
||||
config.wallpaper = {}
|
||||
config.wallpaper.directory = awful.util.getdir("config") .. "/wallpapers"
|
||||
config.wallpaper.current = awful.util.getdir("cache") .. "/current-wallpaper.png"
|
||||
|
||||
-- We use fvwm-root because default backend for awsetbg does not seem
|
||||
-- to accept to set multiscreen wallpapers.
|
||||
local change = function()
|
||||
awful.util.spawn_with_shell(
|
||||
awful.util.getdir("config") .. "/bin/build-wallpaper " ..
|
||||
"--crop --directory " .. config.wallpaper.directory ..
|
||||
" --target " .. config.wallpaper.current ..
|
||||
"&& fvwm-root -r " .. config.wallpaper.current)
|
||||
end
|
||||
|
||||
wtimer:add_signal("timeout", function()
|
||||
change()
|
||||
wtimer:stop()
|
||||
wtimer.timeout = math.random(3000, 3600)
|
||||
wtimer:start()
|
||||
end)
|
||||
wtimer:start()
|
|
@ -6,6 +6,7 @@ After=compton@%i.service
|
|||
After=xsettingsd@%i.service
|
||||
After=tmux.service
|
||||
Before=nm-applet@%i.service
|
||||
Before=wallpaper@%i.service
|
||||
|
||||
[Service]
|
||||
Environment=DISPLAY=%I
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
[Unit]
|
||||
Description=Graphical user session for %I
|
||||
StopWhenUnneeded=yes
|
||||
Wants=awesome@%i.service
|
||||
Wants=autorandr@%i.service
|
||||
Wants=awesome@%i.service
|
||||
Wants=compton@%i.service
|
||||
Wants=inputplug@%i.service
|
||||
Wants=misc-x@%i.service
|
||||
Wants=nm-applet@%i.service
|
||||
Wants=policykit-agent@%i.service
|
||||
Wants=redshift@%i.service
|
||||
Wants=wallpaper@%i.service
|
||||
Wants=wallpaper@%i.timer
|
||||
Wants=xiccd@%i.service
|
||||
Wants=xsettingsd@%i.service
|
||||
Wants=xss-lock@%i.service
|
||||
|
|
14
systemd/wallpaper@.service
Normal file
14
systemd/wallpaper@.service
Normal file
|
@ -0,0 +1,14 @@
|
|||
[Unit]
|
||||
Description=Build a wallpaper for %I
|
||||
PartOf=graphical-session@%i.target
|
||||
|
||||
[Service]
|
||||
Environment=DISPLAY=%I
|
||||
Environment=WALLPAPER_DIRECTORY=%h/.config/awesome/wallpapers
|
||||
Environment=WALLPAPER_OUTPUT=%h/.cache/awesome/current-wallpaper.png
|
||||
ExecStart=%h/.config/awesome/bin/build-wallpaper --crop \
|
||||
--directory $WALLPAPER_DIRECTORY \
|
||||
--target $WALLPAPER_OUTPUT
|
||||
ExecStart=/usr/bin/fvwm-root -r $WALLPAPER_OUTPUT
|
||||
Type=oneshot
|
||||
RemainAfterExit=false
|
7
systemd/wallpaper@.timer
Normal file
7
systemd/wallpaper@.timer
Normal file
|
@ -0,0 +1,7 @@
|
|||
[Unit]
|
||||
Description=Wallpaper rotation for %I
|
||||
PartOf=graphical-session@%i.target
|
||||
|
||||
[Timer]
|
||||
OnUnitActiveSec=1h
|
||||
RandomizedDelaySec=10m
|
Loading…
Add table
Add a link
Reference in a new issue