A simple Clojure application to manage and rotate desktop wallpapers.
This project is a learning exercise in Clojure. It provides functionality to:
- Gather wallpapers from directories
- Filter wallpapers based on history
- Assign weights based on file modification time
- Pick a new wallpaper at random
- Maintain a history of used wallpapers
- Configure directories, history file location, and weights via a configuration file.
- Bundles a default configuration (
resources/config.edn) for first-time setup. - Supports building an
uberjarto run standalone. - Automatically resets history when no valid wallpapers remain.
Clone the repository:
git clone https://github.com/schelcj/wallpaper.git
cd wallpaper
# Run with Leiningen:
lein run
# pass args to lein:
lein run -- --help
# build a standalone jar file with:
lein uberjar
# run the jar file
java -jar target/wallpaper-standalone.jarThe default configuration is included as resources/config.edn. Before first run
the --init argument should be used to setup the default configuration file and directories.
A default configuration file is placed in $XDG_CONFIG_DIR/wallpaper/config.edn. All the default
should be sufficient except the :wallpaper-dir value. This is the path where wallpaper files
are stored organized by "category" (i.e. directories).
After initialization categories of wallpapers should be added with --add-category <category>
argument. The <category> is a directory within the :wallpapers-dir. No wallpapers will be
set until at least one category is added.
Typical settings to change include:
- :wallpapers-dir - root wallpapers directory
- :weights - map of time thresholds to weight values
- :setter - path and options for utility to set the wallaper
- Reads configuration (bundled or user-provided).
- Enumerates wallpaper files from configured directories.
- Prunes already used wallpapers according to history.
- Computes a “weight” for each candidate based on modification time.
- Chooses a random wallpaper, weighted by those weights.
- Updates the history file so the same wallpaper isn’t picked again too soon.
- If the candidate list is empty, resets history and starts over from all wallpapers.
Contributions, issues, and feature requests are welcome! Feel free to fork the repo and make a pull request.
This project is licensed under the Eclipse Public License 2.0 see LICENSE for details.