From bbebb5bc4da3030f254114083bcf39dba5e2623b Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Tue, 27 Sep 2016 15:08:35 -0700 Subject: [PATCH] [Linux] Add wallpaper service --- dotfiles/config/systemd/user/wallpaper.service | 10 ++++++++++ dotfiles/lib/bin/wallpaper.sh | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 dotfiles/config/systemd/user/wallpaper.service create mode 100755 dotfiles/lib/bin/wallpaper.sh diff --git a/dotfiles/config/systemd/user/wallpaper.service b/dotfiles/config/systemd/user/wallpaper.service new file mode 100644 index 00000000..f9994215 --- /dev/null +++ b/dotfiles/config/systemd/user/wallpaper.service @@ -0,0 +1,10 @@ +[Unit] +Description=wallpaper + +[Service] +Type=simple +ExecStart=/usr/bin/bash "wallpaper.sh" +ExecStop=/usr/bin/pkill wallpaper.sh + +[Install] +WantedBy=wm.target diff --git a/dotfiles/lib/bin/wallpaper.sh b/dotfiles/lib/bin/wallpaper.sh new file mode 100755 index 00000000..a560bc3e --- /dev/null +++ b/dotfiles/lib/bin/wallpaper.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +WALLPAPER_DIR="$HOME/Pictures/wallpaper/" + +random_paper() { + find "$WALLPAPER_DIR"use -type f | shuf -n1 +} + +wallpaper() { + while true; do + feh --bg-center $(random_paper) --bg-scale "$WALLPAPER_DIR"transparent1x1.png + sleep 1m + done +} + +wallpaper