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
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 # Select the default audio source
function 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"')) 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 end
# Select sub menu # 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) set input (menu $options)
switch $input switch $input
@ -160,30 +175,39 @@ switch $input
find_file find_file
case $options[4] case $options[4]
wpsourcemenu.fish select_song
# audio_source
case $options[5] case $options[5]
select_song_from_queue
case $options[6]
mpdmenu.fish
case $options[7]
wpsinkmenu.fish wpsinkmenu.fish
# audio_sink # audio_sink
case $options[6] case $options[8]
wpsourcemenu.fish
# audio_source
case $options[9]
bluetoothmenu.fish bluetoothmenu.fish
# bluetooth_connection # bluetooth_connection
case $options[7] case $options[9]
networkmenu.fish networkmenu.fish
# network_connection # network_connection
case $options[8] case $options[11]
color_scheme color_scheme
case $options[9] case $options[12]
restore_notifications restore_notifications
case $options[10] case $options[13]
set_keyboard_backlight set_keyboard_backlight
case $options[11] case $options[14]
mirror_screen mirror_screen
end end

View file

@ -26,18 +26,36 @@ else
set -a message "󰌳" set -a message "󰌳"
end 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%") set input (menu --mesg="$(mpc current --format "%artist% - %album% - %title%")
$(string join -- ' ' $message)" $options) $(string join -- ' ' $message)" $options)
switch $input switch $input
case $options[1] case $options[1]
mpc consume mpc toggle
case $options[2] case $options[2]
mpc random mpc stop
case $options[3] case $options[3]
mpc repeat mpc next
case $options[4] 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 mpc single
end end