Sunday, November 25, 2018

autohotkey - Mapping Ctrl+w to Alt+w sends both Ctrl+Alt+w


I'm using Autohotkey to map Ctrl+w to Alt+w for Cloud9 to close inner tabs with Ctrl+w like usual instead of their Alt+w. I tried to use the following simple mapping


^w::!w

But it sends Ctrl+Alt+w with closes all tabs except current tab which wasn't what I wanted.


How can I tell autohotkey to not actually send the Ctrl key that I press for this hotkey?


Answer



Try the following instead:


Ctrl & w::Send !w

AutoHotKey has special handling for remapping the Ctrl key to the Alt key:



When the source key is LCtrl and the destination key is an Alt key,
the line Send {Blind}{LAlt DownTemp} is replaced by Send {Blind}{LCtrl
Up}{LAlt DownTemp}. The same is true if the source is RCtrl, except
that {RCtrl up} is used.



This special handling is specifically designed to prevent the behavior you observed. If you think about a simpler remapping like p::v, you'd probably want CtrlP to be treated like ^v so that you can paste with your P. In general, AutoHotKey tries to allow modifying keys to do their thing while triggering a hotkey.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...