How to create shortcut to stop and minimize media player

I don’t follow. What do you mean?

Which part are you not clear on?

I mean I’ve already written out all the steps needed to create a shell script (a program) here

i applied those shell scripts and then installed the

xdotool

and

playerctl

will this affect that ?

i did all those

now i am stuck on setting the shortcut

You wrote the shell script already? Just to confirm, you have a text file called pause-and-minimize-vlc.sh inside your home folder, correct?

What desktop environment are you using? Run

echo $XDG_CURRENT_DESKTOP

i applied your shell script
as you told me

i didnt made my own

KDE

No. I won’t affect anything. The shell script you’ve just written will run playerctl and xdotool commands when it is launched, so it will work as long as you have both installed on your system.

now how to set the shortcut in KDE environment

I don’t use KDE, so I’m not sure. So I was looking it up.

https://www.addictivetips.com/ubuntu-linux-tips/customize-keyboard-shortcuts-on-kde-plasma-5/

I’m pretty sure you need to select the “run command” tab.

After you select the “run command” tab in the settings, you have to type in the full path of the shell script and then define the keyboard shortcut.

Don’t use ESC. Use something like Win+M. The ESC key has other uses; you don’t want any conflicts there.

cant find the run command

What happens when you click ‘add command’?

No… I meant the “add command” at the bottom of the window. A button for you to click.

image

should i choose the .sh file that i created ?

Yup. Exactly.

assigned the HOME button…

now will have to log out log in ?

It depends. Test out the playerctl command from the terminal first. Open a video file with vlc. Then, go to your terminal and run playerctl --player=vlc pause. Does the video pause?

yes it paused the video