diff options
| author | Karel Kočí <cynerd@email.cz> | 2017-09-30 23:39:43 +0200 | 
|---|---|---|
| committer | Karel Kočí <cynerd@email.cz> | 2017-09-30 23:39:43 +0200 | 
| commit | 48120fbbb4f2b46e44c92d09f90a244717b1812d (patch) | |
| tree | 306b325337faf355517e26a13b7a9b63f6e2c23f /config/i3blocks | |
| parent | 3bf0736b56948274961db6cbdf6b28453fdffbdf (diff) | |
| download | myconfigs-48120fbbb4f2b46e44c92d09f90a244717b1812d.tar.gz myconfigs-48120fbbb4f2b46e44c92d09f90a244717b1812d.tar.bz2 myconfigs-48120fbbb4f2b46e44c92d09f90a244717b1812d.zip  | |
Fix mpd and usbkey
Diffstat (limited to 'config/i3blocks')
| -rwxr-xr-x | config/i3blocks/scripts/mpd | 17 | 
1 files changed, 10 insertions, 7 deletions
diff --git a/config/i3blocks/scripts/mpd b/config/i3blocks/scripts/mpd index 113f6e8..12f0fdd 100755 --- a/config/i3blocks/scripts/mpd +++ b/config/i3blocks/scripts/mpd @@ -1,14 +1,16 @@  #!/bin/bash -HOME="192.168.0.217" -HOST="" +HOST_HOME="192.168.0.51" +HOST=""  # Let's be sneaky and verify that we are on relevant network before we try to ping  if ip a | grep -q 'inet 192.168.0.' && \ -		ping -c 1 -w 1 "$HOME" >/dev/null 2>&1; then +		ping -c 1 -w 1 "$HOST_HOME" >/dev/null 2>&1; then  	# TODO check that mpd is running? -	HOST="-h $HOME" +	HOST="-h $HOST_HOME"  fi +STATUS="$(mpc $HOST status)" +  # Handle remote volume  if [ "$BLOCK_INSTANCE" = "remote" ]; then  	[ -n "$HOST" ] || exit 0 @@ -27,7 +29,9 @@ if [ "$BLOCK_INSTANCE" = "remote" ]; then  			;;  	esac -	echo "♫ $(mpc $HOST volume | sed 's/volume: //')" +	if echo "$STATUS" | grep -qE "(playing|paused)"; then +		echo "♫ $(mpc $HOST volume | sed 's/volume: //')" +	fi  	exit 0  fi @@ -40,8 +44,7 @@ case "$BLOCK_BUTTON" in  		mpc $HOST stop >/dev/null  		;;  	3) -		# TODO this doesn't work with host -		nohup urxvt -title "Music player daemon client" -hold -e ncmpcpp 2>&1 >/dev/null & +		nohup urxvt -title "Music player daemon client" -e ncmpcpp $HOST 2>&1 >/dev/null &  		;;  	4)  		mpc $HOST prev >/dev/null  | 
