I am trying to write a script file and invoke it using XFCE global shortcut. The script should continue the Audacity application if it is in the stopped state and stop it (pause recording) if it is in the run state. This will be useful when I have defined the same keyboard shortcut for VLC's playback/pause. This way, I can do playback/pause (in VLC) and record/pause (in Audacity) at the same time using the same keyboard shortcut. Getting some ideas from this post I have written the following script and added it to XFCE's custom keyboard settings. But it does not work.
#!/bin/bash if pgrep -f "audacity" ; then pkill -stop audacity && notify-send "Recording stopped" else pkill -cont audacity