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
Print one metadata value without the banner or formatted panel:
getwinbg background --field size_bytes
getwinbg background -f timestamps.modified.utc
getwinbg background --field file_system.is_file
Use the exact keys from --json; nested objects use dot notation. For example,
the size key is size_bytes, timestamps are under timestamps.created,
timestamps.modified, and timestamps.accessed, and file-system details are
under file_system. The Windows file attributes, when available, are under
file_system.attributes. Field names are case-sensitive and there are no
aliases such as size or top-level is_file.
Strings print without quotes; other values use JSON representation, including
null, booleans, numbers, dictionaries, and lists. For example,
--field file_system.is_file prints true or false. Unknown fields produce
an error that includes the available field names; a missing field argument is
reported by Typer. Metadata retrieval errors exit with status 1; unknown or
missing fields exit with status 2.
--field cannot be combined with --json, --path-only, --reveal,
--open, or --copy. For the complete field reference, types, nested paths,
and error behavior, see the CLI documentation.
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.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| getwinbg-0.1.7.tar.gz | 26.6 kB | With provenance | Details for getwinbg-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| getwinbg-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for getwinbg-0.1.7-py3-none-any.whl |
Total release size: 37.9 kB
Release files / getwinbg-0.1.7.tar.gz
| Download URL | getwinbg-0.1.7.tar.gz |
|---|---|
| Size | 26.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dfc672a3062937b1c4ebfd35c74d293f360a10305bc06f403bbaa54694ea57ac
|
|
BLAKE2b-256 checksum How to use checksums |
b926a58075a2472307573186a881c9806cf9c33713e8b227069bf6d0246e2253
|
| 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 Dec 1, 2026.
Transparency logRelease files / getwinbg-0.1.7-py3-none-any.whl
| Download URL | getwinbg-0.1.7-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b03f120f114da29aa265761c8687144d2570d984cc5aeba1a7b2726a045b7f4b
|
|
BLAKE2b-256 checksum How to use checksums |
12a1a1e300f00e06001ebceb0de0de114932f06fdb5c33f38995e21cc518761c
|
| 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 Dec 1, 2026.
Transparency logSecurity for getwinbg 0.1.7
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.
Attestation for getwinbg-0.1.7.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 Dec 1, 2026.
Transparency logA 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.