WritingTools icon indicating copy to clipboard operation
WritingTools copied to clipboard

Issues: Hotkey and others

Open needcoder opened this issue 11 months ago • 7 comments

  1. I appointed Hotkey "Ctrl+` " and after adding the button (the program auto-closing) and the start of the program - hotkey does not work. So that hotkey works again to me - i have to do change Hotkey to any other and then again to "Ctrl+` " that the window would appear when the hotkey press

  2. If I do not add a button, then you need the "Apply" button does not close the program for applying changes (It is advisable to make an auto-reload)

  3. Sometimes, when highlighting the text and pressing hotkey, a standard window for a question is caused and not a window for working with the text - I still do not understand the logic why this is happening upd: starts working with text again when the hotkey is changed

needcoder avatar Feb 23 '25 04:02 needcoder

Hi, what OS are you using? What version of WritingTools? Are you running the binary or the python file?

momokrono avatar Feb 23 '25 16:02 momokrono

Hi, what OS are you using? What version of WritingTools? Are you running the binary or the python file?

Windows 10, binary, v7.1 (last version)

needcoder avatar Feb 23 '25 20:02 needcoder

  1. Sometimes, when highlighting the text and pressing hotkey, a standard window for a question is caused and not a window for working with the text - I still do not understand the logic why this is happening upd: starts working with text again when the hotkey is changed
  1. upd: I found out that when I change the keyboard layout to something other than English, when I select text and press a hotkey, a standart window appears, not a window for working with text.

needcoder avatar Feb 23 '25 22:02 needcoder

@needcoder , thank you for your report.

1 and 3: The non-default hotkeys are a bit finicky on some PCs. A thing we have to work around is this: if your keybinding happens to unfocus the selected text in any way, Writing Tools will not be able to "grab"/see it when you invoke it (because it uses ctrl+c internally), causing it to open up in the blank "chat mode" (since it thinks you've selected no text). The key binding may also simply not be detectable by the keyboard input library we're using.

If ctrl+space or ctrl+j doesn't work for you, you'll need a little bit of experimentation to find one that works, unfortunately.

2: Agreed about the restarts, I'm looking to improve it in an upcoming update :)

theJayTea avatar Feb 24 '25 02:02 theJayTea

I've come up with a temporary workaround that works (launches a window specifically for text manipulation when text is highlighted) with any keyboard layout:

  • Hokey: "ctrl+`" (or "ctrl+space")
  • Microsoft PowerToys -> keyboard manager -> remap a shortcut: "ctrl+`" to "run program" (path with pythonw.exe | argument path with switch_to_english.pyw)

switch_to_english.pyw

import ctypes

def switch_keyboard_layout(layout_id):
    hwnd = ctypes.windll.user32.GetForegroundWindow()
    thread_id = ctypes.windll.user32.GetWindowThreadProcessId(hwnd, 0)
    ctypes.windll.user32.LoadKeyboardLayoutW(layout_id, 0x00000100)
    ctypes.windll.user32.PostMessageW(hwnd, 0x0050, 0, int(layout_id, 16))

#Switching to English layout (0x0409 - en-US)
switch_keyboard_layout("00000409")

needcoder avatar Feb 24 '25 04:02 needcoder

Hi @needcoder! Thanks for sharing that, sorry I wasn't able to respond earlier.

That's a smart solution for now, and in the future, I'll see if there's something I can do to natively improve this experience for users like you who use multiple keyboard layouts so things just work out of the box :)

theJayTea avatar Apr 04 '25 14:04 theJayTea

I think this is because the hotkeys are not trapped/suppressed by the script. It would be nice to have an option to suppress any hotkey press to avoid having to remap keys or select a different hotkey. This might be more useful as you add the ability to set multiple hotkeys.

calgraham avatar May 13 '25 16:05 calgraham