8000 Upload pasted and dropped local files in direct SSH panes · Issue #195 · amirlehmam/wmux · GitHub
[go: up one dir, main page]

Skip to content

Upload pasted and dropped local files in direct SSH panes #195

Closed

Description

@LevSky22

Summary

Pasting a screenshot, pasting an Explorer-copied file, or dropping a local file into a terminal connected over SSH currently inserts a Windows path that does not exist on the remote host.

Add an opt-out remote insertion path for direct SSH panes: upload local files with the matching Windows OpenSSH scp.exe, then insert safely quoted remote paths into the terminal. This is inspired by cmux's remote file handling, adapted for Windows process and terminal semantics.

Proposed behavior

  • Handle clipboard images, copied files, and file drops through one main-process resolver.
  • Detect wmux ssh and direct SSH commands reported by integrated PowerShell/Bash shells.
  • Preserve the pane's SSH destination, port, identities, supported options, working directory, and exact client installation.
  • Upload into a private, unique /tmp/wmux-drop-<batch-id>/ directory using BatchMode=yes.
  • Keep plain text paste unchanged.
  • Allow Shift-drop to insert the local path without uploading.
  • Provide independent upload-on-paste and upload-on-drop settings, enabled by default.
  • Fail closed when the active destination or matching SSH/SCP client cannot be verified.

Windows safety boundary

Unlike macOS, Windows does not expose a reliable tty foreground process group. A descendant ssh.exe may be a background process, so process ancestry must only corroborate an authoritative managed or shell-integration report; it must never select an upload host by itself.

Nested SSH started after reaching the first remote host cannot be safely reproduced by the Windows client and is out of scope. Observable destination mismatches should block upload, and the limitation should be documented.

Related foundations

Activity

  1. LevSky22 commented on Aug 24, 2026

    @LevSky22
    ContributorAuthor

    Implementation draft: #198. Foundation fixes are #196 (OpenSSH resolution) and #197 (shell-spec preservation).

  2. amirlehmam commented on Aug 24, 2026

    @amirlehmam
    Owner

    Implemented in #198, shipping in v1.12.0.

    Pasting a screenshot, pasting an Explorer-copied file, or dropping files into a pane connected directly over SSH now uploads them with the matching Windows OpenSSH scp.exe and inserts safely quoted remote paths. Plain text paste is untouched. Shift-drop inserts the local path without uploading. [remote] upload-on-paste and upload-on-drop in ~/.wmux/config.toml are independent and both default to on — see docs/config.md.

    The Windows safety boundary you wrote into this issue is the part I want on the record, because it is what makes the feature safe rather than merely convenient:

    process ancestry must only corroborate an authoritative managed or shell-integration report; it must never select an upload host by itself.

    That is enforced structurally. SshDetector has three layers — managed (wmux ssh put the command line in the shell spec), reported (the PowerShell/Bash preexec hook), and probed (a Win32_Process ancestry sweep) — and refresh() will not return a session that only the probe knows about. macOS can ask the kernel which process group owns the tty; ConPTY has no tpgid equivalent, so a descendant ssh.exe may perfectly well be a background process. Ancestry answers "is there an ssh below this pane", never "is the user talking to it". A ssh host & therefore cannot receive your pasted screenshot.

    The rest of the fail-closed posture holds too: a report contradicting an active managed session (the observable nested-SSH case) blocks rather than guessing; an unverifiable destination raises a translated failure instead of quietly inserting a local path that the remote shell cannot open; uploads land in a private mkdir -m 700 batch directory under umask 077; and a batch that fails partway deletes what it wrote rather than handing you some remote paths and some silence.

    Nested SSH remains out of scope and is documented as such in both the README and docs/config.md, as you proposed.

    Two operational notes, since they'll be the first two support questions:

    Thanks for splitting it into three issues with the dependencies stated. It made the review tractable at this size.

  3. amirlehmam commented on Aug 24, 2026

    @amirlehmam
    Owner

    Released: v1.12.0 — installer and portable zip are both up, and the installer path auto-updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0