You are not logged in.

#1 2017-07-08 17:15:15

Fred7109
Member
Registered: 2015-05-17
Posts: 134

How to send media keys to window

Hello,

I am running Tidal via the tidal-music-linux package on GitHub, link: https://github.com/Bunkerbewohner/tidal-music-linux, because I wanted to be able to use the media keys with Tidal. I then installed the package and running it works just fine, but I can't get the hotkeys to work. I've tried with xdotool:

xdotool key --window [window] XF86AudioPause

From the main.js, please see below, I understand that I need to send the keys "MediaPreviousTrack", "MediaNextTrack", "MediaPlayPause", "MediaStop". However, I don't know how to send media keys, despite using xdotool - which don't work.

  // handle media keys
  var routeShortcuts = ["MediaPreviousTrack", "MediaNextTrack", "MediaPlayPause", "MediaStop"]
  routeShortcuts.forEach(shortcut => {
    if (!globalShortcut.register(shortcut, function() {
      mainWindow.webContents.send("playback-control", shortcut)
    })) {
      console.log("Failed to register shortcut", shortcut, "Is your desktop environment already handling it?"$
    }
  })

Any help regarding the issue would be greatly appreciated.

Last edited by Fred7109 (2017-07-08 17:16:20)

Offline

#2 2017-07-08 17:41:46

evilteemo
Member
From: cyberspace
Registered: 2016-11-12
Posts: 10
Website

Re: How to send media keys to window

Hi,

take a look at https://wiki.archlinux.org/index.php/Xbindkeys

I once had luck with this ;-)

Offline

#3 2017-07-09 16:32:59

Fred7109
Member
Registered: 2015-05-17
Posts: 134

Re: How to send media keys to window

Hello evilteemo,

Thank you for the reply!

I use sxhkd instead of Xbindkeys, as they both can create hotkeys that activates a command which, for example, with Xdotool, can send a given key to the Tidal window. However, my problem is that the keys I send to the Tidal window don't activate the function as described above - eg. to shift song with "MediaNextTrack".

Last edited by Fred7109 (2017-07-09 16:34:55)

Offline

#4 2017-07-09 20:41:15

evilteemo
Member
From: cyberspace
Registered: 2016-11-12
Posts: 10
Website

Re: How to send media keys to window

Offline

#5 2017-07-10 20:45:42

Fred7109
Member
Registered: 2015-05-17
Posts: 134

Re: How to send media keys to window

Thank you for the help evilteemo, I will look into your proposals and see whether I can work something out.

Offline

Board footer

Powered by FluxBB