[LAU] Toggle Jack Transport CLI

hollundertee at gmx.net hollundertee at gmx.net
Mon Dec 19 11:42:46 UTC 2016


On Tue, 15 Nov 2016 23:18:48 +0100
Christopher Arndt <chris at chrisarndt.de> wrote:

> Am 15.11.2016 um 22:48 schrieb Yassin Philip:
> > Thanks everyone, I got my transport toggle
> > now! It's disturbingly hacky, but it works :)  
> 
> Well, I showed you a comfortingly non-hacky solution. But if you want
> to continue funling around with bash, it's your call. ;)
> 
> Chris

Thanks everyone, I adapted the script according to your suggestions.
Here is my version, which seems to work so far. Note that I reset jack
transport to 0 after stopping it. If you have any suggestions as to how
to improve it, please mention them. I am by no means an expert in bash
scripting. In fact, I pasionately hate that language.

Regards,
Philipp


#!/usr/bin/env bash

function jack_transport_status() {
  jack_showtime | head -n1 & >/dev/null 2>&1
  wait
}

if jack_transport_status | grep -q -i stopped
then
  echo play | jack_transport >/dev/null 2>&1
else
	echo stop | jack_transport >/dev/null 2>&1
	echo locate 0 | jack_transport >/dev/null 2>&1
fi


More information about the Linux-audio-user mailing list