added signal based music scripts for mpd

Former-commit-id: 99582f4b43
Former-commit-id: 3092e409f5a98198f69b18101aef9cb525d87538
Former-commit-id: b2b953c7175571fbf155ffc49390b1825bdfc5a6
This commit is contained in:
elena 2018-01-12 07:34:42 +02:00
parent a4f4944b5e
commit bd3d86e32e
3 changed files with 32 additions and 0 deletions

15
Scripts/mpd-query.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
# Get mpd state
MPDSTATE="$(mpc | head -2 | tail -1 | awk '{print $1}')"
if [[ "$MPDSTATE" != "[playing]" ]]; then
# echo " ·| "
echo ""
else
# echo " ·> "
echo ""
# echo ""
SONG="$(mpc | head -1)"
notify-send "Now playing:" "$SONG" -i ~/.icons/oomox-wally-flat/actions/scalable/player_play.svg --replace-file /tmp/mpd_notification_id
fi

13
Scripts/mpd_sig.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
# Write PID to that file so other processes can send signals to me
echo $$ > /tmp/mpdinfo_pid
while : # This is the same as "while true".
do
# I do this when I wake up
~/Scripts/mpd-query.sh
# Then I go back to sleep
sleep 1d
#echo "woke up!"
done

4
Scripts/mpd_wakeup.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
MPDINFO_PID="$(cat /tmp/mpdinfo_pid)"
pkill -P $MPDINFO_PID sleep