Skip to content

Instantly share code, notes, and snippets.

@grafov
Created March 22, 2018 23:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grafov/204a62f35ef78175e11074c8374ba00e to your computer and use it in GitHub Desktop.
Save grafov/204a62f35ef78175e11074c8374ba00e to your computer and use it in GitHub Desktop.
Surf with history using Rofi
#!/bin/dash
AGENT="Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090913 Firefox/3.5.3"
#OPTS=-u "$AGENT" -z 1.5
OPTS="-z 1.5"
HISTORY=.rofi-www-history
if [ "$1" = "" ]
then
URL=`cat $HISTORY | rofi -hide-scrollbar -dmenu -p "URL: "`
echo "$URL" | grep -e ^http || CLIP=https://$CLIP
echo "$URL" >> $HISTORY
else
URL=$@
echo "$@" | grep -e ^http && CLIP=https://$CLIP
echo "$@" >> $HISTORY
fi
TMP=`tempfile`
cat $HISTORY | sort | uniq >> $TMP && mv $TMP $HISTORY
rm -f $TMP
if [ "$URL" = "" ]
then
exit 0
fi
/usr/bin/surf $OPTS "$URL"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment