How to add global hotkeys to SMPlayer ?

mohamad wael
2 min readSep 26, 2020

--

To add global keyboard shortcuts for SMPlayer , like to toggle playing on or off , this can be done like this .

First install SMPlayer :

$ pkg install smplayer 
# run as root under freebsd .
$ apt-get install smplayer
# run as root under Debian .

next install playerctrl :

$ pkg install playerctl
# run as root under freebsd .
$ apt-get install playerctl
# run as root under Debian .

playerctl enables the control of media players from the command line . For example to toggle play on or off for smplayer , the following command can be issued :

playerctl play-pause smplayer

A list of all the commands that can be used with playerctl can be found here .

To create a global hotkey for smplayer , under any desktop , first create a script containing the playerctrl command you want to create a shortcut for, next assign a hotkey to this script using your desktop .

For example to create a global shortcut for the toggle play command , first create this script :

$ echo '#!/bin/sh' > playerctl-play-pause.sh 
$ echo 'playerctl play-pause smplayer' >> playerctl-play-pause.sh

Next make it executable :

$ chmod +x playerctl-play-pause.sh

move it to where you keep your scripts .

$ mv playerctl-play-pause.sh ~/bin/ 
# move the playerctl-play-pause.sh
# script to my home directory bin
# folder .

Assign a shortcut to it using your desktop , for example if using xfce , click on Application Finder , and launch keyboard .

Select Application Shortcuts , then click on add , and select a path for your script .

Next assign a keyboard shortcut to it.

And that is it , now you can toggle the play of smplayer on or off using the keyboard shortcut you just selected .

Originally published at https://twiserandom.com on September 26, 2020.

--

--

No responses yet