How to map one key combination with modifier key to another?

Hi, I want to map Ctrl + Tab to Alt + Y, and make it behave similar in terms of keyboard events. So when I press Ctrl + Tab the Alt + Y should press, when I release Tab the Y should release, if I continue to hold Ctrl the Alt should hold until I release Ctrl.
The following animation describes it better: https://gfycat.com/DamagedCloudyDuck

I want to make the extension (Popup Tab Switcher) for switching between browser tabs to work when I press Ctrl + Tab instead of its default Alt + Y. I know that Chrome has chrome://extensions/shortcuts where you can set different shortcuts but there is no way to set Ctrl + Tab to trigger the extension commands.


I figured out the solution that is not ideal and uses two macros:
Ctrl-Tab_to_Alt-Y.kmmacros (6.3 KB)
I don't fully happy of this, because it uses timers. Maybe there is more elegant way of doing this?

Is it correct to say that you are trying to fix the deficiency in Chrome that it doesn't support Ctrl-Tab as an extension shortcut? Is that the problem needing a solution? I want to make sure I understand the problem before I decide what the best solution is. You are describing an approach to a solution but I'm not sure yet if that's the best approach because I'm not certain what the problem is.

Yes, you are correct. I want to bypass inability to use Ctrl + Tab as a shortcut for the extension command in Chrome by mapping it to Alt + Y.

Chrome has an extension called Shortkeys which solves this issue. I've just downloaded it. I'm trying to make it do what you are asking. I haven't completely succeeded yet but it says it can do this.

1 Like

Cool, thanks for a clue! I'll try to use Shortkeys for that.

Sure. I'm struggling at the moment with it. I rarely use Chrome or Extensions. But from what I've read about it, it's supposed to work to do this. You sound like you know more about Chrome than I do, so maybe you can make it work before me.

One thing that wasn't obvious in Shortkeys is that if you want the shortcut to be, say Control-B you actually have to type the six characters "c t r l + b". That took me a while to figure out. But I still haven't got it working correctly.

I discovered it doesn't take effect until you completely close the Chrome browser. Now the next step is to figure out what you want Ctrl-Tab to do. There's a list of 50 functions that it supports. I'm not sure if the function you want is in that list.

=======

I'm trying to figure out what ALT-Y does in Chrome. There is no ALT key on a Mac, but you probably mean OPTION-Y when you say ALT-Y. What function in Chrome are you trying to map to? Please tell me in English what you expect OPTION-Y to actually do in Chrome.

For security reasons Chrome prohibits almost all key remapping inside most web forms. It's to prevent hackers from doing bad things to innocent people. Even Shortkeys cannot get around this security feature. If that's what you are trying to do, then it might be possible to use Keyboard Maestro to solve this. Maybe. But I need to be more sure what you are trying to do. And right now I have no idea.

Alt-Y doesn't do anything in Chrome. But the extension uses this combination as its default command. And I want to map Ctrl-Tab to trigger Alt-Y as it is shown here.

I figured out the solution that is not ideal and uses two macros:
Ctrl-Tab_to_Alt-Y.kmmacros (6.3 KB)
I don't fully happy of this, because it uses timers. Maybe there is more elegant way of doing this?

Ok, I guess that's clear. I think the Shortkeys extension is for Chrome commands only. I'm not the smartest guy on these forums so maybe it's my fault for not understanding.

In that case try this idea. There's a feature in macOS System Preferences, under Keyboard, under App Shortcuts, that lets you add shortcut keys to menu items for programs that you indicate. All you have to do is put the name of the menu command in the box below. I've never seen this feature before. But in Chrome there is a name for the "Select Next Tab" function under the Window menu so I think this idea will work.

As far as I can see, this idea should work. But I've been wrong before.

Thanks for sharing this idea. It could work if the Chrome's Menu had entries of the extension commands, then I could assign Ctrl-Tab and Ctrl-Shift-Tab to those commands, but there is no such thing.
In the end of my experimentation, I have come to a solution that uses Karabiner-Elements and it is better than the previous one because it does not run timers.

Perhaps then I failed you. I may not be able to help from here on because I'm going on a little vacation soon.