Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dimhatz opened this issue Jun 13, 2017 · 5 comments
Open

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

dimhatz opened this issue Jun 13, 2017 · 5 comments

Comments

@dimhatz
Copy link

dimhatz commented Jun 13, 2017

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!

@lydell
Copy link
Owner

lydell commented Jun 13, 2017

Glad you like it! Unfortunately, I have no idea why it’s not working for you.

As mentioned in the readme, I don’t use Autohotkey anymore (and haven’t done so for 3 years), so I think you might be better off asking somewhere else :)

@dimhatz
Copy link
Author

dimhatz commented Jun 13, 2017

Thx for such a prompt reply!
I guess for now I will be using a (hackish) workaround of doing all the remapping on lower level (SharpKeys - registry modification) and only the "unpresses" will be handled by Dual.
I will try to dig further to get to the bottom of the issue. I will post any results here.
(EDIT: clarity)

@mokanfar
Copy link

Hi lydell i also use linux is there an equivalent script like this that you use for linux to achieve same dual role result

@lydell
Copy link
Owner

lydell commented May 28, 2018

None that I'm aware of. But I don't use dual-role keys anymore. If you really want them, I think the best way to do it is through keyboard firmware, unfortunately. Examples:

@notEvil
Copy link

notEvil commented Aug 18, 2020

@mokanfar Last year I spent some time customizing my keyboard experience and eventually wrote a Python library (based on evdev) which enables anything I wanted and is easy to maintain and extend. Check out https://gitlab.com/notEvil/keyboard. Its far from simple to use, but with a little trial and error and a look at main(), SubstituteKeyCodes and ModifierAsKey the result should be close to dual. Hope it works for you as well as it does for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants