2

I've run into dropped key events when connecting via VNC clients, leading to a "stuck key" (usually a meta key like CTRL or ALT) and searching around the common answer on how to solve it is often "press and release each meta key individually until the problem resolves".

However, I've found this to be annoying and time consuming to try and solve it this way. Plus on a bad connection, it sometimes will miss the "key up" event for the meta key again, and still keep the key stuck. So I'm looking for an automated way to do this:

From a script on the client side or the server side, is there a way to trigger "key up" events for all the meta keys (CTRL, ALT, SHIFT, and WIN/CMD, both Left and Right versions)? Or just a command to release all keys the server thinks are down at the moment? Or some scripted way to at least list which keys the server end thinks are down so I know which key to keep pressing and releasing to try and release it?

I've got a Mac on the server end, so a Mac/Linux solution would be needed for my situation.

3
  • You could make a quick AutoHotKey or AutoIt script to send just key-up presses. Oct 10, 2012 at 14:36
  • Good idea, though I've got a Mac as the server end, and those are both Windows tools. Oct 10, 2012 at 14:43
  • An eaiser way is go to a terminal/applicaiton and press some valid combination of <metakey>+<key> where <key> stands for a valid hotkey with meta key combination. Eg: ctrl+c Then vnc will get key up
    – Louis Go
    Nov 22, 2021 at 5:03

2 Answers 2

0

I believe I found a server-side solution for my Mac VNC server; create this one-line Applescript, save it as an Application, and run when needed.

tell application "System Events" to key up {shift, option, command, control}
0

From the suggestion of Darth Android , this is the AutoHotKey script I use. It is supposed to release Ctrl, Alt, Shift and WinKey:

Send {Ctrl Up}
Send {Alt Up}
Send {Shift Up}
Send {LWin Up}
Send {RWin Up}

Save it to something like CtrlAltShiftWinKeyUp.ahk .

If you have AutoHotKey installed, you can run the .ahk file directly. If not, you can compile it to .exe by using Ahk2Exe or similar.

Note that this answer is only valid on Windows systems. There is some *NIX compiler for AutoHotKey scripts out there, but I have not tested them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .