From decdd636d4c3474a838cc3638e6e4f5be55b58fe Mon Sep 17 00:00:00 2001 From: Never Gude Date: Sun, 12 Jul 2026 16:11:41 +0200 Subject: [PATCH] implement mpd client --- .local/scripts/actionmenu.fish | 46 ++++++++++++++++++++++++++-------- .local/scripts/mpdmenu.fish | 26 ++++++++++++++++--- 2 files changed, 57 insertions(+), 15 deletions(-) diff --git a/.local/scripts/actionmenu.fish b/.local/scripts/actionmenu.fish index 818847e..d51ade6 100755 --- a/.local/scripts/actionmenu.fish +++ b/.local/scripts/actionmenu.fish @@ -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 diff --git a/.local/scripts/mpdmenu.fish b/.local/scripts/mpdmenu.fish index b8f99c4..613509b 100755 --- a/.local/scripts/mpdmenu.fish +++ b/.local/scripts/mpdmenu.fish @@ -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