implement mpd client

This commit is contained in:
Never Gude 2026-07-12 16:11:41 +02:00
parent 4c81c0ca4a
commit decdd636d4
2 changed files with 57 additions and 15 deletions

View file

@ -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