Skip to main content

A library for working with .desktop files

Project description

desktop-entry-lib

PyPI PyPI - Downloads PyPI - Python Version PyPI - License PyPI - Implementation Read the Docs

desktop-entry-lib allows reading and writing .desktop files according to the Desktop Entry Specification

import desktop_entry_lib


def write() -> None:
    entry = desktop_entry_lib.DesktopEntry()

    entry.Name.default_text = "My App"
    entry.Comment.default_text = "A short description"
    entry.Comment.translations["de"] = "A short german description"
    entry.Type = "Application"
    entry.Exec = "my-app"

    entry.write_file("my_app.desktop")


def read() -> None:
    entry = desktop_entry_lib.DesktopEntry.from_file("my_app.desktop")

    print("Name: " + entry.Name.default_text)
    print("Comment: " + entry.Comment.default_text)
    print("German translation for Comment: " + entry.Comment.translations.get("de", "None"))
    print("Type: " + entry.Type)
    print("Exec: " + entry.Exec)


if __name__ == "__main__":
    write()
    read()

Features:

  • Fully static typed
  • No external dependencies
  • Full Documentation and Examples available
  • Support running inside a Flatpak
  • The whole lib is a single file
  • Supports PyPy

Read the documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

desktop_entry_lib-5.0.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

desktop_entry_lib-5.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file desktop_entry_lib-5.0.tar.gz.

File metadata

  • Download URL: desktop_entry_lib-5.0.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for desktop_entry_lib-5.0.tar.gz
Algorithm Hash digest
SHA256 9a621bac1819fe21021356e41fec0ac096ed56e6eb5dcfe0639cd8654914b864
MD5 1374b11e7332a341838b81d6af834f51
BLAKE2b-256 c6837602c4ec7c59c9d6929c0f13e6b48e733cf4772dd54b342a360bd07f4b55

See more details on using hashes here.

File details

Details for the file desktop_entry_lib-5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for desktop_entry_lib-5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e60a0c2c5e42492dbe5378e596b1de87d1b1c4dc74d1f41998a164ee27a1226f
MD5 b4351404699da4d9c5f98370f393a106
BLAKE2b-256 ca0146ec5a4780889da06f016553d1d18d804b3e0da570e4b1e50bd8d28c4a82

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page