So I bought this keyboard for my laptop that doesn't have media keys on it and I am very used to pressing the play/pause button on my laptop to pause any media playing in the background. With this keyboard however I have to create my own keyboard shortcuts to do that because of the absence of media keys. Till now I have managed to make keyboard shortcuts for volume control.
Research and my attempts:
I found this page which shows a command to simulate media keys from the terminal. https://askubuntu.com/questions/235126/simulate-media-keys-in-terminal/235181#235181. The command is
xdotool key XF86AudioPlaybut when I make a keyboard shortcut out of this by going to Settings > Keyboard > Application Shortcuts. It doesn't seem to work.When I press the keyboard shortcut which I have set to Super+F11 my CPU usage rises a bit which means that the shortcut is working. I confirmed this by changing the command the shortcuts executes to
exo-open --launch WebBrowserwhich as you might have thought opens my web browser when I press Super+F11.Now because I knew a bit of C/C++ I created this wrapper program which does exactly the same thing
#include <stdlib.h>
int main() {
system("xdotool key XF86AudioPlay");
}
and mapped the shortcut to execute this program but Alas!! it still doesn't work.
How do I get the command that XFCE executes when I press the default play/pause button on my laptop keyboard because that seems to play/pause any media playing in the background.
I use XFCE on Arch Linux. I usually listen to music on rhytmbox music play.