Metadata-Version: 2.1
Name: desktop-entry-lib
Version: 4.0
Summary: A library for working with .desktop files
Author-email: JakobDev <jakobdev@gmx.de>
License: BSD-2-Clause
Project-URL: Source, https://codeberg.org/JakobDev/desktop-entry-lib
Project-URL: Issues, https://codeberg.org/JakobDev/desktop-entry-lib/issues
Project-URL: Documentation, https://desktop-entry-lib.readthedocs.io
Project-URL: Donation, https://ko-fi.com/jakobdev
Keywords: JakobDev,Linux,Freedesktop,.desktop
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Environment :: Other Environment
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: BSD
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE

# desktop-entry-lib

![PyPI](https://img.shields.io/pypi/v/desktop-entry-lib)
![PyPI - Downloads](https://img.shields.io/pypi/dm/desktop-entry-lib)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/desktop-entry-lib)
![PyPI - License](https://img.shields.io/pypi/l/desktop-entry-lib)
![PyPI - Implementation](https://img.shields.io/pypi/implementation/desktop-entry-lib)
![Read the Docs](https://img.shields.io/readthedocs/desktop-entry-lib)

desktop-entry-lib allows reading and writing .desktop files according to the [Desktop Entry Specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html)

```python
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](https://flatpak.org)
- The whole lib is a single file
- Supports [PyPy](https://www.pypy.org)

[Read the documentation](https://desktop-entry-lib.readthedocs.io)


