go-desktopenv

module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MIT

README

go-desktopenv

Go


What a packaged Go desktop app needs to reach its desktop: xdg-desktop-portal calls, Flatpak detection and host commands, per-user folders, console-less Windows children, Desktop Entry Exec values, an AppImage-free child environment, installed fonts, the system accent colour and Windows shortcut files. Module github.com/Rethunk-Tech/go-desktopenv, nine packages: portal, flatpak, userdirs, desktopentry, nowindow, hostenv, fonts, sysaccent and lnk. Import only the ones you need; portal pulls in godbus, lnk go-ole on Windows, and nowindow, fonts and sysaccent golang.org/x/sys on Windows. The rest pull in no third-party code.

A Flatpak app needs --talk-name=org.freedesktop.Flatpak for flatpak; portals need nothing extra. A portal call waits on a user dialog until its context ends, so set a deadline. RetrieveSecret works only inside a Flatpak.

Quick start

go get github.com/Rethunk-Tech/go-desktopenv

A worked example and the contracts: HUMANS.md.

Features

  • portal: autostart, launchers, the per-app secret and desktop settings, each bounded by your context
  • flatpak: detect a sandbox, run or build a command for the host, end the host child on cancel
  • userdirs: config and data folders per home, honouring only absolute environment values for the real home
  • desktopentry: escape, build and read Desktop Entry Exec= values
  • nowindow: no console window for a console child of a Windows GUI process
  • hostenv: a child process's environment without what an AppImage's AppRun injected
  • fonts: the installed font families, from fontconfig or the Windows registry
  • sysaccent: the desktop's accent colour as #rrggbb, from the DWM or the Settings portal
  • lnk: write a Windows .lnk with target, arguments, working folder, icon and description, read its arguments, list a folder's shortcuts

Documentation

Doc Audience
HUMANS.md Running and using the package
AGENTS.md Internals, invariants, and why
CONTRIBUTING.md Process — commits, tests, docs
SECURITY.md Vulnerability disclosure
CHANGELOG.md Release notes

License

MIT — see LICENSE. © 2026 Rethunk.Tech, LLC.

Directories

Path Synopsis
Package desktopentry escapes and reads the string values of a freedesktop Desktop Entry file, chiefly the Exec key.
Package desktopentry escapes and reads the string values of a freedesktop Desktop Entry file, chiefly the Exec key.
Package flatpak detects a Flatpak sandbox and runs commands on the host from inside one.
Package flatpak detects a Flatpak sandbox and runs commands on the host from inside one.
Package fonts lists the font families installed on this computer.
Package fonts lists the font families installed on this computer.
Package hostenv gives child processes the environment the program was started from, minus what an AppImage's AppRun injected for the bundle's own libraries.
Package hostenv gives child processes the environment the program was started from, minus what an AppImage's AppRun injected for the bundle's own libraries.
Package lnk writes and reads Windows .lnk shortcut files, the Windows counterpart of package desktopentry.
Package lnk writes and reads Windows .lnk shortcut files, the Windows counterpart of package desktopentry.
Package nowindow starts console programs from a GUI process without a console window.
Package nowindow starts console programs from a GUI process without a console window.
Package portal calls the xdg-desktop-portal interfaces a Flatpak app uses instead of writing host folders: the Background portal for starting at sign-in, DynamicLauncher for desktop launchers, Secret for a per-app master secret, and Settings for desktop appearance values.
Package portal calls the xdg-desktop-portal interfaces a Flatpak app uses instead of writing host folders: the Background portal for starting at sign-in, DynamicLauncher for desktop launchers, Secret for a per-app master secret, and Settings for desktop appearance values.
Package sysaccent reads the accent colour the operating system's desktop is set to.
Package sysaccent reads the accent colour the operating system's desktop is set to.
Package userdirs answers where a user's config and data folders are for a given home.
Package userdirs answers where a user's config and data folders are for a given home.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL