summaryrefslogtreecommitdiffstats
path: root/current
blob: 4d21bd35747d656870a0ade50b4b77ed6defcee4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/zsh
[[ -z $1 ]] && exit 1
typeset -A choice
choice=(current ~/.current url ~/urls all "$HOME/.current $HOME/urls")
setopt shwordsplit
export yprofile="current"

while :;do
    object=$(tac $=choice[$1] |  awk 'NF>0 { print $0 }' | ${DMENU} )
    [[ -z $object ]] && break
    object=${(Q)object}
    URL=$(perl -MRegexp::Common=URI -lne 'm{$RE{URI}{HTTP}{-scheme => qr/https?/}{-keep}}  && print $1' <<< $object)
    if isurl $URL;then firefox -new-tab $URL; continue ;fi
    xclip -i <<< "$object"
    if =$object;then  $object &!;fi
done