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-4.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

desktop_entry_lib-4.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file desktop-entry-lib-4.0.tar.gz.

File metadata

  • Download URL: desktop-entry-lib-4.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for desktop-entry-lib-4.0.tar.gz
Algorithm Hash digest
SHA256 dfdaa115d3c7285ad7c8c6f3d454b42390c6bb71a1a2c13877c800998353206f
MD5 f5583f37256ff669540b49a282e3399b
BLAKE2b-256 f953a64735d9730c084af8220c417c70ce097d42e1afcadd941827bbf89674a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for desktop_entry_lib-4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83269358bd850313c8e0c8d154b8f0e4240f23cf0096fa28e9126c370719f794
MD5 18fe3987fd620d2491f74bf353bc4766
BLAKE2b-256 dcb0baf6a47a445aa7b343cf5aa23a41a2d88e486d51dbf8771607d6bfecf1e5

See more details on using hashes here.

Supported by

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