Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gui: on Linux without gst-plugins-good the masking demo shows her poster

yetoneb90e81da14ec
diff --git a/internal/gui/api.go b/internal/gui/api.go
index 3d13c80c7..434b42cec 100644
--- a/internal/gui/api.go
+++ b/internal/gui/api.go
@@ -403,6 +403,9 @@ type settingsJSON struct {
GatewayOn bool `json:"gatewayOn,omitempty"`
GatewayWhy string `json:"gatewayWhy,omitempty"`
Web bool `json:"web,omitempty"`
+ // NoVideo: this app's webview would crash on a <video> (Linux without
+ // gst-plugins-good, webkitPlaysVideo), so the pages show no video
+ NoVideo bool `json:"noVideo,omitempty"`
// the proxy vendor requests go through now, and where it came from:
// settings, environment, system, off or none
ProxyNow string `json:"proxyNow"`
@@ -627,6 +630,7 @@ func settingsState() settingsJSON {
}
s.WSL = runtime.GOOS == "windows"
s.Web = webPage.Load()
+ s.NoVideo = !s.Web && !webkitPlaysVideo()
s.GatewayOn, s.GatewayWhy = gatewayMode(s.Web)
s.LANKey = "" // the retained credential belongs on disk, not in UI state
// the GitHub token, masked, and where the library's requests take one
diff --git a/internal/gui/assets/plugins/redact/demo.js b/internal/gui/assets/plugins/redact/demo.js
index ff7a968cd..3e4869a40 100644
--- a/internal/gui/assets/plugins/redact/demo.js
+++ b/internal/gui/assets/plugins/redact/demo.js
@@ -8,7 +8,8 @@
// sheets, the notebook and the boxes are the page's, moved over her. The
// video is fetched when the row is first opened, never before. It plays
// while the row is open and on screen, once through, and rests on its last
-// step; with reduced motion it starts there.
+// step; with reduced motion it starts there. Where the app's webview would
+// crash on a video (state.settings.noVideo), she is her poster.
const XQD_END = 27.5;
const XQD_STEPS = [
@@ -368,7 +369,7 @@ function maskDemoBuild(body) {
if (th === theme) return;
theme = th;
vid.poster = `plugins/redact/xq_${th}.jpg`;
- vid.src = `plugins/redact/xq_${th}.webm`;
+ if (!state.settings?.noVideo) vid.src = `plugins/redact/xq_${th}.webm`;
// a new source starts paused: it goes on where the old one was
seek(T);
wake();
diff --git a/internal/gui/tests/masking-demo.test.cjs b/internal/gui/tests/masking-demo.test.cjs
index a3d5661c0..55000193d 100644
--- a/internal/gui/tests/masking-demo.test.cjs
+++ b/internal/gui/tests/masking-demo.test.cjs
@@ -18,8 +18,8 @@ const K = "1792987654321000001";
const record = { key: K, t: new Date(Date.now() - 60e3).toISOString(), route: "messages", what: "chat", agent: "claude", provider: "anthropic", model: "claude-opus-4-1", n: 1,
values: [{ p: "{{PERSON_bbbb2222}}", k: "PERSON", b: "model", h: "", l: 3, n: 1 }], snips: { "{{PERSON_bbbb2222}}": "ask {{PERSON_bbbb2222}} about it" } };
-function serve(lang, theme, fetched) {
- const settings = { theme, lang, tray: "panel", currency: "usd", redact: true, redactPersonal: true };
+function serve(lang, theme, fetched, more) {
+ const settings = { theme, lang, tray: "panel", currency: "usd", redact: true, redactPersonal: true, ...more };
return async (route) => {
const req = route.request(), url = new URL(req.url());
const json = (data) => route.fulfill({ json: data });
@@ -56,7 +56,7 @@ async function open(engine, lang, width, opts = {}) {
page.setDefaultTimeout(8000);
const errors = [], fetched = [];
page.on("pageerror", (e) => errors.push(e.message));
- await page.route("**/*", serve(lang, opts.theme || "light", fetched));
+ await page.route("**/*", serve(lang, opts.theme || "light", fetched, opts.settings));
await page.goto("http://magpie.test/?view=masking");
await page.locator("#mdRow").waitFor();
return { browser, page, errors, fetched };
@@ -217,6 +217,21 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await until(async () => { const s = await state(page); return !s.paused && s.ct > a.T + .5 && Math.abs(s.ct - s.T) < .3; }, 8000, page);
assert.deepEqual(errors, []);
});
+ // on Linux without gst-plugins-good WebKitGTK's web process aborts on any
+ // video (stock Omarchy), so there she is her poster and the sheets still move
+ test(`${engine}: where the app can't play video she is her poster, and the demo still plays`, async (t) => {
+ const { browser, page, errors, fetched } = await open(engine, "en", 1100, { motion: true, settings: { noVideo: true } });
+ t.after(() => browser.close());
+ await page.locator("#mdRow").click();
+ await until(async () => (await state(page)).T > 1, 8000, page);
+ await page.evaluate(() => { document.documentElement.dataset.theme = "dark"; });
+ await until(() => fetched.includes("xq_dark.jpg"));
+ assert.deepEqual(await page.evaluate(() => { const v = document.querySelector(".xqd video"); return [v.getAttribute("src"), v.poster.split("/").pop()]; }), [null, "xq_dark.jpg"]);
+ assert.deepEqual(fetched.filter((f) => f.endsWith(".webm")), []);
+ const a = await state(page);
+ await until(async () => (await state(page)).T > a.T + .5, 8000, page);
+ assert.deepEqual(errors, []);
+ });
}
// her background is the card's: the video's own corners, against the card
diff --git a/internal/gui/webkit_linux.go b/internal/gui/webkit_linux.go
index 3fd73c5d6..a6776c3a9 100644
--- a/internal/gui/webkit_linux.go
+++ b/internal/gui/webkit_linux.go
@@ -3,6 +3,8 @@ package gui
import (
"os"
"path/filepath"
+ "strings"
+ "sync"
)
// webkitDefaults sets how WebKitGTK draws the pages before the app makes
@@ -57,3 +59,45 @@ func renderNodeOpens(nodes []string, open func(string) error) bool {
}
return false
}
+
+// webkitPlaysVideo is whether WebKitGTK can play a <video> here. It gives
+// every video, a muted one too, an audio sink it makes with autoaudiosink,
+// from gst-plugins-good; where that isn't installed (stock Omarchy has only
+// -base and -bad) it gets none, and its web process aborts a moment after
+// the video starts loading, which leaves the window blank. GStreamer keeps
+// the element in libgstautodetect.so. A system with no plugin folder magpie
+// knows of says nothing either way, and plays.
+var webkitPlaysVideo = sync.OnceValue(func() bool {
+ return gstAutodetect(gstPluginDirs(os.Getenv), func(p string) bool { _, err := os.Stat(p); return err == nil })
+})
+
+// gstPluginDirs is where GStreamer looks for plugins: the folders its
+// variables name, and the system's own.
+func gstPluginDirs(getenv func(string) string) []string {
+ var dirs []string
+ for _, k := range []string{"GST_PLUGIN_SYSTEM_PATH_1_0", "GST_PLUGIN_SYSTEM_PATH", "GST_PLUGIN_PATH_1_0", "GST_PLUGIN_PATH"} {
+ for _, d := range strings.Split(getenv(k), ":") {
+ if d != "" {
+ dirs = append(dirs, d)
+ }
+ }
+ }
+ for _, g := range []string{"/usr/lib*/gstreamer-1.0", "/usr/lib*/*/gstreamer-1.0", "/usr/local/lib*/gstreamer-1.0", "/usr/local/lib*/*/gstreamer-1.0"} {
+ m, _ := filepath.Glob(g)
+ dirs = append(dirs, m...)
+ }
+ return dirs
+}
+
+// gstAutodetect is false only when GStreamer's core plugins are there and
+// autoaudiosink is in none of the folders.
+func gstAutodetect(dirs []string, exists func(string) bool) bool {
+ found := false
+ for _, d := range dirs {
+ if exists(filepath.Join(d, "libgstautodetect.so")) {
+ return true
+ }
+ found = found || exists(filepath.Join(d, "libgstcoreelements.so"))
+ }
+ return !found
+}
diff --git a/internal/gui/webkit_linux_test.go b/internal/gui/webkit_linux_test.go
index 5dff30519..bcec77a34 100644
--- a/internal/gui/webkit_linux_test.go
+++ b/internal/gui/webkit_linux_test.go
@@ -2,6 +2,7 @@ package gui
import (
"errors"
+ "slices"
"testing"
)
@@ -61,3 +62,35 @@ func TestRenderNodeOpens(t *testing.T) {
}
}
}
+
+// WebKitGTK's web process aborts on any video where autoaudiosink is
+// missing (stock Omarchy: gst-plugins-base and -bad, no -good), so video is
+// off only there; with GStreamer's folder not found, nothing is known and
+// video stays on.
+func TestGstAutodetect(t *testing.T) {
+ for _, c := range []struct {
+ name string
+ files []string
+ want bool
+ }{
+ {"plugins-good installed", []string{"/usr/lib/gstreamer-1.0/libgstcoreelements.so", "/usr/lib/gstreamer-1.0/libgstautodetect.so"}, true},
+ {"stock omarchy", []string{"/usr/lib/gstreamer-1.0/libgstcoreelements.so", "/usr/lib/gstreamer-1.0/libgsttheora.so"}, false},
+ {"good in a folder the variable names", []string{"/usr/lib/gstreamer-1.0/libgstcoreelements.so", "/opt/gst/libgstautodetect.so"}, true},
+ {"no gstreamer folder found", nil, true},
+ } {
+ have := map[string]bool{}
+ for _, f := range c.files {
+ have[f] = true
+ }
+ if got := gstAutodetect([]string{"/opt/gst", "/usr/lib/gstreamer-1.0"}, func(p string) bool { return have[p] }); got != c.want {
+ t.Errorf("%s: gstAutodetect = %v, want %v", c.name, got, c.want)
+ }
+ }
+ env := map[string]string{"GST_PLUGIN_PATH_1_0": "/opt/gst:/opt/more", "GST_PLUGIN_SYSTEM_PATH": "/sys/gst"}
+ dirs := gstPluginDirs(func(k string) string { return env[k] })
+ for _, d := range []string{"/opt/gst", "/opt/more", "/sys/gst"} {
+ if !slices.Contains(dirs, d) {
+ t.Errorf("gstPluginDirs = %v, missing %s", dirs, d)
+ }
+ }
+}
diff --git a/internal/gui/webkit_other.go b/internal/gui/webkit_other.go
index e42e05301..f64d7672a 100644
--- a/internal/gui/webkit_other.go
+++ b/internal/gui/webkit_other.go
@@ -4,3 +4,6 @@ package gui
// webkitDefaults: only Linux's webview is WebKitGTK.
func webkitDefaults() {}
+
+// webkitPlaysVideo: the other systems' webviews play video.
+func webkitPlaysVideo() bool { return true }