ovis icon indicating copy to clipboard operation
ovis copied to clipboard

Desktop (Electron): a lone Alt reveals the hidden menu bar over the pane; no opt-out

Open NicoLeo13 opened this issue 6 days ago • 2 comments

What happened

  1. In the Ovis Electron desktop app on Fedora 44 (KDE/Wayland), focus a terminal pane and press Alt by itself, or start an Alt chord meant for the agent in the pane (for example pi).
  2. The app's top menu bar pops open over the window, and the Alt press is spent on that native menu.

Expected: a lone Alt reaches the pane without a native menu popping up, or at least an opt-out for users who need Alt free.

How often

Every time

Ovis version

Desktop AppImage 0.5.11; the same window options are still present in the v0.5.12 source.

How it runs

Desktop app (Electron AppImage) with the herdr plugin server at 127.0.0.1:7317

Server PC

Fedora Linux 44 x86_64, herdr 0.9.5

Device and browser

Fedora 44, KDE on Wayland, Ovis desktop AppImage (Electron)

Why

  • app/electron/src/main.ts:357 creates the window with autoHideMenuBar: true (also at :384 for the second window). v0.5.12 keeps both.
  • Electron documents that with an auto-hidden menu bar, the menu bar "will only show when users press the single Alt key" (https://github.com/electron/electron/blob/main/docs/api/browser-window.md).
  • createMenu() installs a normal application menu (app/electron/src/main.ts:496-512). There is no Alt exception, no before-input-event handling for it and no setAutoHideMenuBar(false) path in the Electron code.
  • This is independent of Settings → Shortcuts. #4793 (released in v0.5.12) lets Hold message in chat and Dictate (hold) be turned Off, but that only changes the web page's key handlers; it cannot change what Electron's window does with a lone Alt.
  • #4653 mentioned this Electron behavior but was closed by #4793 without changing it, and no open issue covers it.

Proposal

  1. Add an opt-out (for example Desktop → Alt shows the menu bar, default on). When off, call win.setAutoHideMenuBar(false) and hide or remove the application menu so a lone Alt stays available to the pane. Keep File/View commands reachable from the tray menu, which already holds Open in Browser and Quit Ovis.
  2. Or suppress the reveal while a terminal pane has focus (renderer → main IPC), and restore it when focus leaves, so the menu remains available elsewhere.

Either way the setting should say what it costs: removing the application menu also hides Reload, Zoom and DevTools from the menu bar.

Related: #4653, #4793.

NicoLeo13 avatar Nov 27 '26 12:11 NicoLeo13

Extra evidence for the native-window part: in the 0.5.11 web UI (headless Chromium, 1280 px), with a terminal pane focused, Alt+K reaches the page as keydown(code=KeyK, altKey=true) and Ovis sends {"type":"input","pane_id":"...","text":"\u001bk"} over the socket (plain k goes as "k", Alt+Enter as "\u001b\r"). So the web layer does encode Alt chords; the chord is lost before the page in the Electron window, where the lone Alt reveals the menu bar and the following key goes to that menu instead of the pane. This is why the app shows the top toolbar and the TUI never sees Alt+K. It is separate from #4793's Off setting for the two web shortcuts.

NicoLeo13 avatar Nov 27 '26 12:11 NicoLeo13

Reproduced on Linux (Xvfb, real key events, Electron 45.2.2): with autoHideMenuBar: true, Electron toggles the hidden menu bar when a lone Alt is released and moves keyboard focus to it, so the keys after it never reach the pane. #4938 (merged as ddf9a1f57c) keeps the bar hidden and turns the Alt toggle off (setAutoHideMenuBar(false) after the window is created). Every menu item keeps its shortcut, and Open in Browser and Quit stay in the tray, so no setting is needed. An Alt+K chord itself already reached the page in this test; the Alt+K encoding part of the comment above is tracked in #4898.

devswha avatar Nov 28 '26 06:11 devswha