dotfiles

My collection of dotfiles
git clone git://git.noxz.tech/dotfiles
Log | Files | Refs

dmenu_sscw (673B)


      1 #!/bin/sh
      2 
      3 args=" -p soundcloud"
      4 choice=""
      5 existing=""
      6 options=""
      7 term=""
      8 
      9 term="$(echo -n | dmenu_vtc${args} -l 0)"
     10 [ "$term" = "" ] && exit 1
     11 options="$(printf "$term" | sscw-search -s)"
     12 [ "$options" = "" ] && exit 1
     13 titles="$(echo "$options" | \
     14 	cut -d "$(printf '\t')" -f 1,2 --output-delimiter=" - " | \
     15 	awk '{ print FNR " " $0 }')"
     16 urls="$(echo "$options" | \
     17 	cut -d "$(printf '\t')" -f 4 | \
     18 	awk '{ print FNR " " $0 }')"
     19 title="$(printf "$titles" | dmenu_vtc${args} -l 20 -p "soundcloud > $term:")" # get -p from input and append "\b > $term:"
     20 
     21 [ "$title" = "" ] && exit 1
     22 url="$(printf "$urls" | grep "^${title%% *} ")"
     23 dmenu_url_open "${url#* }" "${title#* }"