Submit A Tip Alternative Tip Form

Chrome Apps Can Now Respond to Keyboard Shortcuts When Browser Not in Focus

Screen Shot 2014-04-03 at 15.48.19

When the shiny new mini-media player app for Google Music launched one feature was notably absent: media key support.

In order to skip a track, pause playback or stop music entirely one had to hunt out and bring the mini-player into focus then press the relevant control.

Hardly a huge effort, granted, but far from being as seamless an experience as that of native apps like iTunes or Spotify. After all, most of us listen to music through an app running in the background, right?

The good news is that you will soon be able to use media keys to control the Google Music playback while doing other stuff — and if you’re using the developer channel of Chrome on the desktop, it’s ready to play with now.

Global Scope or ‘works while you’re not looking’

Chrome has allowed extension developers (and users) to assign keyboard combos to apps and add-on since version 25. In addition to most developers not using it, the biggest “drawback” of the feature has been the limitation of having to have the browser in focus before such keyboard combos could work.

But extensions and Chrome apps running on desktop builds of Google Chrome will soon be able to take advantage of global scope – an under-the-hood command API that enables applications to react to set keyboard shortcuts (e.g., media player buttons) even if the browser itself is not in focus.

Global Scope is already enabled in desktop builds on the dev channel, with the aforementioned mini-music player app being one of the first apps to offer the option of ‘listening’ for shortcuts when the browser isn’t front and centre.

Chrome OS does not, at present, support global commands, but it can be enabled via a flag.

Custom Key Combos

Perhaps the best thing about the feature is that keyboard shortcuts can be tweaked to suit your own tastes — handy as devs are limited to binding global actions to Ctrl + [num], or Ctrl + Shift + [num] at present.

To enable global commands in the Google Music mini-player on Chrome Dev you’ll first need to have the app installed. See our post for more on setting it up.

If you’re already set up with it, just head to Settings > Extensions, scroll to the bottom of the page and tap the ‘Keyboard Shortcuts’ link, and set the mini-player options from ‘Chrome‘ to ‘Global’ (see image at top of post).