From 9e4f01f8930efde899ad8f5128e2f39c62ea987d Mon Sep 17 00:00:00 2001 From: Adam Douglas Date: Thu, 13 May 2021 15:46:12 -0600 Subject: [PATCH] Initial commit --- .../systemd/user/gnome-rotate-wallpaper.conf | 1 + .../user/gnome-rotate-wallpaper.service | 12 +++ etc/systemd/user/gnome-rotate-wallpaper.timer | 10 ++ readme.md | 101 ++++++++++++++++++ screen_shield.md | 7 ++ usr/local/bin/gnome_rotate_wallpaper | 3 + 6 files changed, 134 insertions(+) create mode 100644 .config/systemd/user/gnome-rotate-wallpaper.conf create mode 100644 etc/systemd/user/gnome-rotate-wallpaper.service create mode 100644 etc/systemd/user/gnome-rotate-wallpaper.timer create mode 100644 readme.md create mode 100644 screen_shield.md create mode 100644 usr/local/bin/gnome_rotate_wallpaper diff --git a/.config/systemd/user/gnome-rotate-wallpaper.conf b/.config/systemd/user/gnome-rotate-wallpaper.conf new file mode 100644 index 0000000..6b7d9be --- /dev/null +++ b/.config/systemd/user/gnome-rotate-wallpaper.conf @@ -0,0 +1 @@ +WALLPAPER_DIR=/home/adam/Pictures/wallpaper diff --git a/etc/systemd/user/gnome-rotate-wallpaper.service b/etc/systemd/user/gnome-rotate-wallpaper.service new file mode 100644 index 0000000..5ac8782 --- /dev/null +++ b/etc/systemd/user/gnome-rotate-wallpaper.service @@ -0,0 +1,12 @@ +[Unit] +Description=Rotate GNOME wallpaper + +[Service] +Type=oneshot +Environment=DISPLAY=:0 +Environment=WALLPAPER_DIR=/home/%u/Pictures/wallpaper +EnvironmentFile=-/home/%u/.config/systemd/user/gnome-rotate-wallpaper.conf +ExecStart=/bin/bash /usr/local/bin/gnome_rotate_wallpaper + +[Install] +WantedBy=default.target diff --git a/etc/systemd/user/gnome-rotate-wallpaper.timer b/etc/systemd/user/gnome-rotate-wallpaper.timer new file mode 100644 index 0000000..daa92e7 --- /dev/null +++ b/etc/systemd/user/gnome-rotate-wallpaper.timer @@ -0,0 +1,10 @@ +[Unit] +Description=GNOME rotate wallpaper + +[Timer] +OnCalendar=*:0/1 +Persistent=true +Unit=gnome-rotate-wallpaper.service + +[Install] +WantedBy=default.target diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..44cf3ff --- /dev/null +++ b/readme.md @@ -0,0 +1,101 @@ +# Rotate Gnome Wallpaper using Systemd +- **Note:** Adjust paths as applicable to the desired OS. +- **Note:** The "$" represents the terminal prompt. +- **Note:** Verified to work on Arch Linux with Gnome v3.14. + +## Installation Instructions + +1. Download "gnome-rotate-wallpaper.service", "gnome-rotate-wallpaper.timer" and "gnome_rotate_wallpaper". +2. Move the 3 files to where Systemd user files are stored. +```bash +$ mv gnome-rotate-wallpaper.service gnome-rotate-wallpaper.timer /etc/systemd/user/ +``` +3. Move the BASH script "gnome_rotate_wallpaper". +```bash +$ mv gnome_rotate_wallpaper /usr/local/bin/ +``` +4. Set execute permissions. +```bash +$ chmod +x /usr/local/bin/gnome_rotate_wallpaper +``` +5. Enable the timer. +```bash +$ systemctl --user enable gnome-rotate-wallpaper.timer +``` +6. Verify the timer is enabled. +```bash +$ systemctl --user list-unit-files +gnome-rotate-wallpaper.service disabled +gnome-rotate-wallpaper.timer enabled +2 unit files listed. +``` +7. Start the timer. +```bash +$ systemctl --user start gnome-rotate-wallpaper.timer +``` +8. Verify the timer has been started. +```bash +$ systemctl --user list-timers +NEXT LEFT LAST PASSED UNIT ACTIVATES +Thu 2016-03-10 18:49:00 CST 1s left Thu 2016-03-10 18:48:56 CST 1s ago gnome-rotate-wallpaper.timer gnome-rotate-wallpaper.service +1 timers listed. +Pass --all to see loaded but inactive timers, too. +``` + +## User Configuration + +### Change the default wallpaper directory. + +1. Create the required directories. +```bash +$ mkdir ~/.config/systemd ~/.config/systemd/user +``` +2. Create the configuration file. Replace "username" with applicable value. +```bash +$ nano ~/.config/systemd/user/gnome-rotate-wallpaper.conf +``` + + WALLPAPER_DIR=/home/username/Pictures/wallpaper + +### Set the Interval to When the Wallpaper Changes. + +Create the timer file and then change the "OnCalendar" value to the desired interval. Refer to [ArchLinux: systemd/Timers](https://wiki.archlinux.org/index.php/Systemd/Timers#Realtime_timer) for further details. + +1. Create the required directories. +```bash +$ mkdir ~/.config/systemd ~/.config/systemd/user +``` +2. Create the configuration file. +```bash +$ nano ~/.config/systemd/user/gnome-rotate-wallpaper.timer +``` + +``` +[Unit] +Description=Gnome rotate wallpaper + +[Timer] +OnCalendar=*:0/1 +Persistent=true +Unit=gnome-rotate-wallpaper.service + +[Install] +WantedBy=gnome-rotate-wallpaper.service +``` + +## Avaliable picture-options + +- none +- wallpaper +- centered +- scaled +- stretched +- zoom +- spanned + +## External Links + + * https://wiki.archlinux.org/index.php/Systemd/User + * https://wiki.archlinux.org/index.php/Systemd/Timers + * https://major.io/2015/02/11/rotate-gnome-3s-wallpaper-systemd-user-units-timers/ + * https://stackoverflow.com/questions/10374520/gsettings-with-cron diff --git a/screen_shield.md b/screen_shield.md new file mode 100644 index 0000000..3e4846b --- /dev/null +++ b/screen_shield.md @@ -0,0 +1,7 @@ +# Change the lock screen shield + + + +# External Links + +- https://help.gnome.org/admin/system-admin-guide/stable/desktop-shield.html.en diff --git a/usr/local/bin/gnome_rotate_wallpaper b/usr/local/bin/gnome_rotate_wallpaper new file mode 100644 index 0000000..5c0fc23 --- /dev/null +++ b/usr/local/bin/gnome_rotate_wallpaper @@ -0,0 +1,3 @@ +#!/bin/bash +selection=$(find $WALLPAPER_DIR -type f -name "*.jpg" -o -name "*.png" | shuf -n1) +gsettings set org.gnome.desktop.background picture-uri "file://$selection"