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

Differentiate between left / right cmd key? #3245

Open
aydoo opened this issue Jul 1, 2022 · 5 comments
Open

Differentiate between left / right cmd key? #3245

aydoo opened this issue Jul 1, 2022 · 5 comments

Comments

@aydoo
Copy link

aydoo commented Jul 1, 2022

Is there any way to e.g. only listen to the behaviour if the right cmd key is pressed? Specifically, I'd like to only use arrow keys when pressing right-cmd + h/j/k/l. left-cmd interaction should be ignored.
I couldn't find any information regarding this unfortunately.

@MuhammedZakir
Copy link
Contributor

This should help:

  1. If you are listening for key events of right command and want to modify next key presses if it is pressed:

    1. http://www.hammerspoon.org/docs/hs.eventtap.event.html#getKeyCode
    2. http://www.hammerspoon.org/docs/hs.keycodes.html#map
  2. If you are listening for key events of some keys and want to check if right command is pressed:

    1. http://www.hammerspoon.org/docs/hs.eventtap.event.html#rawFlags
    2. http://www.hammerspoon.org/docs/hs.eventtap.event.html#rawFlagMasks
    3. hs.eventtap.event.rawFlagMasks has incorrect documentation about device keys #2375

@relipse
Copy link

relipse commented Jul 1, 2023

I wanted to say that when I asked the same question, someone told me to put the word "right" before "cmd"
so I tried:
hs.hotkey.bind({"rightcmd"}, "t", function()

but it actually binds for left command and right command , so it doesn't work. Is there a bug report for this? or will this be fixed?

How am I supposed to do it?

@azhahes
Copy link

azhahes commented Aug 11, 2023

is this bug in track?

@relipse
Copy link

relipse commented Aug 12, 2023

What is track?

@asmagill
Copy link
Member

See #1199, specifically #1199 (comment) for why it's hard and #1199 (comment) for a proposed experimental workaround.

There is also a spoon ready to be merged implementing the workaround but I haven't had the time to do so yet.

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

5 participants