forked from owl4ce/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmusic-controller
executable file
·67 lines (63 loc) · 1.69 KB
/
music-controller
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
# Music (mpd/spotify) controller
current="$(cat ~/.config/openbox/music-player)"
if [[ $current == *"mpd"* ]]; then
prev="mpc -q prev"
toggle="mpc -q toggle"
stop="mpc -q stop"
next="mpc -q next"
status="mpc status"
title="$(mpc current)"
else
if [[ $current == *"spotify"* ]]; then
prev="playerctl -p spotify previous"
toggle="playerctl -p spotify play-pause"
stop="playerctl -p spotify stop"
next="playerctl -p spotify next"
status="playerctl -p spotify status"
title="$(playerctl -p spotify metadata -f '{{artist}} - {{title}}')"
else
prev=""
toggle=""
stop=""
next=""
status=""
title="There is no mpd or spotify installed"
fi
fi
case $1 in
icon)
# For playback status on the panel
# Requires Material (Icomoon) Font
if [[ $($status) == *"laying"* ]]; then
echo ""
else
echo ""
fi
;;
prev)
bash -c "$prev"
;;
toggle)
bash -c "$toggle"
;;
stop)
bash -c "$stop" && ~/.scripts/notify/notify-send.sh -u low -i "~/.icons/gladient/music.png" -r 8888 "Music Player" "Stopped"
;;
next)
bash -c "$next"
;;
title)
# For song title on the panel
echo "$title"
;;
switchpl)
# Switch music player between mpd and spotify
if [[ $current == *"mpd"* ]]; then
echo "spotify" > ~/.config/openbox/music-player
else
echo "mpd" > ~/.config/openbox/music-player
fi
~/.scripts/notify/notify-send.sh -u low -i "~/.icons/gladient/music.png" -r 8888 "Music Player" "Set <u>`cat ~/.config/openbox/music-player`</u> as default"
;;
esac