DESKTOPTOJSON(8)

πŸ“¦
version 5.116.0 Β· 2 versions
  • 5.116.0 Β· debian bookworm, debian trixie, epel 9, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 5.116.0 Β· alpine 3.24
, in debian bookworm, debian trixie, epel 9, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’… DESKINTOJSON... wait, desktoptojson β€” NAME ✨

okay bestie, say hi to desktoptojson β€” the KDE Frameworks: KService little icon that converts a .desktop file to a .json file. that's it, that's the job, and it does it flawlessly πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

desktoptojson --input DESKTOP-FILE --output JSON-FILE

desktoptojson {--version | --help}

like. two modes. do the conversion, or ask it who it is. simple as that πŸŽ€


✨ DESCRIPTION ✨

so here's the lore, bestie πŸ‘‘ the KService framework uses the info sitting inside .desktop files to locate services, including plugins for Qt5-based applications and libraries. but the Qt5 plugin system? it doesn't do .desktop files at all β€” it uses JSON data embedded in the plugin itself 😭

and that is literally the whole reason desktoptojson exists: it lets the info in a .desktop file also be used as the embedded data for a Qt5 plugin, by converting the .desktop file entries into JSON data. iconic behavior, truly 🫢

now, the generated JSON data is a JSON object that maps the entries from the [Desktop Entry] group of the .desktop file. any other groups? ignored. not invited to the party πŸ™ˆ

most entries just get converted to JSON strings, but some entries (like Hidden and X-KDE-PluginInfo-EnabledByDefault) are known to be boolean values and get converted as such. and similarly, some entries (like X-KDE-ServiceTypes and X-KDE-PluginInfo-Depends) are always converted to arrays of strings. no cap πŸ’―


🌸 OPTIONS 🌸

  • --input DESKTOP-FILE β€” the .desktop file to convert. the source material, the moment, the muse πŸ’–
  • --output JSON-FILE β€” the file to write the generated JSON data to. where the magic lands ✨
  • --help β€” show a brief help text. a lil recap for when you forgot πŸŽ€
  • --version β€” show version information. identity check πŸͺž

🌈 USAGE 🌈

okay so most users of this utility are gonna be using the CMake macro kservice_desktop_to_json as part of the process of building a plugin. it's giving automation, it's giving build-system energy 🧚

add_library(myplugin MODULE ${myplugin_SRCS})
kservice_desktop_to_json(myplugin myplugin.desktop)

this will produce the JSON file myplugin.json, which can be referenced from the K_PLUGIN_FACTORY_WITH_JSON or Q_PLUGIN_METADATA macros. slay πŸ’…


πŸ’€ BUGS πŸ’€

found something cursed? please use KDE's bugtracker[1] to report bugs. they wanna know, fr fr πŸ™


πŸ‘‘ AUTHORS πŸ‘‘

  • Scarlett Clark <scarlett@scarlettgatelyclark.com>
    • wrote the original documentation. the blueprint, the blueprint-er πŸ’œ
  • Alex Merry <alexmerry@kde.org>
    • edited the documentation. the glow-up era ✨

πŸ“ NOTES πŸ“

  1. KDE's bugtracker https://bugs.kde.org

and that's the whole page, bestie πŸ₯° this was KDE Frameworks Frameworks 5.0, dated 2014-04-02, living under section 8 of the manual β€” DESKTOPTOJSON(8), periodt. go convert something cute πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from