Skip to content

dual.modifier() successfully remaps Win->Alt, but not Ctrl->Alt #9

@dimhatz

Description

@dimhatz

Bug report

Hi, first of all thank you very much for your awesome code!

I'm trying to achieve the following:

  • Alt keys to produce Ctrl when held down and parens "(" and ")" when tapped
    Flawlessly done with:
*LAlt::
*LAlt UP::dual.combine("LCtrl", "(")
*RAlt::
*RAlt UP::dual.combine("RCtrl", ")")
  • Shift keys to remain Shift when held down and produce curly braces "{" and "}" when tapped
    Flawlessly done with:
*LShift::
*LShift UP::dual.combine(A_ThisHotkey, "{")
*RShift::
*RShift UP::dual.combine(A_ThisHotkey, "}")
  • Ctrl keys to produce Alt without breaking multi-modifier combinations (ex. Ctrl+Alt+T)
    This is where my issue is. The closest I've got is successfully make Win keys become Alt (but still not good enough - the point is to get Ctrl to produce Alt):
; works as expected alone and in combination with the above
*LWin::dual.modifier("LAlt")
*RWin::dual.modifier("RAlt")

; fails both alone and in combination with the above
*LCtrl::dual.modifier("LAlt")
*RCtrl::dual.modifier("RAlt")

I have opened Notepad and Keypose to monitor what is being sent to it.
The Win mappings work correctly, the Ctrl ones do not.
Pressing Win+T correctly produces Alt+T.
Pressing Ctrl+T incorrectly produces Alt+Ctrl+T.
Expected to produce Alt+T.

Here is the minimal reproducible code:

SendMode Input
#NoEnv
#SingleInstance force

#Include dual.ahk

dual := new Dual 

#Include defaults.ahk

#If true ; Override defaults.ahk. There will be "duplicate hotkey" errors otherwise - orig. author

*ScrollLock::dual.reset()

*LWin::dual.modifier("LAlt")
*RWin::dual.modifier("RAlt")

*LCtrl::dual.modifier("LAlt")
*RCtrl::dual.modifier("RAlt")

#If

Other things I have tried that didn't work:

  • Most obvious to try direct remapping:
LCtrl::LAlt
RCtrl::RAlt
; OR
*LCtrl::LAlt
*RCtrl::RAlt

Half-works in combination with first sets of mappings, requiring the multi-modifier sequence (like Alt+Ctrl+T) to begin with physical-Alt (produces Ctrl), then physical Ctrl (produces Alt), then letter T. Else the sequence will only produce Ctrl+T.

  • Use comboKey to remap Ctrl.
*LCtrl::dual.comboKey("LAlt")
*RCtrl::dual.comboKey("RAlt")

Ctrl will now produce Alt when pressed on its own, but in combination will produce Ctrl (ex. pressing physical Ctrl+F4 expecting to produce Alt+F4, but producing Ctrl+F4). This is probably me not understanding correctly the comboKey function.

Any help will be greatly appreciated, as this is my only way to make Windows tolerable..

P.S. My system is Win7 x64, Autohotkey 1.1.26, and latest Dual.
Oh, and the gist with commented out the above pieces of code for convenience:
https://gist.github.com/dimxdim/1a96506e0997092565c0f1eb51ad7b50

Thank you very much in advance for any help/advice!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions