v1.8.92: fix Ctrl+S/Q and all Ctrl+key combos with non-Latin keyboard layouts

Ctrl+key shortcuts now use physical keycodes as fallback, so Ctrl+S (save
in nano), Ctrl+Q (XON), Ctrl+A/E/R/W/T etc. work regardless of whether
the keyboard layout is English, Russian, or any other.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chrome-storm-c442
2026-03-02 04:10:30 -05:00
parent bc7be1057b
commit bc48aea1e4
3 changed files with 34 additions and 1 deletions

View File

@@ -712,6 +712,7 @@ class TerminalWidget(tk.Frame):
return "break"
# ── Ctrl+Key by keycode — works with any keyboard layout ──
# Physical keycodes for Ctrl+key (layout-independent, works with Russian etc.)
_CTRL_KEYCODE_MAP = {
67: '_on_ctrl_c', # C
86: '_on_ctrl_v', # V
@@ -720,6 +721,32 @@ class TerminalWidget(tk.Frame):
90: '_on_ctrl_z', # Z
}
# Physical keycodes → Ctrl byte: handles keys NOT in _CTRL_KEYCODE_MAP
# so that Ctrl+S, Ctrl+Q, Ctrl+A etc. work with any keyboard layout
_CTRL_KEYCODE_BYTE = {
65: b"\x01", # A
66: b"\x02", # B
69: b"\x05", # E
70: b"\x06", # F
71: b"\x07", # G
72: b"\x08", # H
73: b"\x09", # I
74: b"\x0a", # J
75: b"\x0b", # K
77: b"\x0d", # M
78: b"\x0e", # N
79: b"\x0f", # O
80: b"\x10", # P
81: b"\x11", # Q (XON)
82: b"\x12", # R
83: b"\x13", # S (XOFF / save in nano)
84: b"\x14", # T
85: b"\x15", # U
87: b"\x17", # W
88: b"\x18", # X
89: b"\x19", # Y
}
def _on_ctrl_key(self, event):
"""Route Ctrl+key by physical keycode (layout-independent)."""
if not self._keyboard_enabled:
@@ -732,6 +759,12 @@ class TerminalWidget(tk.Frame):
if event.state & 0x1 and event.keycode == 86:
return self._on_ctrl_v(event)
return getattr(self, handler_name)(event)
# Fallback: send Ctrl+byte for keys not handled above (e.g. Ctrl+S, Ctrl+Q)
# This ensures shortcuts work with any keyboard layout (Russian, etc.)
ctrl_byte = self._CTRL_KEYCODE_BYTE.get(event.keycode)
if ctrl_byte:
self._send(ctrl_byte)
return "break"
return None # let other bindings handle it
# ── Ctrl+C: copy or SIGINT (double-press within 1.5s) ──

Binary file not shown.

View File

@@ -1,6 +1,6 @@
"""Version info for ServerManager."""
__version__ = "1.8.91"
__version__ = "1.8.92"
__app_name__ = "ServerManager"
__author__ = "aibot777"
__description__ = "Desktop GUI for managing remote servers"