Skip to main content
https://travis-ci.com/eight04/pyDesktop3.svg?branch=master

This is a python 3 port of desktop package.

The desktop package provides desktop environment detection and resource opening support for a selection of common and standardised desktop environments.

Insallation

pip install desktop3

Usage

Launch folders, files, … etc:

import desktop
desktop.open("what/you/want/to/open")

Introduction

The desktop package provides desktop environment detection and resource opening support for a selection of common and standardised desktop environments.

Currently, in Python’s standard library, there is apparently no coherent, cross-platform way of getting the user’s environment to “open” files or resources (showing such files in browsers or editors, for example) when requested by a Python program. There is an os.startfile function which works for Windows, but no equivalent function for other desktop environments - the webbrowser module seems to employ alternative mechanisms in choosing and running external programs and presumably does not seek to provide general support for non-URL resources anyway.

Since desktop environments like KDE and GNOME provide mechanisms for running browsers and editors according to the identified type of a file or resource, just as Windows “runs” files or resources, it is appropriate to have a module which accesses these mechanisms. It is this kind of functionality that the desktop package aims to support. Note that this approach is arguably better than that employed by the webbrowser module since most desktop environments already provide mechanisms for configuring and choosing the user’s preferred programs for various activities, whereas the webbrowser module makes relatively uninformed guesses (for example, opening Firefox on a KDE desktop configured to use Konqueror as the default browser).

Some ideas for desktop detection (XFCE) and URL opening (XFCE, X11) were obtained from the xdg-utils project which seeks to implement programs performing similar functions to those found in the desktop module. The xdg-utils project can be found here:

http://portland.freedesktop.org/

Other information regarding desktop icons and menus, screensavers and MIME configuration can also be found in xdg-utils.

Notes

Notes on desktop application/environment support:

KDE

Supports file and URL opening using kfmclient, where the openURL command opens the resource and the exec command runs the resource.

KDE 4

Similar to KDE but uses kioclient instead of kfmclient.

GNOME

Supports file and URL opening using gnome-open.

XFCE

Supports file and URL opening using exo-open.

ROX-Filer

Supports file opening using “rox <filename>” but not URL opening.

Changelog

  • 0.5.4 (Sep 20, 2025)

    • Fix: use raw string on docstring to avoid escape sequence issues.

  • 0.5.3 (Aug 19, 2019)

    • Fix: unable to detect XFCE.

  • 0.5.2 (Oct 26, 2016)

    • Add docs folder into dist file.

  • 0.5.1 (Oct 25, 2016)

    • Fix letter case issue in setup.py.

  • 0.5.0 (Jul 2, 2016)

    • First release.

Old Changelog

New in desktop 0.4.3 (Changes since desktop 0.4.2)

  • Added missing KDE 4 support to the desktop.dialog module.

New in desktop 0.4.2 (Changes since desktop 0.4.1)

  • Added XFCE 4.10 “mailto:” fix contributed by Jérôme Laheurte.

New in desktop 0.4.1 (Changes since desktop 0.4)

  • Added KDE 4 and Lubuntu support contributed by Jérôme Laheurte.

New in desktop 0.4 (Changes since desktop 0.3)

  • Improved docstrings.

  • Fixed support for examining the root window.

  • Changed the licence to the LGPL version 3 (or later).

New in desktop 0.3 (Changes since desktop 0.2.4)

  • Made desktop a package.

  • Added support for graphical dialogue boxes through programs such as kdialog, zenity and Xdialog.

  • Added support for inspecting desktop windows (currently only for X11).

New in desktop 0.2.4 (Changes since desktop 0.2.3)

  • Added XFCE support (with advice from Miki Tebeka).

  • Added Ubuntu Feisty (7.04) package support.

New in desktop 0.2.3 (Changes since desktop 0.2.2)

  • Added Python 2.3 support (using popen2 instead of subprocess).

New in desktop 0.2.2 (Changes since desktop 0.2.1)

  • Changed the licence to LGPL.

New in desktop 0.2.1 (Changes since desktop 0.2)

  • Added Debian/Ubuntu package support.

New in desktop 0.2 (Changes since desktop 0.1)

  • Added support for waiting for launcher processes.

  • Added a tests directory.

Release files for desktop3 0.5.4

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

Source distribution (sdist)

Source distribution for desktop3 0.5.4
File Size Uploaded
desktop3-0.5.4.tar.gz 30.4 kB Details

Built distribution (wheel)

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

Total release size: 44.6 kB

Release files / desktop3-0.5.4.tar.gz

Download URL desktop3-0.5.4.tar.gz
Size 30.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2fe6d277751c87e118fac319b5bbc335d45ed81022136dece9f50d34433c2acf
BLAKE2b-256 checksum
How to use checksums
ab17c691104807149aa087057d1ced1bed406c9fa8a385a848a5a4f46ce3b451
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / desktop3-0.5.4-py3-none-any.whl

Download URL desktop3-0.5.4-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a5f256bc2e1de12b111630214674fa4fe0bc2acc70c972befa71a316fcfc24ca
BLAKE2b-256 checksum
How to use checksums
93994fa433824c5845fcc7ee975b3f8304213887ae06bb03aaefc38570a9aa03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.5.4 This release

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.3

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