mirror of
https://github.com/Flowseal/tg-ws-proxy.git
synced 2026-10-21 02:58:45 +00:00
fix commands on different keyboard layouts
This commit is contained in:
1 parent
00d72a4c7f
commit
9109570d32
1 file changed
+12
@@ -75,6 +75,18 @@ def create_ctk_toplevel(
|
||||
after_create: Optional[Callable[[Any], None]] = None,
|
||||
) -> Any:
|
||||
root = ctk.CTkToplevel()
|
||||
|
||||
if sys.platform == "win32":
|
||||
def handle_ctrl_shortcut(event: Any) -> Optional[str]:
|
||||
shortcuts = {65: ("a", "<<SelectAll>>"), 67: ("c", "<<Copy>>"), 86: ("v", "<<Paste>>")}
|
||||
shortcut = shortcuts.get(event.keycode)
|
||||
if shortcut and event.keysym.lower() != shortcut[0] and not event.state & 0x20000:
|
||||
event.widget.event_generate(shortcut[1])
|
||||
return "break"
|
||||
return None
|
||||
|
||||
root.bind("<Control-KeyPress>", handle_ctrl_shortcut, add="+")
|
||||
|
||||
root.title(title)
|
||||
root.resizable(False, False)
|
||||
center_ctk_geometry(root, width, height)
|
||||
|
||||
Reference in new issue
Block a user