From 096a242fbc34ed10bb299b8640abfdbe83b1ed3c Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Fri, 15 Oct 2021 13:44:15 +0200 Subject: [PATCH] bin/fmpc: select mpd song via fzf --- .local/bin/scripts/fmpc | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 .local/bin/scripts/fmpc diff --git a/.local/bin/scripts/fmpc b/.local/bin/scripts/fmpc new file mode 100755 index 0000000..9edb1a5 --- /dev/null +++ b/.local/bin/scripts/fmpc @@ -0,0 +1,7 @@ +#!/bin/sh +# Select a song in the mpd queue using fzf and mpc +local song_position +song_position=$(mpc -f "%position%) %artist% - %title%" playlist | \ + fzf-tmux --query="$1" --reverse --select-1 --exit-0 | \ + sed -n 's/^\([0-9]\+\)).*/\1/p') || return 1 +[ -n "$song_position" ] && mpc -q play $song_position