unfallenwill: the dock and the app grid showed a gear for magpie on Linux.
The desktop entry registerScheme writes had no StartupWMClass, and its
Icon=magpie named an icon nothing installed.
What the window reports, from the source (not guessed):
- GTK3 (gtk-3-24): an X11 window's WM_CLASS is (g_get_prgname(),
gdk_get_program_class()), the class being the prgname with its first
letter upper-cased; a Wayland xdg_toplevel's app_id is g_get_prgname(),
falling back to the program class.
- Wails v3.0.0-beta.24 (gtk3 build, which magpie's Linux build uses):
LinuxOptions.ProgramName goes to g_set_prgname before
g_application_run. Without it the prgname is the executable's name,
magpie-linux-amd64 for a release run as downloaded, which no entry names.
So magpie now sets ProgramName "magpie" (internal/gui/desktop.go), making
WM_CLASS ("magpie", "Magpie") and app_id "magpie", and the entry says
StartupWMClass=magpie. An ApplicationID was not used: WebKitGTK keys its
data folder by the prgname (~/.local/share/<prgname>), so "magpie" keeps an
install.sh user's data where it is. A binary run under another name had
its data under that name; keepWebData moves it to ~/.local/share/magpie
before the first webview, unless magpie's folder is there already (Go's
os.Rename refuses an existing directory, which is the guard).
registerScheme also writes a 256px icon to
$XDG_DATA_HOME/icons/hicolor/256x256/apps/magpie.png (temp file and rename,
skipped when the bytes match), and rewrites an earlier entry for the same
executable that lacks StartupWMClass. Flatpak is left alone as before.
install.sh's own entry gets StartupWMClass=magpie too. The icon is
build/icon/gen.go's 256px output (make icons now writes it), the same bytes
as site/public/img/icon-256.png.
Siblings checked: the autostart entry starts the app and needs no
StartupWMClass. The repo has no deb, rpm, AppImage, AUR or flatpak
packaging (#2225 plans deb/rpm); install.sh is the only other entry.
Tests: TestRegisterScheme checks the entry's StartupWMClass and Icon and
the installed PNG (256x256); TestRegisterSchemeBindsAnOlderEntry;
TestKeepWebData (moved, magpie's folder there already, no localstorage);
TestLinuxWindowNamedAsItsEntry (gui build); install.test.mjs asserts the
line. Each was broken by hand and went red: entry without StartupWMClass,
icon not installed, the short-circuit without the StartupWMClass check,
keepWebData returning at once, linuxOptions without ProgramName.
Run: the Linux tests cross-compiled (linux/arm64, nogui) and run in a
busybox container, the whole internal/gui package passing there;
TestLinuxWindowNamedAsItsEntry on darwin; node --test site/install.test.mjs
10/10; gofmt -l clean; go vet -tags nogui ./... for darwin, linux and
windows; the full go test -tags nogui -timeout 45m ./... under pipefail, both
fixes together on origin/main ec6454395: exit 0, 66 packages ok, no FAIL.
Not tried: a real Linux desktop (GNOME or KDE, X11 or Wayland). No such
session was available, so the dock icon itself was not seen; the binding
rests on the GTK and Wails source above. The gtk3-tagged gui build was not
compiled for Linux here (needs cgo and GTK).
10 lines
251 B
Go
10 lines
251 B
Go
//go:build !windows && !linux
|
|
|
|
package gui
|
|
|
|
// registerScheme: the Mac reads the scheme from the bundle's Info.plist.
|
|
func registerScheme() error { return nil }
|
|
|
|
// keepWebData: the Mac's webview keeps its data by the bundle id.
|
|
func keepWebData() {}
|