Skip to content
Python wallpaper setter for X11
Python
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.
qpaper
.gitignore
readme.rst
setup.py

readme.rst

qpaper

Python wallpaper-setter for X11.

This was originally written as an extension for the Qtile window manager (hence the name qpaper), though it works for X11 in general. It requires the same dependencies as Qtile, i.e. cairocffi and xcffib.

Usage

The qpaper.Painter acts as the wallpaper setting interface. Instantiate it with the name of the target display, and then either all screens can be painter by using the Painter.paint_all method, or an individual screen using the Painter.paint_screen method. These two methods can both take optional these keyword args:

  • image (str) : path to image to set as wallpaper
  • colour (str) : hex code to simply set a colour instead of an image
  • option (str) : one of 'fill' or 'stretch'

Painter.paint_screen should also be passed an int to index the target screen.

Script

Installation via setup.py also installs a script named qpaper that can be used directly:

qpaper /path/to/wallpaper/image.png --option fill

Example

To set wallpapers for all screens upon Qtile startup, add something like this to the Qtile config:

import os
import qpaper
from libqtile import hook

@hook.subscribe.startup
def startup():
    qpaper.Painter(os.environ.get("DISPLAY")).paint_all(
        image='/home/user/wallpaper.png', option='fill',
    )
You can’t perform that action at this time.