From 28ed7298a76e6d6b08282bdd14f9f63c123d8804 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 25 Apr 2017 02:42:11 -0400 Subject: [PATCH] shell/fzf: add bin/fzf-mpc --- shell/fzf/bin/fzf-mpc | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 shell/fzf/bin/fzf-mpc diff --git a/shell/fzf/bin/fzf-mpc b/shell/fzf/bin/fzf-mpc new file mode 100755 index 00000000..a4551f91 --- /dev/null +++ b/shell/fzf/bin/fzf-mpc @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +song_position=$(mpc -f "%position%) %artist% - %title%" playlist | \ + gui-fzf --query="$1" --select-1 --exit-0 | \ + sed -n 's/^\([0-9]\+\)).*/\1/p') || return 1 +[[ -n "$song_position" ]] && mpc -q play "$song_position"