- 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: FORMAT SPEC.
- The
monitor.Detect
function can return a[]Monitor
slice in Go, with information about all connected monitors. - The
monitor.SetTimedWallpaper
function can be used for launching an event loop that handles GNOME timed wallpapers.
getdpi
, for retrieving the average DPI, for all monitors.lscollections
, for listing installed wallpaper collections.timedinfo
, for showing more information about installed GNOME timed wallpapers.lsmon
lists the connected monitors and resolutions.lstimed
for listing installed GNOME timed wallpapers.lswallpaper
, for listing all installed wallpapers.setcollection
, for setting a suitable (in terms of resolution) wallpaper from a wallpaper collection.setrandom
, for setting a random wallpaper.settimed
, for setting GNOME timed wallpapers (will continue to run, to handle time events).setwallpaper
can be used for setting a wallpaper (works both for X11 and Wayland).wayinfo
shows detailed information about the connected monitors, via Wayland.xinfo
shows detailed information about the connected monitors, via X11.xml2stw
for converting GNOME timed wallpapers to the Simple Timed Wallpaper format.
$ lsmon
0: 1920x1200
1: 1920x1200
2: 1920x1200
Using make, for building and installing all included utilities:
make
make install
Using Go 1.11 or later, for a single utility:
go get -u github.com/xyproto/monitor/cmd/setwallpaper
On Ubuntu, from a fresh installation:
sudo apt get update
sudo apt get install libxcursor-dev libxmu-dev libx11-dev git golang-go
go get -u github.com/xyproto/monitor/cmd/setwallpaper
cd ~/go/src/github.com/xyproto/monitor
Manually:
# clone the repository
git clone https://github.com/xyproto/monitor
# build and install the setwallpaper command
cd monitor/cmd/setwallpaper
go build
install -Dm755 setwallpaper /usr/bin/setwallpaper
setwallpaper /path/to/background/image.png
package main
import (
"fmt"
"os"
"github.com/xyproto/monitor"
)
func main() {
// Retrieve a slice of Monitor structs, or exit with an error
monitors, err := monitor.Detect()
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)
}
}
fmt.Println("Setting background image to: " + imageFilename)
if err := monitor.SetWallpaper(imageFilename); err != nil {
return err
}
- Go 1.11 or later.
- A working C compiler (tested with GCC 8.2.1)
libwayland-client.so
and header files available, for Wayland support.libX11.so
and header files available, for X11 support.
- Author: Alexander F. Rødseth <[email protected]>
- License: MIT
- Version: 3.2.0