1

How to make a keyboard shortcut under gnome run a shell script with parameter ?

On terminal the following works fine:

sbv.sh 50%

It adjusts the volume of a speaker. The path of the script is /usr/bin.

But when entered as a command for keyboard-shortcut, neither

/bin/bash sbv.sh 50%
/usr/bin/sbv.sh 50%
gnome-terminal -x sbv.sh 50%

nor

sh -c "sbv.sh 50%"

produce the desired volume-change. The speaker goes mute instead.

If the shortcut is changed to

notify-send "hello"

that produces the notification message, so the keyboard shortcut works alright.

Joseph
  • 11
  • 2

1 Answers1

0

you can call your script as follows

$ gnome-terminal -x /usr/bin/sbv.sh "50%"

I'm using ubuntu 20.04, so, -x parameter seems to be deprecated, If you are using the same version, you'll need to use -- instead of -x.

William Prigol Lopes
  • 1,803
  • 14
  • 31
  • Thank you. - The system is running Ubuntu 18.04 and the -- option is the one that should be used, as you rightly suggested. Unfortunately, as a keyboard shortcut the command does not produce desired behavior. Using quotation marks with the parameter avoids muting the speaker, but it does not adjust volume. Maybe you have another suggestion ? – Joseph Apr 25 '20 at 10:22