A simple GNOME desktop wallpaper rotation using Systemd.
Go to file
Adam dc69aeceb2 docs: adjust reference section for clarity 2022-11-12 13:22:15 -06:00
.config/systemd/user refactor: change project name 2022-04-10 14:07:15 -06:00
etc/systemd/user refactor: change project name 2022-04-10 14:07:15 -06:00
usr/local/bin fix: wallpaper not changing 2022-11-11 14:36:07 -06:00
LICENSE Add LICENSE 2022-04-12 00:40:33 +00:00
readme.md docs: adjust reference section for clarity 2022-11-12 13:22:15 -06:00
screen_shield.md Initial commit 2021-05-13 15:46:12 -06:00

readme.md

Wallpaperctl

A light weight script to automatically set and rotate through computer desktop wallpaper. Desktop wallpaper rotation is based upon a set duration (default, 1 minute). Wallpaper is randomly selected and defaults to look for wallpaper from the user's home directory under "Pictures/wallpaper/" (e.g. "/home/adam/Pictures/wallpaper").

Note: Verified to work on Arch Linux with GNOME v3.14 to v42.

Installation

Assumptions

  • Have experienced working knowledge within a CLI (command-line interface)
  • Understanding of Linux operating system
  • Installed all required dependencies as stated in Dependency Requirements section
  • Installation is done via Linux CLI
  • Steps prefixed with a "$" (dollar sign) represents the CLI prompt
  • Steps prefixed with a "#" (number sign) represents the CLI prompt with elevated user permissions (e.g. root)
  • The text after the "$" or "#" is to be entered at the CLI
  • The installation instructions are an example of installation and configuration

Dependency Requirements

  • BASH v5+
  • Git v2+
  • GNOME v3.14+

Setup

  1. Clone the project.
    $ git clone https://gitlab.com/adouglas/wallpaperctl.git
    
  2. Change to project directory.
    $ cd wallpaperctl
    
  3. Install Systemd unit files.
    # cp etc/systemd/user/wallpaperctl.* /etc/systemd/user/
    
  4. Install script file.
    # cp usr/local/bin/wallpaperctl /usr/local/bin/
    
  5. Reload the systemd configuration.
    # systemctl daemon-reload
    
  6. Set execute permission.
    # chmod +x /usr/local/bin/wallpaperctl
    

Configuration

  1. Enable the Systemd timer.
    $ systemctl --user enable wallpaperctl.timer
    
  2. Verify the timer is enabled.
    $ systemctl --user list-unit-files
    wallpaperctl.service disabled
    wallpaperctl.timer   enabled
    2 unit files listed.
    
  3. Start the Systemd timer.
    $ systemctl --user start wallpaperctl.timer
    
  4. Verify the timer has been started.
    $ 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 wallpaperctl.timer wallpaperctl.service
    1 timers listed.
    Pass --all to see loaded but inactive timers, too.
    

Custom Settings

Change Wallpaper Directory

This alteration will set the location of where wallpapers are stored.

  1. Create the required directories.

    $ mkdir  ~/.config/systemd ~/.config/systemd/user
    
  2. Create the configuration file. Replace "username" with applicable value.

    $ nano ~/.config/systemd/user/wallpaperctl.conf
    

    WALLPAPER_DIR=/home/username/Pictures/wallpaper

Change Wallpaper Duration

This alteration will set the duration of how long the wallpaper is displayed for until a new wallpaper is set.

  1. Create the required directories.

    $ mkdir  -p ~/.config/systemd/user
    
  2. Create the configuration file.

    $ nano ~/.config/systemd/user/wallpaperctl.timer
    
  3. Change the OnCalendar value as desired.

    Refer to ArchLinux: systemd/Timers for further details. The below example changes the duration interval from 1 minute to 5 minutes.

    [Unit]
    Description=Wallpaperctl - Systemd GNOME wallpaper changer
    
    [Timer]
    OnCalendar=*:0/5
    Persistent=true
    Unit=wallpaperctl.service
    
    [Install]
    WantedBy=wallpaperctl.service
    

Reference

Wallpaper Options

Desktop wallpaper can be displayed in the following ways (org.gnome.desktop.background.picture-options).

Note: Not applicable at this time. Here for future use.

  • none
  • wallpaper
  • centered
  • scaled
  • stretched
  • zoom
  • spanned

Acceptable display setting values are sourced from:

$ gsettings describe org.gnome.desktop.background picture-options
Determines how the image set by wallpaper_filename is rendered. Possible values are “none”, “wallpaper”, “centered”, “scaled”, “stretched”, “zoom”, “spanned”.