Commit Graph
5 Commits
Author SHA1 Message Date
yetone 742d6c06e0 gui: on Linux the window and its desktop entry name each other, and the icon is installed (#2626)
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).
2026-10-17 05:33:18 +08:00
TryWorld e85a803eaa fix(gui): skip scheme registration inside Flatpak (#849)
Leave the host desktop entry to the Flatpak package when FLATPAK_ID is set. A sandbox executable path must not replace the native magpie:// handler.

Add Linux cases for absent and existing entries, command suppression, normal registration, and repeated registration. Reference #222; autostart is outside this change.
2026-10-05 10:57:22 +08:00
tobitege 21702d01ff Add German translation; harden paths against unset env vars (#770)
* Add German translation and harden paths against unset env vars

Add a German locale to the GUI, tray menu, usage alerts and website home page, and refuse to start when the home folder is unset or relative so nothing is written under the working folder; the pi plugin no longer adopts the user's PI_CODING_AGENT_DIR, and an inherited APPIMAGE no longer selects portable mode. Scripts refuse to run from the wrong folder or empty a shared out folder, and a new internal/testenv sandboxes every test package from the user's real files, which also fixes the Claude picker and Termux installer tests on Windows.

* Makefile: know magpie's folder by its go.mod, so paths with spaces work

The check compared $(CURDIR) with $(dir $(abspath …)), which make splits on spaces, so a checkout under 'My Projects' or 'John Doe' refused every target. It now reads go.mod relative to the working folder and wants magpie's module there: make -C and a symlinked Makefile work, make -f from another folder still stops before any recipe runs.

* i18n: German for the strings main added since, with a parity test

75 strings main added (group order, patterns, slow-start wait, usage caps, RTK savings …) get their German, and two that main dropped go. gui-de.test.cjs checks, as gui-ja does, that de has every zh string with its placeholders and tags, and that the window reads in German when picked or on a German system.

* appdir: ignore relative folder variables when reading, keep them for children

CheckEnv no longer unsets anything. magpie reads the XDG folders, APPDATA/LOCALAPPDATA and every agent's folder variable through appdir.Getenv/LookupEnv, which pass over a relative value; the environment stays as it is, so the agents magpie starts get the variable as the user set it. That covers what proc.UserPath lends from the login shell too, which is set after main's check and reached the desktop app unchecked. On Windows a path rooted on the current drive (\Users\x, Git Bash's /c/x) counts as usable, and magpie version and help answer without a home, before run makes any folder.

* Sandbox the tests main added since

internal/wslrun gets testenv's TestMain, and four tests main added that set HOME alone set their home with testenv.SetHome, so on Windows they don't read the runner's profile through USERPROFILE.

* agentenv: PI_CONFIG_DIR and OPENCODE_DB take relative names on purpose

omp puts $PI_CONFIG_DIR under the home and OpenCode a relative $OPENCODE_DB in its data folder, so neither depends on the working folder: appdir no longer passes them over.

* i18n: German for the Library's multi-select and System One's decision API

The 19 strings main added since (#791's skill multi-select, the decision API snippets) get their German; the one main replaced (four APIs → five APIs) goes.

* appdir: tidy the import into magpie's group; say what Go makes of /c/x

The appdir import joins the group of magpie's own imports where a file has one. rooted's comment now says that Go takes a Git Bash path like /c/x as \c\x on the current drive, not C:\x.
2026-10-04 23:30:56 +08:00
yetone e8b3be572c windows: the desktop app no longer opens a console window for every command it runs (#54) — it is linked as a GUI program and has no console, so each console CLI it started (devin auth status and models list, devin acp for every Devin turn, claude, codex, cursor-agent and grok probes and runs, grok login) was given a new console by Windows, and a Windows Terminal window with it, some every few seconds while the app sat idle. Every command magpie runs is now made through internal/proc, which starts it with CREATE_NO_WINDOW when magpie has no console of its own: the child gets a console without a window, and its output, which magpie always pipes back, arrives as before. A magpie run in a terminal (magpie serve, the TUI, the desktop app started from one with a command) has one, and its children share it as they did, so Ctrl+C there still reaches them. The relaunch after an update keeps its DETACHED_PROCESS, added to rather than replacing the flags it was made with, and a test fails on any command made with os/exec directly, so a new one can't bring the windows back 2026-09-25 14:04:44 +08:00
yetone 4bd3f3a4b5 import: magpie://import links add a provider after the user confirms
A vendor or relay can hand out a ready-made provider as a link. The app
registers the magpie scheme (Info.plist on macOS, HKCU on Windows, a
.desktop handler on Linux), a second launch hands the link to the running
one, and the window shows what the link would add, with the hosts the
prompts and key would go to, before anything is saved. `magpie import`
does the same in a terminal.
2026-09-24 12:17:45 +08:00