Xfce Forum

Sub domains
 

You are not logged in.

#1 2021-05-06 12:44:09

mortenlj
Member
Registered: 2021-05-06
Posts: 2

Assign media controls to keyboard shortcut

In the pulseaudio panel plugin, media players are listed, and it has play/pause, prev and next buttons.

As far as I can tell, these are hooked up to the "symbolic keys" XF86AudioPlay, XF86AudioNext and XF86AudioPrev, which presumably are triggered by dedicated media keys on keyboards that have those.

My keyboard doesn't, so I would like to attach different keyboard shortcuts to those controls.

At first I was hoping some sort of "alias" feature was possible, where I could say that "When I press <Super>+Home, that should be treated as if I had pressed XF86AudioPlay", but I haven't been able to find any signs that this is possible.

I have tried adding a global shortcut that use xdotool, but that doesn't work as a shortcut command (it works from command line):

xdotool key XF86AudioPlay

Is what I want to do possible, without making my shortcuts target the media player directly?

Presumably the panel plugin has some logic to work out which media players are installed/active, and I'd like to make use of that. Especially since I haven't been able to find a way to trigger these actions in Spotify directly (but the panel plugin does it when doing the xdotool command above).

Offline

#2 2021-05-06 14:55:07

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: Assign media controls to keyboard shortcut

Hello and welcome.

The pulseaudio plugin uses the mpris standard to control mpris-enabled players. I just tried the xdotool shortcut and its doesn't work for me either, which is strange.

playerctl is a nice command line client to control mpris-enabled players and works with Xfce's keyboard shortcuts.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2021-05-06 18:34:42

mortenlj
Member
Registered: 2021-05-06
Posts: 2

Re: Assign media controls to keyboard shortcut

Aha! Never heard of playerctl (or mpris) before, but that solved my issue, and feels like a better solution than running a command to generate a keypress. smile

Thanks!

Offline

Board footer

Powered by FluxBB