implement mpd client
This commit is contained in:
parent
4c81c0ca4a
commit
decdd636d4
2 changed files with 57 additions and 15 deletions
|
|
@ -46,6 +46,21 @@ function open_course
|
|||
end
|
||||
end
|
||||
|
||||
function select_song
|
||||
set artist (mpc list albumartist | fuzzel --dmenu || exit)
|
||||
set album (mpc list album albumartist $artist | fuzzel --dmenu || exit)
|
||||
set title (mpc list title album $album | fuzzel --dmenu || exit)
|
||||
|
||||
mpc findadd album $album
|
||||
mpc searchplay title $title
|
||||
end
|
||||
|
||||
function select_song_from_queue
|
||||
set title (mpc playlist --format "%artist%\t%title%" | fuzzel --dmenu --select=(mpc current --format "%artist%\t%title%") --accept-nth 2 || exit)
|
||||
|
||||
mpc searchplay $title
|
||||
end
|
||||
|
||||
# Select the default audio source
|
||||
function audio_source
|
||||
set dump (string trim -c '"' (pw-dump | jq '.[] | select(.info.props."media.class" == "Audio/Source")' | jq '.id, .info.props."node.description"'))
|
||||
|
|
@ -146,7 +161,7 @@ function mirror_screen
|
|||
end
|
||||
|
||||
# Select sub menu
|
||||
set options " Open Semester" " Open WueCampus Course" " Find Files" " Select Audio Source" " Select Audio Sink" " Select Bluetooth" " Select Network" " Select Color Scheme" " Restore Notifications" " Set Keyboard Backlight" " Mirror Screen"
|
||||
set options " Open Semester" " Open WueCampus Course" " Find Files" " Add Album" " Select Song from Queue" " MPD Settings" " Select Audio Sink" " Select Audio Source" " Select Bluetooth" " Select Network" " Select Color Scheme" " Restore Notifications" " Set Keyboard Backlight" " Mirror Screen"
|
||||
set input (menu $options)
|
||||
|
||||
switch $input
|
||||
|
|
@ -160,30 +175,39 @@ switch $input
|
|||
find_file
|
||||
|
||||
case $options[4]
|
||||
select_song
|
||||
|
||||
case $options[5]
|
||||
select_song_from_queue
|
||||
|
||||
case $options[6]
|
||||
mpdmenu.fish
|
||||
|
||||
case $options[7]
|
||||
wpsinkmenu.fish
|
||||
# audio_sink
|
||||
|
||||
case $options[8]
|
||||
wpsourcemenu.fish
|
||||
# audio_source
|
||||
|
||||
case $options[5]
|
||||
wpsinkmenu.fish
|
||||
# audio_sink
|
||||
|
||||
case $options[6]
|
||||
case $options[9]
|
||||
bluetoothmenu.fish
|
||||
# bluetooth_connection
|
||||
|
||||
case $options[7]
|
||||
case $options[9]
|
||||
networkmenu.fish
|
||||
# network_connection
|
||||
|
||||
case $options[8]
|
||||
case $options[11]
|
||||
color_scheme
|
||||
|
||||
case $options[9]
|
||||
case $options[12]
|
||||
restore_notifications
|
||||
|
||||
case $options[10]
|
||||
case $options[13]
|
||||
set_keyboard_backlight
|
||||
|
||||
case $options[11]
|
||||
case $options[14]
|
||||
mirror_screen
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,18 +26,36 @@ else
|
|||
set -a message ""
|
||||
end
|
||||
|
||||
set options " Play/Pause" " Stop" " Next" " Previous" " Consume" " Random" " Repeat" " Single"
|
||||
set options " Play/Pause" " Stop" " Next" " Previous" " Clear Queue" " Consume" " Random" " Repeat" " Single"
|
||||
|
||||
set input (menu --mesg="$(mpc current --format "%artist% - %album% - %title%")
|
||||
$(string join -- ' ' $message)" $options)
|
||||
|
||||
switch $input
|
||||
case $options[1]
|
||||
mpc consume
|
||||
mpc toggle
|
||||
|
||||
case $options[2]
|
||||
mpc random
|
||||
mpc stop
|
||||
|
||||
case $options[3]
|
||||
mpc repeat
|
||||
mpc next
|
||||
|
||||
case $options[4]
|
||||
mpc prev
|
||||
|
||||
case $options[5]
|
||||
mpc clear
|
||||
|
||||
case $options[6]
|
||||
mpc consume
|
||||
|
||||
case $options[7]
|
||||
mpc random
|
||||
|
||||
case $options[8]
|
||||
mpc repeat
|
||||
|
||||
case $options[9]
|
||||
mpc single
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue