This repository has been archived by the owner on May 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dmenu-mpd-wal.sh
executable file
·76 lines (63 loc) · 2.43 KB
/
dmenu-mpd-wal.sh
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
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Colours from pywal
. "${HOME}/.cache/wal/colors.sh"
# Dmenu arguments for colours
# Change "System San Francisco Display-13" to your front in form "[full name]-[size]"
font="System San Francisco Display-12"
crossfade() {
local crossfade=`echo -e "0\n5" | dmenu -i -nb "$color0" -nf "$color15" -sb "$color1" -sf "$color15" -fn "$font" -p "Crossfade"`
mpc crossfade $crossfade
}
current() {
# For a formatted current output
#echo -e `mpc current -f "%track% - %title% - %artist% - %album%"` | dmenu -i -nb "$color0" -nf "$color15" -sb "$color1" -sf "$color15" -fn "$font" -p "Crossfade"
echo -e `mpc current` | dmenu -i -nb "$color0" -nf "$color15" -sb "$color1" -sf "$color15" -fn "$font" -p "Crossfade"
}
seek() {
local seek=`echo -e "[+-]\n[<HH:MM:SS>]\nor\n<[+-]0-100>%>" | dmenu -i -nb "$color0" -nf "$color15" -sb "$color1" -sf "$color15" -fn "$font" -p "Seek"`
mpc seek "$seek"
}
search() {
local artist=`mpc list albumartist | dmenu -i -nb "$color0" -nf "$color15" -sb "$color1" -sf "$color15" -fn "$font" -p "Artist"`
local albumlist=`mpc list album artist "$artist"`
local album=`echo -e "[ALL]\n$albumlist" | dmenu -i -nb "$color0" -nf "$color15" -sb "$color1" -sf "$color15" -fn "$font" -p "Album"`
mpc clear
if [[ $album == '[ALL]' ]];
then
mpc find artist "$artist" | mpc add
else
mpc find artist "$artist" album "$album" | mpc add
fi
mpc play
}
playlist() {
local track=`mpc playlist -f "%position% - %title% - %artist% - %album%" | dmenu -i -nb "$color0" -nf "$color15" -sb "$color1" -sf "$color15" -fn "$font" -l 5 -p "Track"`
mpc play "${track%% *}"
}
load() {
local load=`mpc lsplaylists | dmenu -i -nb "$color0" -nf "$color15" -sb "$color1" -sf "$color15" -fn "$font" -l 5 -p "Track"`
mpc clear
mpc load "$load"
mpc play
}
# Get user action
RESULT=`echo -e "Consume\nCrossfade\nCurrent\nNext\nPause\nPlay\nPrev\nRandom\nRepeat\nSingle\nSeek\nStop\nToggle\nClear\nSearch\nPlaylist\nLoad" | dmenu -i -nb "$color0" -nf "$color15" -sb "$color1" -sf "$color15" -fn "$font" -p "Music"`
case "$RESULT" in
Consume) `mpc consume` ;;
Crossfade) crossfade ;;
Current) current ;;
Next) `mpc next` ;;
Pause) `mpc pause` ;;
Play) `mpc play` ;;
Prev) `mpc prev` ;;
Random) `mpc random` ;;
Repeat) `mpc repeat` ;;
Single) `mpc single` ;;
Seek) seek ;;
Stop) `mpc stop` ;;
Toggle) `mpc toggle` ;;
Clear) `mpc clear` ;;
Search) search ;;
Playlist) playlist ;;
Load) load ;;
esac