I previously suggested that SendEvent could be a workaround, but that was a mistake. When SendEvent is used, or when Send or SendInput falls back to SendEvent mode, the issue you described is present even on v2.0.6 and earlier. SendInput mode was not affected by the issue because of the bug I mentioned above, and the cause of the issue is not related to the bug fix I mentioned.
When we send a {modifier down}, we expect to be able to use this to trigger hotkeys. In other words, putting LCtrl into effect means that we should be able to trigger
^F2::, and conversely,
not trigger
F2::. So while you are holding F2, key-repeat should not trigger the F2 hotkey; it should execute only the first time, when LCtrl is not in effect. (I'm assuming that the Logitech software emulates key-repeat for F20. I used F2 for testing.)
However, when there is a pair of hotkeys such as
F2:: and
F2 up:: or
^F2:: and
^F2 up::, we expect the key-up hotkey to execute even if the modifier state does not match. In other words, pressing Ctrl+F2 should trigger
^F2:: and
^F2 up::, even if you release Ctrl before releasing F2; and F2 on its own should trigger
F2:: and
F2 up:: even if you press Ctrl after pressing F2 before before releasing F2.
The actual issue is that key-repeat was resetting the "hotkey to fire upon release", so the key-up hotkey would only fire if the modifier state matches at the time the key is released, regardless of what it was when the key was pressed. I've decided to consider this a bug, since it isn't consistent with the behaviour prior to key-repeat (or for keys/buttons without key-repeat) and doesn't seem to have any benefit.
Code: Select all
F2::{
ToolTip A_ThisHotkey
SendEvent "{LCtrl down}"
}
F2 up::{
ToolTip A_ThisHotkey
Send "{LCtrl up}"
}
^F2::{
ToolTip A_ThisHotkey
SendEvent "{LCtrl down}"
}
^F2 up::{
ToolTip A_ThisHotkey
Send "{LCtrl up}"
}
This demonstrates that ^F2 will execute if you hold the key long enough, then ^F2 up will execute instead of F2 up. Although the behaviour can differ depending on whether the ^F2 hotkeys are defined, in v2.0.11 the F2 up hotkey would not be fired either way. This is fixed by v2.0.12.