Repository navigation
[v3/Linux] Use one application ID across packaging, runtime and services #6553
manuelschoene
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
On Linux, the identity of a Wails v3 app is derived in several places that do not know about each other. Packaging names the
.desktopfile afterBinaryName.wails3 generate .desktopuses a lowercasedName. The GTK/Wayland runtime usesLinux.ApplicationID(or a derivedorg.wails.<name>). Services like notifications use the rawName. Nothing keeps these in sync, so an app can end up with a.desktopfile, a Waylandapp_id, and a config directory that all use different names.I'd like to agree on one application ID that packaging, runtime, and services all use before I open some smaller Linux PRs that depend on it (see "Related work" below).
Current state (v3.1.0)
Build time
wails.yamlproject.identifier/config.ymlproductIdentifierapplicationId(internal/commands/manifest_pipeline.go), not on Linux. The template default iscom.mycompany.myproduct..desktopfile<BinaryName>.desktop(internal/commands/manifest_pipeline.go,manifest_void.go)wails3 generate .desktopnormaliseName(Name)= lowercase, spaces →-(internal/commands/dot_desktop.go,build-assets.go)StartupWMClassin the.desktoptemplate{{.BinaryName}}(internal/commands/updatable_build_assets/linux/desktop.tmpl)Runtime
GtkApplicationID / D-Bus nameLinux.ApplicationID, ororg.wails.<sanitizeAppName(Name)>(pkg/application/application_linux_appid.go)app_id(viag_set_prgname)Linux.ProgramName, elseLinux.ApplicationIDif set, else the executable nameapp_nameand category storageName; categories are saved to$XDG_CONFIG_HOME/<Name>/notification-categories.json(pkg/services/notifications/notifications_linux.go)Also, the effective application ID is computed in
newPlatformAppand then dropped.App.Config().Linux.ApplicationIDonly returns what the developer set explicitly, so services cannot get the derived fallback.There might be other places where the application ID might be useful, and I may have missed them.
Why this is a problem
.desktopfile usingapp_id. If a developer setsLinux.ApplicationID = "com.example.MyApp", theapp_idbecomescom.example.MyApp, but the packaged file is still<BinaryName>.desktopwithStartupWMClass=<BinaryName>. The window then shows a generic icon and is not grouped with its launcher.<app-id>.desktop, and theapp_idmust match it. Today that only works if the developer setsLinux.ApplicationID, renames the.desktopfile themselves, and keeps the two in step by hand.desktop-entryhint, which shells use for per-app notification settings and icons, cannot be set reliably because it's unclear which name is the "real" desktop ID.Nameproduces paths like~/.config/My Cool App/. An emptyNamewrites directly into~/.config/, and aNamecontaining/or..creates nested directories or paths outside~/.config/.com.mycompany.myproductand the runtime side defaults toorg.wails.<name>.Proposal
Make one application ID the source of truth on Linux, and derive the other names from it.
Expose the effective ID at runtime. Add a getter (e.g.,
App.ApplicationID()) or store the resolved value back in the config, so services can use the same ID that GTK uses, including the fallback. This is small and backward compatible.Connect build time and runtime. Options to discuss:
project.identifieras the default forLinux.ApplicationID(e.g. via-ldflags -Xor generated code). An explicitLinux.ApplicationIDin code still wins.Linux.ApplicationIDin code as the source and have packaging read it. This is harder, because the pipeline has no access to runtimeOptions.wails3 doctoror the build warn when they differ.I'd lean towards A:
project.identifieralready exists, is used on macOS and Android, and is visible to packaging.Name Linux artifacts after the ID. Packaging produces
<app-id>.desktopwithStartupWMClass=<app-id>. Services use the ID for thedesktop-entryhint and for per-app paths such as$XDG_CONFIG_HOME/<app-id>/.Compatibility
Changing any of these names affects existing installs:
~/.config/<Name>/need a fallback that reads the legacy path..desktopfile changes the desktop ID that GNOME and KDE use for per-app settings (notifications, autostart, favorites). That can be acceptable for packaged releases, but it should be called out in the release notes.org.wails.<name>/com.mycompany.myproductto whatever the unified default becomes, so the default needs care.Phasing it in (step 1 first, then the opt-in behavior, then changing defaults) would keep each step reviewable.
Related work
I'm planning these Linux PRs. They'd use the ID from step 1:
desktop-entryhint on notifications.$XDG_CONFIG_HOME/<Name>/, tighten permissions to0700/0600, and fall back to the legacy path.Windows has a similar pattern (registry path
HKCU\SOFTWARE\<Name>\…, the toast AUMID, and the%TEMP%icon file all use the rawName). I've left it out of scope here, but the same ID could apply there later.Questions for maintainers
.desktopfile in a minor/nightly release, or does that need to wait for a specific milestone?All reactions