#!/usr/bin/dash format="%title%\t%artist%\t%album%\t%file%" columns="$(mpc -f "$format" listall \ | column -t -s' ' \ -C title,width=10,trunc \ -C artist,width=10,trunc \ -C album,width=10,trunc \ -C file \ | sed 's/&/&/g' )" np=$(printf "%s" "$columns" | grep "$(mpc -f '%title%' current)" | head -1) echo "$np" selected=$( printf "%s" "$columns" | rofi -dmenu -i \ -multi-select \ -markup-rows \ -p " " \ -ballot-selected-str " " \ -ballot-unselected-str " " \ -select "$np" ) [ -z "$selected" ] && exit echo "$selected" | while read -r option; do file=$(printf "%s\n" "$option" | awk -F' ' '{print $NF}' | sed 's/^\s*//g') echo ${file} mpc insert "$file" done