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

Swap keys #9

Open
tsankuanglee opened this issue Mar 14, 2022 · 2 comments
Open

Swap keys #9

tsankuanglee opened this issue Mar 14, 2022 · 2 comments

Comments

@tsankuanglee
Copy link

Wonderful utility! Could we add a function to swap keys that doesn't cause loops, i.e. swap KEY_CAPSLOCK and KEY_LEFTCTRL.

For example, I'd like the physical CAPSLOCK key to do the dual_role, and the physical LEFTCTRL to emit CAPSLOCK.

This doesn't work as intended:

[[dual_role]]
input = "KEY_CAPSLOCK"
hold = ["KEY_LEFTCTRL"]
tap = ["KEY_ESC"]

[[remap]]
input = ["KEY_LEFTCTRL"]
output = ["KEY_CAPSLOCK"]

I understand I can do something like:

[[dual_role]]
input = "KEY_CAPSLOCK"
hold = ["KEY_LEFTCTRL"]
tap = ["KEY_ESC"]

[[dual_role]]
input = "KEY_LEFTCTRL"
hold = ["KEY_LEFTCTRL"]
tap = ["KEY_CAPSLOCK"]

But I can still see some use case for a real swapping. Perhaps a way to specify the original "physical" key?

@ShampooDeng
Copy link

ShampooDeng commented Sep 22, 2023

I have the problem. It seems that keys triggered via hold will not be prevented from matching as input.

So I simply make the hold key to be KEY_RIGHTCTRL, like this

[[dual_role]]
input = "KEY_CAPSLOCK"
hold = ["KEY_RIGHTCTRL"]
tap = ["KEY_ESC"]

[[remap]]
input = ["KEY_LEFTCTRL"]
output = ["KEY_CAPSLOCK"]

@tsankuanglee
Copy link
Author

Thank you. These workarounds, including your version and mine, are doable. I chose mine because I have my downstream application that needs to distinguish LEFT-CTRL and RIGHT-CTRL. Either way, I'm still wondering whether this is a feature worth adding -- it's probably unlikely that there's a use case for re-defining a hold/tap output.

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

2 participants