Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
You could make a quick AutoHotKey or AutoIt script to send just key-up presses. – Darth Android Oct 10 '12 at 14:36
Good idea, though I've got a Mac as the server end, and those are both Windows tools. – MidnightLightning Oct 10 '12 at 14:43

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}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.