diff options
Diffstat (limited to 'sway/.local/bin/sway-mpv')
-rwxr-xr-x | sway/.local/bin/sway-mpv | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sway/.local/bin/sway-mpv b/sway/.local/bin/sway-mpv new file mode 100755 index 0000000..a39a0aa --- /dev/null +++ b/sway/.local/bin/sway-mpv @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ ! -t 0 ]; then + set -- "$@" "$(cat)" +elif [ $# -eq 0 ]; then + IFS=: grep -Po '# title: \K.*' "$XDG_STATE_HOME"/mpv/watch_later/* | while IFS=: read -r file match; do + grep -Pom1 '# \K.*' "$file" | tr -d '\n' + printf ': %s\n' "$match" + done + exit 0 +fi + +# shellcheck disable=SC2068 +swaymsg exec -- mpv "${1%*:*}" |