Skip to content
Utilities for handling monitors, resolutions, wallpapers and timed wallpapers
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd Better default download directory Apr 24, 2019
vendor Fix an issue when setting timed wallpapers right after midnight Apr 8, 2019
.gitignore
.travis.yml Update CI configuration Mar 26, 2019
LICENSE Update license after project rename Mar 23, 2019
Makefile Support building with CGO_ENABLED=0 Mar 28, 2019
README.md
backend.go Support building with CGO_ENABLED=0 Mar 28, 2019
backend_nocgo.go
cinnamon.go Improve comments Apr 2, 2019
closest.go
closest_nocgo.go Support building with CGO_ENABLED=0 Mar 28, 2019
closest_test.go Package rename Feb 16, 2019
collections.go Improve comments Mar 28, 2019
deepin.go Improve comments Apr 2, 2019
feh.go
gnome2.go Improve comments Apr 2, 2019
gnome3.go Improve comments Apr 2, 2019
go.mod Fix an issue when setting timed wallpapers right after midnight Apr 8, 2019
go.sum Fix an issue when setting timed wallpapers right after midnight Apr 8, 2019
gsettings.go Introduce a struct for dealing with gsettings Mar 20, 2019
mate.go Improve comments Apr 2, 2019
monconf.go Improve comments Mar 28, 2019
monconf_test.go Enable check for overlapping monitor configurations Mar 21, 2019
monitor.go Support building with CGO_ENABLED=0 Mar 28, 2019
overlap.go Improve comments Mar 28, 2019
plasma.go Improve comments Apr 2, 2019
res.go Support building with CGO_ENABLED=0 Mar 28, 2019
res_test.go Package rename Feb 16, 2019
sway.go Improve comments Apr 2, 2019
utils.go Support building with CGO_ENABLED=0 Mar 28, 2019
wallpaper.go Better wallpaper mode settings Mar 29, 2019
wallutils.go
wayinfo.go Package rename Feb 16, 2019
wayinfo.h Minor changes to the formatting Mar 23, 2019
wayinfo_test.go Package rename Feb 16, 2019
weston.go Support different wallpaper modes (fill, tile etc) Mar 28, 2019
x11.go
xfce4.go Add support for wallpaper modes for Xfce4 (tiled, centered etc) Apr 2, 2019
xinfo.go Improve comments Mar 28, 2019
xinfo.h
xinfo_test.go Package rename Feb 16, 2019
xrandr.go Improve comments Mar 28, 2019
xrandr_test.go Cache the result if running xrandr Mar 23, 2019
xwallpaper.h Initial commit Feb 7, 2019

README.md

Wallutils Build Status GoDoc License Go Report Card

  • Detect monitor resolutions and set the desktop wallpaper, for any window manager (please file an issue if your window manager is not supported yet).
  • Supports GNOME timed wallpapers, and includes a utility that can run an event loop for changing them (also supports cross fading).
  • Introduces a new file format for timed wallpapers: The Simple Timed Wallpaper format: Web | Markdown | PDF

Timed Wallpapers

The Mojave timed wallpaper and other timed wallpapers can be set with the settimed command, and will cross fade from image to image as the day progresses:

Included utilities

  • getdpi, for retrieving the average DPI, for all monitors (use -b to see the DPI both horizontally and vertically).
  • lscollection, for listing installed wallpaper collections (use -l for also listing paths and collection names).
  • timedinfo, for showing more information about installed timed wallpapers.
  • lsmon lists the connected monitors and resolutions (use -d for also listing DPI).
  • lstimed for listing installed timed wallpapers (use -l for also listing paths).
  • lswallpaper, for listing all installed wallpapers (use -l and -s to list more information).
  • setcollection, for setting a suitable (in terms of resolution) wallpaper from a wallpaper collection.
  • setrandom, for setting a random wallpaper.
  • settimed, for setting timed wallpapers (will continue to run, to handle time events).
  • setwallpaper can be used for setting a wallpaper (works both over X and the Wayland protocol).
  • wayinfo shows detailed information about the connected monitors, via Wayland.
  • xinfo shows detailed information about the current X setup.
  • xml2stw for converting GNOME timed wallpapers to the Simple Timed Wallpaper format.

Example use of the lsmon utility

$ lsmon
0: 1920x1200
1: 1920x1200
2: 1920x1200

Building and installing utilities

Using make, for building and installing all included utilities:

make
make install

Using Go 1.12 or later, for a single utility:

go get -u github.com/xyproto/wallutils/cmd/settimed

On Arch Linux:

Install wallutils from AUR, or:

sudo pacman -Syu git go libxcursor libxmu wayland xbitmaps xorgproto
git clone https://github.com/xyproto/wallutils
cd wallutils
make
sudo make PREFIX=/usr/local install

On Fedora:

sudo dnf update
sudo dnf install git golang libXcursor-devel libXmu-devel xorg-x11-xbitmaps
git clone https://github.com/xyproto/wallutils
cd wallutils
make
sudo make PREFIX=/usr/local install

On Ubuntu:

sudo apt get update
sudo apt get install git golang-go libx11-dev libxcursor-dev libxmu-dev
git clone https://github.com/xyproto/wallutils
cd wallutils
make
sudo make PREFIX=/usr/local install

Wayland or X only

The packages related to X can be removed after building if only wish to keep the Wayland-related functionality. And likewise for X.

Example use of settimed

settimed mojave-timed

Example use of setwallpaper

setwallpaper /path/to/background/image.png

Example use of setrandom

setrandom /usr/share/pixmaps

Example use of the Go package

Retrieve monitor resolution(s)

package main

import (
    "fmt"
    "os"

    "github.com/xyproto/wallutils"
)

func main() {
    // Retrieve a slice of Monitor structs, or exit with an error
    monitors, err := wallutils.Monitors()
    if err != nil {
        fmt.Fprintf(os.Stderr, "%s\n", err)
        os.Exit(1)
    }
    // For every monitor, output the ID, width and height
    for _, monitor := range monitors {
        fmt.Printf("%d: %dx%d\n", monitor.ID, monitor.Width, monitor.Height)
    }
}

Change the wallpaper

fmt.Println("Setting background image to: " + imageFilename)
if err := wallutils.SetWallpaper(imageFilename); err != nil {
    return err
}

Build requirements

  • Go 1.12 or later.
  • A working C compiler (tested with GCC 8.2.1).
  • Header files for Wayland and X.

Runtime requirements

  • libwayland-client.so, for Wayland support.
  • libX11.so, for X support.

It is also possible to build with make static, to only build the utilities that does not depend on any of the above .so files, as statically compiled ELF executables.

Wallpaper collections

The XML format from GNOME for specifying wallpaper collections is not yet supported (and I'm not sure if it's needed). Creating a directory with images where the filename of the images specify the resolution (like wallpaper_5639x3561.jpg) is enough for lscollection to recognize it as a collection (if the directory is placed in /usr/share/backgrounds or /usr/share/wallpapers).

Setting a wallpaper per monitor

Setting a wallpaper per monitor is not yet supported, but it might be in the future.

Refreshing the wallpaper after waking from sleep

Try sending the USR1 signal to the settimed process:

pkill settimed -USR1

This should refresh the wallpaper.

General info

You can’t perform that action at this time.