Open Bug 1411795 Opened 7 years ago Updated 3 months ago

Add global keyboard shortcut support to commands API

Categories

(WebExtensions :: General, defect, P3)

56 Branch
defect

Tracking

(Not tracked)

People

(Reporter: srpen6, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [commands])

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
Build ID: 20170926190823

Steps to reproduce:

"global" property is currently only supported with Chrome and Opera:

http://developer.mozilla.org/Add-ons/WebExtensions/manifest.json/commands#Browser_compatibility

That means until Firefox implements `global` WebExtension keyboard shortcuts
will only work if the browser has focus:

http://developer.chrome.com/apps/commands#scope

This is very bad. Currently "global" is supported with whatever WebExtensions
are replacing, see this example Add-on:

http://addons.mozilla.org/firefox/addon/media-keys

So the soon approaching Firefox 57 is going to kill this feature if it is not
implemented soon.
Component: Untriaged → WebExtensions: Untriaged
Product: Firefox → Toolkit
Summary: Implement global property for WebExtensions → Add global keyboard shortcut support to commands API
Whiteboard: [commands]
why was this marked "wontfix"

Firefox 56 supports it through XUL or whatever, as well as Chrome and Opera

If you want to push people to Chrome, you are sure doing a good job
(In reply to Steven Penny from comment #1)
> why was this marked "wontfix"

It's marked as wontfix for Firefox 57, since we're only accepting critical uplifts for that release at this point.
Until this issue is fixed by Mozilla, people can use Chromium [1] with the
Streamkeys extension [2].

[1] http://github.com/henrypp/chromium
[2] http://www.streamkeys.com
Apparently, media keys on macOS act as "global hot keys". The Chromium source cites this blog post as the source for their implementation:

https://weblog.rogueamoeba.com/2007/09/29/

Please consider this for this issue.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Product: Toolkit → WebExtensions
Bulk move of bugs per https://bugzilla.mozilla.org/show_bug.cgi?id=1483958
Component: Untriaged → General
Blocks: 1240350
Flags: needinfo?(ddurst)
Flags: needinfo?(ddurst)

Its been 2 years, I am tired of waiting. I will pay $100 to anyone who can fix
this, or can help me to fix it. I know a little Rust/C++/C.

Please, Chrome has had this for years. I already switched to Chrome on mobile,
I would really rather not for desktop as well.

$200 to anyone who can fix this.

I am willing to give this bug a try, especially since it intersects with another bug I planned on working.
Both bugs involve handling of Global Hotkeys using some platform specific native code.

My knowledge about that part is however limited, so are the following assumptions correct?:
According to https://dxr.mozilla.org/mozilla-central/source/toolkit/components/extensions/ExtensionShortcuts.jsm#377 this involves the creation of a <key>, so the whole WebExtensions are mainly creating an internal XUL which is then executed?

This is where I am stuck:

  1. I don't know where <key> is handled, is it here?
  2. According to the Documentation, The key element defines a window-global keyboard shortcut and must be placed inside a keyset element., so that means we would need to change the specification of XUL so that key isn't necessarily window-global and/or that an attribute global="true" is allowed? This makes the fix more complicated/official, if I understand that correct?

Thanks in Advance

Any update on this? I'm a heavy Firefox user on desktop and mobile (Android). That media keys extension is so helpful while doing work and listening to music. The alternative is to switch to Chrome for music playback (music.youtube.com)

The feature has now been released with Firefox 81 (dev edition). I didn't tested every cases possible but it works natively on Windows 10, tested on Youtube, Netflix, Prime Video. It works as global media keys and use the native Windows API (so as any nativemusic/video player, you can pause a media content from Firefox while playing a video game on your main screen just by pressing the play pause key).

But, the purpose of this issue was to add an API to allow webextensions to use it (I don't know if it has been done). I'm not sure it would even that be that useful now, as the main purpose of the API (at least for me) was to allow what now works natively.

Anyway good job everyone !

please fix this

Severity: normal → S3

The severity field for this bug is relatively low, S3. However, the bug has 24 votes and 53 CCs.
:robwu, could you consider increasing the bug severity?

For more information, please visit auto_nag documentation.

Flags: needinfo?(rob)

The last needinfo from me was triggered in error by recent activity on the bug. I'm clearing the needinfo since this is a very old bug and I don't know if it's still relevant.

Flags: needinfo?(rob)

This is a feature request rather than a defect, but it sure would still be nice to have this. It's sadly another case of "sorry, please use chrome to use this feature" for us.

You need to log in before you can comment on or make changes to this bug.