Skip to main content

getwinbg

Retrieve the current Windows desktop background from Python or the command line.

getwinbg is a lightweight, typed Windows utility that returns the path to the current desktop background and can optionally reveal or open it, or copy its path to the clipboard.

Read the full documentation. See the project changelog for release history.

Features

  • Retrieve the current Windows desktop background path
  • Reveal the background in File Explorer
  • Open the background with its default application
  • Copy the background path to the Windows clipboard
  • Print only the background path for use in scripts
  • Python API and command-line interface
  • Fully typed package (py.typed)

Requirements

  • Windows
  • Python 3.13 or newer

Installation

Install the latest release from PyPI:

pip install getwinbg

To install the current source checkout:

git clone https://github.com/ViratiAkiraNandhanReddy/getwinbg.git
cd getwinbg
pip install .

Usage

CLI

Display the current desktop background:

getwinbg background

Reveal the background file in File Explorer:

getwinbg background --reveal

Open the file with its default image application:

getwinbg background --open

Copy the path as text to the Windows clipboard:

getwinbg background --copy

Print only the path, without the banner or formatted panel:

getwinbg background --path-only

Print detailed file metadata as JSON for scripts and other applications:

getwinbg background --json

Use -r, -o, and -c as short forms for --reveal, --open, and --copy. These action options can be combined; they run in reveal, open, and copy order after the path is displayed. Copying places the path as text on the clipboard; it does not copy the image file. --path-only is intended for capturing or piping the path and takes precedence over the action options. Use getwinbg --version to print the installed package version and getwinbg --help or getwinbg background --help to inspect command help.

Example output from getwinbg background:

                     $$\                   $$\           $$\                 
                     $$ |                  \__|          $$ |                
 $$$$$$\   $$$$$$\ $$$$$$\   $$\  $$\  $$\ $$\ $$$$$$$\  $$$$$$$\   $$$$$$\  
$$  __$$\ $$  __$$\\_$$  _|  $$ | $$ | $$ |$$ |$$  __$$\ $$  __$$\ $$  __$$\ 
$$ /  $$ |$$$$$$$$ | $$ |    $$ | $$ | $$ |$$ |$$ |  $$ |$$ |  $$ |$$ /  $$ |
$$ |  $$ |$$   ____| $$ |$$\ $$ | $$ | $$ |$$ |$$ |  $$ |$$ |  $$ |$$ |  $$ |
\$$$$$$$ |\$$$$$$$\  \$$$$  |\$$$$$\$$$$  |$$ |$$ |  $$ |$$$$$$$  |\$$$$$$$ |
 \____$$ | \_______|  \____/  \_____\____/ \__|\__|  \__|\_______/  \____$$ |
$$\   $$ |                                                         $$\   $$ |
\$$$$$$  |                                                         \$$$$$$  |
 \______/                                                           \______/ 

             Retrieve Windows background image paths  •  vX.X.X

╭───────────────────────────────── getwinbg ─────────────────────────────────╮
│ Current desktop background                                                 │
│                                                                            │
│ C:\Users\User\Pictures\wallpaper.jpg                                       │
╰────────────────────────────────────────────────────────────────────────────╯

Python API

The recommended API is the Background class:

from getwinbg import Background

background = Background()
print(background.path)
print(background.json())

background.reveal()
background.open()
background.copy()

Background.json() returns the metadata as formatted JSON, while Background.metadata provides the same details as a JSON-serializable dictionary. The details include the resolved path, file naming and MIME information, size, SHA-256 digest, timestamps, and available file-system attributes.

Example output:

C:\Users\User\Pictures\wallpaper.jpg

get_background() remains available for compatibility but is deprecated and will be removed in version 0.2.0. Use Background().path instead:

from getwinbg import get_background

path = get_background()

Development

Install the development dependencies and run the checks:

pip install -e ".[dev]"
ruff check .
ruff format --check .
ty check

Build the documentation locally:

pip install -r docs/requirements.txt
python -m sphinx -W --keep-going docs docs/_build/html

License

getwinbg is released under the MIT License.

Metadata

Release files for getwinbg 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for getwinbg 0.1.6
File Size Uploaded Provenance Actions
getwinbg-0.1.6.tar.gz 22.3 kB With provenance Details for getwinbg-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for getwinbg 0.1.6
File Interpreter ABI Platform Actions
getwinbg-0.1.6-py3-none-any.whl Python 3 none any Details for getwinbg-0.1.6-py3-none-any.whl

Total release size: 32.6 kB

Release files / getwinbg-0.1.6.tar.gz

Download URL getwinbg-0.1.6.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b3d717705e7e35a395e7d6a1f8c68a67e2b409f89e5dc967b41d003dd4b2ed8c
BLAKE2b-256 checksum
How to use checksums
928419531e83211e82584e7d8d024c26142736572dddd6a41d2297507b0b70ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / getwinbg-0.1.6-py3-none-any.whl

Download URL getwinbg-0.1.6-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fb84e0917793ea2438595bb72b56700186ffc909043cdc3e8b619066e9ed072
BLAKE2b-256 checksum
How to use checksums
c8405da0e0fe5b5e3effb3fa0b09d48003ed79f25fef70bcef57ecdbb58826f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for getwinbg 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for getwinbg-0.1.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page