diff --git a/rc.lua b/rc.lua index 62be1a1..4304f68 100644 --- a/rc.lua +++ b/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 diff --git a/rc/wallpaper.lua b/rc/wallpaper.lua deleted file mode 100644 index 33e6915..0000000 --- a/rc/wallpaper.lua +++ /dev/null @@ -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() diff --git a/systemd/awesome@.service b/systemd/awesome@.service index 33b8143..186299f 100644 --- a/systemd/awesome@.service +++ b/systemd/awesome@.service @@ -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 diff --git a/systemd/graphical-session@.target b/systemd/graphical-session@.target index f051d42..e5c1d6e 100644 --- a/systemd/graphical-session@.target +++ b/systemd/graphical-session@.target @@ -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 diff --git a/systemd/wallpaper@.service b/systemd/wallpaper@.service new file mode 100644 index 0000000..df13705 --- /dev/null +++ b/systemd/wallpaper@.service @@ -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 diff --git a/systemd/wallpaper@.timer b/systemd/wallpaper@.timer new file mode 100644 index 0000000..6969762 --- /dev/null +++ b/systemd/wallpaper@.timer @@ -0,0 +1,7 @@ +[Unit] +Description=Wallpaper rotation for %I +PartOf=graphical-session@%i.target + +[Timer] +OnUnitActiveSec=1h +RandomizedDelaySec=10m