Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Sets wallpaper like no-one's business
Tag: v0.2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.



newbg - Set wallpaper like no-one's business


  newbg [-d|-D subdir] [-v] [-n] [--list] [keywords...]

  echo 'root: /home/user/wallpapers' >> ~/.newbg

  newbg                # random wallpaper
  newbg -d animals     # random wallpaper from animals subdir
  newbg dinosaur       # random wallpaper with dinosaur in filename

  # Adjust brightness
  newbg --darken [10] | --lighten [10]

  # View current wallpaper or history
  newbg [--current | --history]

  # Restore previous wallpaper on startup
  newbg -r


newbg is a simple utility to set the desktop wallpaper. Given a directory of wallpaper images, it will pick a random image subject to the subdirectory or filename restrictions you provide, and set it as background. It keeps track of previously set images and will cycle through them to avoid duplicates.

newbg keeps track of how long a wallpaper has been active and will be less likely to suggest wallpapers you change after a short amount of time.

Additionally, newbg can normalise the brightness of wallpapers and output a history of previously set images.



Pick wallpapers in which the filename contains at least one of the keywords provided. Case-insensitive.

-d, --dir subdir

Specify the directory in which to look for a wallpaper. This directory is assumed to be a sub-directory of the root directory (see above), unless it begins with a slash ('/').

-D subdir

As -d, except assume the directory is relative to the current working directory if it does not begin with a slash.

-r, --restore

Restore previously set wallpaper, without counting statistics. This is intended for use at startup.


Darken the current wallpaper. The default adjustment is 10, but can be set. Your adjustment will be saved and applied when the wallpaper is picked again.


Brighten the current wallpaper (as above).

-n, --no-stats

Usually newbg will remember if you immedately switch to another wallpaper (by re-running the command) or seem to be happy with a wallpaper (but not re-running for a while) and factor this into future selections. This option disables this behaviour for the current invocation.

-l, --list

List wallpapers that could be picked, but don't set any.


Show current and previously set wallpapers, with time since they were set.


Print path of current wallpaper.

-v, --verbose

Output the filename of the selected wallpaper, and some other information.

--config path

Override path to the newbg config file.


newbg's configuration is by default stored in $HOME/.newbg in YAML format. You can override this via either the --config option or the NEWBG_CONFIG environment variable.

The config file is used to store data about previous wallpaper selections and user preferences e.g. brightness adjustments. The following top-level keys may be set:


Path to the root directory of the user's wallpapers. Required.


Target average intensity of pixels in the wallpaper, as a floating point number [0,1]. If this config is set, images will have their brightness adjusted such that the average intensity becomes this value.


Holds configuration for each wallpaper, by SHA-1 hash of its contents. Relevant keys are 'good' (number of good votes), 'bad' (number of bad votes) and 'bright_adjust' (user-specified brightness adjustment for image).


Richard Harris <>


This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Something went wrong with that request. Please try again.