electron / electron

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

Home Page:https://electronjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

globalShortcut not very global in Wayland

Pajn opened this issue · comments

  • Output of node_modules/.bin/electron --version: v3.0.10
  • Operating System (Platform and Version): Ubuntu 18.10, Wayland
  • Output of node_modules/.bin/electron --version on last known working Electron version (if applicable): N/A

Expected Behavior
After registering a global shortcut it should always be called when that combinations is pressed.
If the DE holds that shortcut it may be captured by the DE though. But a free combination should continue to work when new applications are opened though.

Actual behavior
Some applications, for example gnome-terminal capture the shortcut so that it is registered by the application instead of my global handler.

To Reproduce
Use gnome wayland session, Register a global shortcut and make sure it works, Open gnome-terminal and see that it does not work.

Screenshots
N/A

Additional Information
N/A

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

Given that this has been open for years, that this isn't currently on our roadmap, and in the interest of our issue tracker more closely reflecting our workstreams, i'm going to go ahead and label this a wontfix. However, should someone determine a workable solution we would be potentially open to accepting a PR!

I confirm, this happens to me on Ubuntu 20.04 with Electron 20.1.3. Each time I switch to a Gnome Terminal, globalShortcut's are not working. This makes them not so global.

In order to reproduce just open gnome-terminal and

mkdir a
cd a
echo {} > package.json
cat > app.js << 'EOF'
require('electron').app.whenReady().then(function () {
    const ret = electron.globalShortcut.register('Meta+I', function () {
        console.log('globalShortcut triggers!');
    });
});
EOF
npm install electron
node_modules/.bin/electron app.js

Just want to call out that I stumbled across this Reddit post while attempting to debug Eugeny/tabby#8957. It sounds like Wayland potentially requires manually forwarding the keypress to Electron.

Is there a way to manually fire a keyboard event from the command line?

cc: @codebytere