Skip to content

PuTTYNG puts itself into the tab - #30

Merged
Modding merged 3 commits into
mainfrom
puttyng-embeds-itself
Nov 30, 2026
Merged

Modding merged 3 commits into
mainfrom
puttyng-embeds-itself

Conversation

@Modding

@Modding Modding commented Nov 30, 2026

Copy link
Copy Markdown
Owner

What

  • PuTTYNG support (ROADMAP work list item 16). PuTTYNG is PuTTY with patches for embedding (MIT like PuTTY, https://github.com/mRemoteNG/PuTTYNG). With -hwndparent <window> it creates its window inside ours, without frame, and never puts a frame back: no taking in, no hide/show, no window of its own flashing up at the start.
    • launch::spawn_putty adds -hwndparent when the PuTTY found is a PuTTYNG and windows go into tabs. embed::is_puttyng / puts_itself_in tell it by the internal name of its version information (a renamed file too) or by the file name.
    • The programs folder prefers PuTTYNG.exe over putty.exe (programs::PROGRAMS).
    • Embedded::try_attach looks among our own child windows first. PuTTYNG keeps its window without WS_CHILD (its focus handling needs that, see its patch), so it gets the keyboard by SetForegroundWindow instead of SetFocus; its 3 px border is cut off like PuTTY's frame (PuTTY stays steady in its tab and keeps the keyboard #28); As own window is not offered for it.
    • place() maps positions against our window instead of GetParent, which isn't our window for a window without the child style.
    • Our window handle is taken from the CreationContext, so --open connect: and a restored session can pass it too (before, they started before the handle was known).
  • Link, no download. When the PuTTY found is a plain one, the system check and Settings » Programs say what PuTTYNG does and link to its releases page. AdminCraft downloads nothing and ships nothing of it. New texts in all four language files; a paragraph in all five guides.
  • AGENTS.md: src/embed.rs also reads version information (named unsafe module).
  • ROADMAP: items 16 and 17 entered first; 16 ticked off here. 17 (plain PuTTY: hide before placing) follows in its own pull request.

Tested

  • cargo fmt --check, cargo clippy --all-targets --locked -- -D warnings, cargo test --locked (139 tests). New: puttyng_gets_our_window_as_parent, puttyng_is_preferred_in_the_programs_folder (fails without the program list change).
  • Live on Windows 11 with the signed PuTTYNG 0.85 x64 release, raw connection to a local port, window events logged:
    • started with -hwndparent <our window> (checked on the process command line), also as a renamed copy (term.exe, told by its version information); plain PuTTY 0.85 gets no extra option;
    • no window of its own, nothing hidden or taken in; in the tab without title bar or border, scroll bar visible;
    • once in the tab, PuTTYNG has the foreground and the keyboard and keeps it.
  • Not tried: clicking back and forth between PuTTYNG and AdminCraft, switching tabs and menus with PuTTYNG active, Alt+Tab back to AdminCraft, a real SSH login with password (-pwfile). The new hint under the system check and the programs list is below the visible part of the --screenshot pictures, so it was not looked at.
  • Linux and macOS: only CI.

Accessibility

The new hint is a plain label and an egui link with its own text ("Download PuTTYNG"), reachable by keyboard like the other links; the address shows on hover. Keyboard focus goes into the PuTTYNG window when it is put into the tab, as for other embedded windows.

PuTTYNG (PuTTY with patches for embedding) takes -hwndparent and creates
its window inside ours, without frame, so nothing has to be taken in,
hidden or clipped, and no window of its own flashes up at the start.

- launch::spawn_putty adds -hwndparent for a PuTTYNG going into a tab;
  embed::is_puttyng tells it by the internal name of its version
  information (renamed files too) or by the file name.
- The programs folder prefers PuTTYNG.exe over putty.exe.
- Embedded::try_attach looks among our own child windows first. Such a
  window keeps its style without WS_CHILD, as PuTTYNG's focus handling
  needs; it gets the keyboard by SetForegroundWindow, its thin border is
  cut off like PuTTY's frame, and As own window is not offered.
- place() maps positions against our window, not GetParent, which is not
  our window for a window without the child style.
- Our window handle is taken at start, so --open connect: and a restored
  session can pass it too.
- The system check and Settings » Programs link to PuTTYNG's releases
  page when the PuTTY found is a plain one; nothing is downloaded or
  shipped. User guide in all five languages.
@Modding
Modding force-pushed the puttyng-embeds-itself branch from c3c466b to 46905ab Compare November 30, 2026 02:19
@Modding
Modding merged commit 6ea9be7 into main Nov 30, 2026
5 checks passed
@Modding
Modding deleted the puttyng-embeds-itself branch November 30, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant