mirror of
https://github.com/elenapan/dotfiles.git
synced 2026-01-08 09:47:23 +08:00
added signal based music scripts for mpd
Former-commit-id: 99582f4b43
Former-commit-id: 3092e409f5a98198f69b18101aef9cb525d87538
Former-commit-id: b2b953c7175571fbf155ffc49390b1825bdfc5a6
This commit is contained in:
parent
a4f4944b5e
commit
bd3d86e32e
3 changed files with 32 additions and 0 deletions
15
Scripts/mpd-query.sh
Executable file
15
Scripts/mpd-query.sh
Executable 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
13
Scripts/mpd_sig.sh
Executable 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
4
Scripts/mpd_wakeup.sh
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
MPDINFO_PID="$(cat /tmp/mpdinfo_pid)"
|
||||
|
||||
pkill -P $MPDINFO_PID sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue