# 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)
Raw data
{
"_id": null,
"home_page": "",
"name": "desktop-entry-lib",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "JakobDev,Linux,Freedesktop,.desktop",
"author": "",
"author_email": "JakobDev <jakobdev@gmx.de>",
"download_url": "https://files.pythonhosted.org/packages/53/ff/5ba12bda1f27511d8e005e68bf5cf233a356a2f8590c69068a6107089b57/desktop-entry-lib-4.1.tar.gz",
"platform": null,
"description": "# desktop-entry-lib\n\n![PyPI](https://img.shields.io/pypi/v/desktop-entry-lib)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/desktop-entry-lib)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/desktop-entry-lib)\n![PyPI - License](https://img.shields.io/pypi/l/desktop-entry-lib)\n![PyPI - Implementation](https://img.shields.io/pypi/implementation/desktop-entry-lib)\n![Read the Docs](https://img.shields.io/readthedocs/desktop-entry-lib)\n\ndesktop-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)\n\n```python\nimport desktop_entry_lib\n\n\ndef write() -> None:\n entry = desktop_entry_lib.DesktopEntry()\n\n entry.Name.default_text = \"My App\"\n entry.Comment.default_text = \"A short description\"\n entry.Comment.translations[\"de\"] = \"A short german description\"\n entry.Type = \"Application\"\n entry.Exec = \"my-app\"\n\n entry.write_file(\"my_app.desktop\")\n\n\ndef read() -> None:\n entry = desktop_entry_lib.DesktopEntry.from_file(\"my_app.desktop\")\n\n print(\"Name: \" + entry.Name.default_text)\n print(\"Comment: \" + entry.Comment.default_text)\n print(\"German translation for Comment: \" + entry.Comment.translations.get(\"de\", \"None\"))\n print(\"Type: \" + entry.Type)\n print(\"Exec: \" + entry.Exec)\n\n\nif __name__ == \"__main__\":\n write()\n read()\n```\n\nFeatures:\n- Fully static typed\n- No external dependencies\n- Full Documentation and Examples available\n- Support running inside a [Flatpak](https://flatpak.org)\n- The whole lib is a single file\n- Supports [PyPy](https://www.pypy.org)\n\n[Read the documentation](https://desktop-entry-lib.readthedocs.io)\n\n\n",
"bugtrack_url": null,
"license": "BSD-2-Clause",
"summary": "A library for working with .desktop files",
"version": "4.1",
"project_urls": {
"Documentation": "https://desktop-entry-lib.readthedocs.io",
"Donation": "https://ko-fi.com/jakobdev",
"Issues": "https://codeberg.org/JakobDev/desktop-entry-lib/issues",
"Source": "https://codeberg.org/JakobDev/desktop-entry-lib"
},
"split_keywords": [
"jakobdev",
"linux",
"freedesktop",
".desktop"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ca2cec04489884bd41970c3c89b118ebd070ca14d6bd1043227ed6cc3d442578",
"md5": "51fde1516a859c0b91564d0ac582811f",
"sha256": "669ef15383214b0f7bfba638d1ae9875d9a46c8ff7fb7f9124bf31b141c889bb"
},
"downloads": -1,
"filename": "desktop_entry_lib-4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "51fde1516a859c0b91564d0ac582811f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 10550,
"upload_time": "2023-12-18T19:44:37",
"upload_time_iso_8601": "2023-12-18T19:44:37.102996Z",
"url": "https://files.pythonhosted.org/packages/ca/2c/ec04489884bd41970c3c89b118ebd070ca14d6bd1043227ed6cc3d442578/desktop_entry_lib-4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "53ff5ba12bda1f27511d8e005e68bf5cf233a356a2f8590c69068a6107089b57",
"md5": "dac9b27675b82083bef71313813b9dd8",
"sha256": "bbeb6c8706d838b905cc1c0d37db707a0e622b9aacc7cf4b64b6834afc25e3ed"
},
"downloads": -1,
"filename": "desktop-entry-lib-4.1.tar.gz",
"has_sig": false,
"md5_digest": "dac9b27675b82083bef71313813b9dd8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 14534,
"upload_time": "2023-12-18T19:44:38",
"upload_time_iso_8601": "2023-12-18T19:44:38.924109Z",
"url": "https://files.pythonhosted.org/packages/53/ff/5ba12bda1f27511d8e005e68bf5cf233a356a2f8590c69068a6107089b57/desktop-entry-lib-4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-18 19:44:38",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": true,
"codeberg_user": "JakobDev",
"codeberg_project": "desktop-entry-lib",
"lcname": "desktop-entry-lib"
}