1

I've recently installed the Google Chrome extension Streamkeys which allows the user to use keyboard commands to perform common playback actions on popular streaming sites (Youtube, Soundcloud, and many major sites).

For macOS, Streamkeys default setting is to use the global Mac media keys ( ▶/❚❚ ).

Due to Chrome design, global keys cannot be rebound to use modifier keys like SHIFT + ▶/❚❚.

I like the idea of using the media keys for global Soundcloud/Youtube control, so what I'd like to do is to rebind the keyboard so that iTunes instead uses modifier keys like SHIFT + ▶/❚❚. That way, I can have the best of two worlds.

Question: How can I "duplicate" these three keys to a new location and use them to control iTunes, while still letting Chrome think that they are in their old location? In other words, I would effectively like two pairs of the same keys, only that one pair controls iTunes and one pair controls Chrome Streamkeys.

Is this even possible, and am I thinking about it the right way, when assuming that I would need "duplicates"? Just rebinding the keys would probably not work, since Chrome would still find the keys and "take them" for Streamkeys?

Note again: this is about global control. It is not the same as in-tab in Chrome or in-app in iTunes.

1
+50

Install Karabiner

Which can be found there: Karabiner: a keyboard customizer for OS X

Analyse which keys are involved

Within Karabiner menu select Launch EventViewer... and type on the music control key you would like to program. Here is the output you should get: Karabiner Event Viewer

Make a private.xml

Read the Karabiner documentation on the topic: private.xml Reference Manual

Create the ${HOME}/Library/Application Support/Karabiner/private.xml with the following content:

<?xml version="1.0"?>
<root>
  <item>
    <name>Shift standard music control keys</name>
    <identifier>Shift standard music control keys</identifier>
    <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_PREV, ModifierFlag::SHIFT_L, ConsumerKeyCode::MUSIC_PREV</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_PLAY, ModifierFlag::SHIFT_L, ConsumerKeyCode::MUSIC_PLAY</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_NEXT, ModifierFlag::SHIFT_L, ConsumerKeyCode::MUSIC_NEXT</autogen>
  </item>
</root>

Depending of your taste, use vi, emacs or TextEdit (of course not Word).

If you want to be clean, I would suggest you to proceed as I did.

Create a source with the above content in:

${HOME}/Documents/src/Karabiner/music.xml

and then install it within the Karabiner directory:

cp ${HOME}/Documents/src/Karabiner/music.xml "${HOME}/Library/Application Support/Karabiner/private.xml"

( The "…" use is necessary because of the space within Application Support. ).

Load your private.xml

Tell Karabiner you will use a custom setting: Karabiner use prepared settings

and load it: Karabiner apply prepared settings

Test it

Check that this let you achieve the mapping you want to get with Chrome.

I didn't check this part of your request, and I am not sure I understood it fully.

Report success or failure, since this may help some other users 😃.

  • Daniel, thanks very much for these detailed guidelines. Rebinding the media keys to use Shift modifiers actually didn't work (I'm pretty sure I did it right). The normal keys are still in use, but the Shifted commands do nothing. Does __KeyToKey__ duplicate or move key mappings? – Winterflags Sep 24 '16 at 22:29
  • The above configuration tested give me 6 working keys. The mapping defined by Karabiner is a one way mapping. Did you use the left shift key? – dan Sep 25 '16 at 8:47
  • Check with Karabiner > Launch EventViewer... which keycode are exactly sent. If they are different from the one in my answer, then you have to adapt your private.xml. If you are in such a case, please add a screen capture of EventViewer... within your original question. – dan Sep 25 '16 at 8:49
  • I'm getting the same keycodes as in your screenshot, but the media keys are still designated to their original places. Strange. I do know from previous experience with Karabiner that your answer should theoretically be correct (probably), so I guess I will have to keep on looking for a fix. – Winterflags Sep 25 '16 at 11:33
  • I checked with iTunes my 3 music control keys work alone and with the shift modifier. I suspect that Streamkeys is modyfing the key function not only within Chrome but at the global level. – dan Sep 25 '16 at 11:44
0

Alternative solution that tends to the issue of the OP, but doesn't answer the question:

In case someone is having the exact same issue with Streamkeys uptaking the place of media keys that should also control iTunes, I found that the best way to mitigate this issue is use the Chrome extension Extension Automation to activate Streamkeys only when sites you specify have been opened in a Chrome tab. So if Soundcloud, Youtube or any other site that you may specify isn't open in a tab, iTunes controls will work as normal.

Rebinding the Streamkey shortcuts in Chrome to something like Shift + Ctrl + (7/8/9) is also possible solution, of course.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .