Terminal copy and Ctrl keys, SSH agent forwarding, system tray - #113
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three changes, one branch.
Closes #96
Closes #101
Closes #102
Copy from the desktop terminal with Ctrl+Shift+C
On Windows and Linux nothing copied from the terminal but the right-click menu: Ctrl+C is the shell's interrupt and has to stay one. Ctrl+Shift+C now copies the selection, as in GNOME Terminal and Windows Terminal, and Ctrl+Shift+V keeps pasting through the webview's own binding. Ctrl+C and Ctrl+V still send ^C and ^V. The chord follows the letter on Latin layouts (Dvorak's J key stays a J) and the physical key on non-Latin ones. macOS is unchanged: Cmd+C and Cmd+V already reach xterm through the Edit menu.
Ctrl keys on a non-Latin layout (Linux)
Found while verifying the copy chord on a Russian layout. Under any non-Latin layout, WebKitGTK reports
keyCode0 for letter keys, which had two effects. xterm sent nothing for Ctrl+C, Ctrl+D, Ctrl+Z or Ctrl+[, so a running command could not be interrupted. And the webview's own Ctrl+Shift+V, bound by theVkey symbol, never fired. JSnavigator.clipboard.readTextandexecCommand('paste')are both denied in that webview.When the key code is 0, the physical key now decides, as in GNOME Terminal:
[,\,]) goes in as its control character throughterm.input. This applies only when the key is a letter of a non-Latin script: Latin letters with diacritics (ü, å, ç) and dead keys also report 0, and they keep their meaning;terminal_paste, which runs WebKitGTK's ownPasteAsPlainTextediting command, so bracketed paste works as with the native binding.Every other webview reports a Latin key code under these layouts and never takes this path.
SSH agent forwarding
A host can lend its terminals the local agent, like
ssh -A. That coverssudothroughpam_ssh_agent_auth,gitover SSH and onward hops. It is off for every host until switched on in either app's host form, or set withForwardAgent yesin~/.ssh/config.SSH_AUTH_SOCK.auth-agent-req@openssh.comgoes out before the pty and shell, and only on unix.ssh_config:yesturns it on.noin the global section, a wildcardHostor aMatchblock, including insideIncluded files, keeps the agent from every host after it, since ssh(1) may take that value first.Minimize or close to the system tray
Two opt-in settings (Settings → Window). The icon exists only while one is on, and the window hides into it only while it is up.
Linux counts a tray only when there is one to show the icon:
dlopen, since libappindicator panics on a missing one);Stock GNOME without the AppIndicator extension therefore reports no tray instead of hiding the window into nothing.
Minimize-to-tray needs X11: GTK under native Wayland is never told the window was minimized, so the switch is disabled there with a note. The window hides only on the way down, so a stale event after a restore cannot send it back.
macOS uses a menu-bar icon. Minimizing stays with the Dock, and a Dock click brings a hidden window back (
RunEvent::Reopen).tauri-plugin-single-instancemakes a second launch reveal the running window.DBUS_SESSION_BUS_ADDRESS=disabled:), where the plugin would panic at startup.The startup reveal is one-shot, so the 3 s fallback never pulls a window back out of the tray. A reveal requested before the page is up waits for it.
Contract
New wire surface, approved:
HostDto.forwardAgentandHostInputDto.forwardAgent.set_tray_behavior { minimizeToTray, closeToTray } → TraySupportDto { available, minimize }.terminal_paste → (), which does something on Linux only.Packaging
With tauri's
tray-iconfeature, the bundler makeslibayatana-appindicator3a hard.deb/.rpmdependency and copies it into the AppImage.release.ymlalready installs the dev package the bundler needs. New Linux-only crate dependencies (zbus,x11-dl,gtk) were already in the tree through tauri and its plugins.Verification
All Linux runs were in Docker (Debian trixie, WebKitGTK, release-like build) against a real OpenSSH server.
ssh-add -l,sudothroughpam_ssh_agent_authand an onwardsshhop all work.SSH_AUTH_SOCK, and neither does a staleSSH_AUTH_SOCK.ForwardAgent yesimport forwards, and the editor switch persists.WM_STATEwithdrawn versus iconic).disabled:address, the app starts.tests/agent_forward.rsruns an in-process SSH server that opens agent channels whether or not the client offered one. It tells a closed channel from a silent one and checks the connection survives a refusal; it was mutation-checked against a silent drop and an erroring refusal.ForwardAgent.keyCode0 keydown and was mutation-checked.prevent_exit.cargo fmt.cargo clippy --all-targets -D warningsfor the workspace and the GUI on macOS, and the GUI on Linux.cargo test,svelte-check0/0, vitest 263, Playwright 54/55 (see below).Review
/code-review highplus an adversarial review (four lenses, each finding checked by a refuting verifier). Everything confirmed is fixed except the items below.Waived, with reasons:
tray-iconregisters tauri's tray commands, andcore:defaultalready grantedcore:tray:default. The capability file is unchanged, and the UI has no HTML-injection sink. Tighteningcore:defaultinto explicit sub-sets would change existing behaviour and is left for its own change.Switchand a pref factory would refactor merged code.Known limits (not fixed here)
IdentityAgent, aForwardAgent <socket>, or ayesunderHost *. It is not available on Windows, where the agent is not used for logins either.tests/tunnel.rson macOS (fails on main too);Close web-1 · terminallabel test;/code-review ultra, which only the maintainer can start.