Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(linux): keep meeting notifications clickable after the first hover (#1562)

Gabriel Stein274a6b26f089
diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.js
index 2c1efdf2d..3e555366f 100644
--- a/src/helpers/windowManager.js
+++ b/src/helpers/windowManager.js
@@ -141,13 +141,19 @@ class WindowManager {
if (!win || win.isDestroyed() || sender !== win.webContents) {
return;
}
+ // Linux ignores the `forward` option, so a card returned to click-through
+ // there never sees another mouseenter and Start/Dismiss stay unreachable
+ // for the rest of its life (#1456). It is only click-through on macOS to
+ // begin with, so on Linux leave the hit-testing alone and move the
+ // countdown alone.
+ const togglesClickThrough = process.platform !== "linux";
// Hovering means the user is reading or about to click — the auto-dismiss
// countdown must not close the card under their pointer.
if (interactive) {
- win.setIgnoreMouseEvents(false);
+ if (togglesClickThrough) win.setIgnoreMouseEvents(false);
this._notificationDismissTimer.pause();
} else {
- win.setIgnoreMouseEvents(true, { forward: true });
+ if (togglesClickThrough) win.setIgnoreMouseEvents(true, { forward: true });
this._notificationDismissTimer.resume();
}
}
diff --git a/test/helpers/notificationInteractivity.test.js b/test/helpers/notificationInteractivity.test.js
new file mode 100644
index 000000000..5dac80c1d
--- /dev/null
+++ b/test/helpers/notificationInteractivity.test.js
@@ -0,0 +1,79 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+
+// setNotificationInteractivity has two jobs: hit-testing and the auto-dismiss
+// countdown. On Linux only the first has to be skipped — Electron ignores the
+// `forward` option there, so a card put back into click-through never receives
+// another mouseenter and its Start/Dismiss buttons die with it (#1456).
+// Skipping the countdown too would let the card close under the pointer.
+const setNotificationInteractivity = (platform, win, timer, interactive) => {
+ const togglesClickThrough = platform !== "linux";
+ if (interactive) {
+ if (togglesClickThrough) win.setIgnoreMouseEvents(false);
+ timer.pause();
+ } else {
+ if (togglesClickThrough) win.setIgnoreMouseEvents(true, { forward: true });
+ timer.resume();
+ }
+};
+
+const harness = () => {
+ const calls = { ignoreMouseEvents: [], timer: [] };
+ return {
+ calls,
+ win: {
+ setIgnoreMouseEvents: (ignore, opts) => calls.ignoreMouseEvents.push({ ignore, opts }),
+ },
+ timer: {
+ pause: () => calls.timer.push("pause"),
+ resume: () => calls.timer.push("resume"),
+ },
+ };
+};
+
+test("Linux never returns the card to click-through", () => {
+ const { calls, win, timer } = harness();
+
+ setNotificationInteractivity("linux", win, timer, true);
+ setNotificationInteractivity("linux", win, timer, false);
+
+ assert.deepEqual(calls.ignoreMouseEvents, []);
+});
+
+test("Linux still pauses and resumes the dismiss countdown", () => {
+ const { calls, win, timer } = harness();
+
+ setNotificationInteractivity("linux", win, timer, true);
+ setNotificationInteractivity("linux", win, timer, false);
+
+ // The earlier proposed fix returned early on Linux and lost this.
+ assert.deepEqual(calls.timer, ["pause", "resume"]);
+});
+
+for (const platform of ["darwin", "win32"]) {
+ test(`${platform} keeps the existing click-through behaviour`, () => {
+ const { calls, win, timer } = harness();
+
+ setNotificationInteractivity(platform, win, timer, true);
+ setNotificationInteractivity(platform, win, timer, false);
+
+ assert.deepEqual(calls.ignoreMouseEvents, [
+ { ignore: false, opts: undefined },
+ { ignore: true, opts: { forward: true } },
+ ]);
+ assert.deepEqual(calls.timer, ["pause", "resume"]);
+ });
+}
+
+test("repeated hovers on Linux stay interactive, so the buttons survive", () => {
+ const { calls, win, timer } = harness();
+
+ for (let i = 0; i < 3; i++) {
+ setNotificationInteractivity("linux", win, timer, true);
+ setNotificationInteractivity("linux", win, timer, false);
+ }
+
+ assert.deepEqual(calls.ignoreMouseEvents, []);
+ assert.equal(calls.timer.filter((c) => c === "pause").length, 3);
+ assert.equal(calls.timer.filter((c) => c === "resume").length, 3);
+});