blob: 6bfbd16e99de2178b806a4420ab252cf2ef48abe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/bin/bash
# A script to manage the music player daemon (mpd) on my system
# Depends on: mpd, playerctl, libnotify
# By David Penkowoj, 2024-09-16
music_state="$(mpc | grep -o playing)"
music_name="$(basename "$(mpc current)")"
notify_music() {
if [[ -n "$music_state" ]]; then
notify-send "Currently playing" "${music_name%.*}"
else
notify-send "MPD is currently paused"
fi
}
case "$1" in
"previous")
mpc -q prev
playerctl -s previous
;;
"toggle")
mpc -q toggle
playerctl -s play-pause
;;
"next")
mpc -q next
playerctl -s next
;;
"notify")
notify_music
;;
*)
printf "[ Error ] Usage: musctl [previous|toggle|next|notify]"
exit 1
;;
esac
|