go-freedesktop
The freedesktop.org desktop-integration layer, in pure Go. No cgo, no D-Bus C library, no external tools.
go-freedesktop is a family of small, independent Go modules that implement the freedesktop.org specifications a launcher, file manager or desktop shell relies on — enumerating installed applications, resolving icons, classifying files by MIME type, choosing which application opens a type, building the category menu, and serving desktop notifications.
Every module is pure Go, CGO_ENABLED=0, reuses standard XDG base-directory resolution instead of reinventing it, and cross-compiles to a static binary. Each spec is one small module, so a caller pulls in only what it needs. They are the desktop-integration layer beneath go-widgets launchers and shells.
Why go-freedesktop
Talking to a Linux desktop from Go usually means shelling out to gio,
xdg-mime or notify-send, or binding GLib/GIO through cgo.
go-freedesktop implements the underlying freedesktop.org
specifications directly — parsing the same on-disk files and speaking the same
D-Bus interface — in pure Go with cgo disabled. One small module
per spec, reusing standard XDG base-directory resolution, so a launcher, file manager
or shell pulls in only the layer it needs and cross-compiles to a static binary.
Modules
desktopentry
Implements the Desktop Entry spec: enumerate the installed applications and expand their Exec= launch commands (field codes, TryExec, actions) — what a dock or app menu needs.
icontheme
Implements the Icon Theme spec: resolve an icon name to a file path at a target size and scale, following theme inheritance and the hicolor fallback.
mime
Implements the Shared MIME-info Database: resolve a canonical MIME type from a file's name, its content (magic), or both, against the on-disk database.
mimeapps
Implements the MIME Applications Associations spec (mimeapps.list): the default application and the ordered candidate list for a type, with round-trippable edits — the engine behind “Open With…”.
menu
Implements the Desktop Menu spec: turn applications.menu XML into a resolved, categorized tree of app entries (Accessories, Graphics, System, …) for a launcher.
notifications
Implements the Desktop Notifications spec: the org.freedesktop.Notifications D-Bus service side — decode Notify calls and render them as go-widgets Toasts.
docs
Versioned documentation site (MkDocs Material + mike): one page per module with the API surface and usage. Source →
brand
Logos and icons for the organization, in SVG / PNG / JPG / ICO / ICNS across colour, white and black variants.
Quality bar
- Pure Go.
CGO_ENABLED=0across the org — no D-Bus C library, no GLib, no external tools. - Reuse, don't reinvent. XDG base-directory resolution comes from a shared library; later waves build on the earlier ones (
mimeappsandmenustand ondesktopentry). - 100% test coverage is the bar, error branches included, on native amd64/arm64 plus emulated 64-bit targets.
- Spec-faithful. Parses the same on-disk files and speaks the same D-Bus interface as the reference tools, so it interoperates with the rest of the desktop.
- BSD-3-Clause on every source file.