#!/bin/sh set -e if [ -t 1 -a "$1" != '-g' ]; then pick() { sk } inject() { echo "$@" } else pick() { if pgrep wayland >/dev/null; then skmenu else dmenu -i -l 10 fi } inject() { if pgrep wayland >/dev/null; then wtype -s 500 "$*" else window="$(xdotool getwindowfocus)" xdotool type --clearmodifiers --window "$window" "$*" xdotool windowfocus "$window" fi } fi if wl-paste -h >/dev/null; then primary() { wl-paste --primary; } clip() { wl-paste; } else primary() { xclip -o; } clip() { xclip -o -sel c; } fi choice="$(pick <\(.*\) - song \(and lyrics \)\?by \(.*\) | Spotify.*@\1 _van_ \3@p')" ;; esac