[wiki] [sites] wiki updated

From: <hg_AT_suckless.org>
Date: Fri, 2 Apr 2010 11:25:04 +0000 (UTC)

changeset: 494:3a8ec6b73f00
tag: tip
user: nibble
date: Fri Apr 02 13:25:21 2010 +0200
files: surf.suckless.org/files/bmarks.md
description:
update bmarks script


diff -r b3fe224c0852 -r 3a8ec6b73f00 surf.suckless.org/files/bmarks.md
--- a/surf.suckless.org/files/bmarks.md Thu Apr 01 16:20:52 2010 +0200
+++ b/surf.suckless.org/files/bmarks.md Fri Apr 02 13:25:21 2010 +0200
_AT_@ -15,7 +15,6 @@
 URL handlers
 ------------
         This script implements several url handlers
- "b tag .." (open bookmark matching given tags or keywords)
         "d " (bookmark current url in delicious)
         "t " (create tinyurl from current page)
         "w word .." (lookup word in wikipedia)
_AT_@ -51,44 +50,37 @@
         normfgcolor='#e9e9e9'
         selbgcolor='#dd6003'
         selfgcolor='#e9e9e9'
- hist=~/.surf/history.txt
+ bmarks=~/.surf/bookmarks.txt
 
         xid=$1
         p=$2
         uri=`xprop -id $xid _SURF_URI | cut -d '"' -f 2`
- name=`xprop -id $xid WM_ICON_NAME | cut -d '"' -f 2`
+ kw=`xprop -id $xid _SURF_FIND | cut -d '"' -f 2`
         dmenu="dmenu -e $xid -fn $font -nb $normbgcolor -nf $normfgcolor \
- -sb $selbgcolor -sf $selfgcolor"
+ -sb $selbgcolor -sf $selfgcolor"
 
- s_set_uri() { # uri
- xprop -id $xid -f _SURF_URI 8s -set _SURF_URI "$1"
+ s_xprop() {
+ [ -z "$2" ] || xprop -id $xid -f $1 8s -set $1 "$2"
         }
 
         case "$p" in
         "_SURF_FIND")
- find="`echo | $dmenu -p find:`"
- xprop -id $xid -f _SURF_FIND 8s -set _SURF_FIND "$find"
+ find="`echo $kw | $dmenu -p find:`"
+ s_xprop _SURF_FIND "$find"
                 ;;
         "_SURF_BMARK")
- tags="`echo | $dmenu -p tags:`"
- [ -n "$tags" ] && \
- grep "$uri" $hist >/dev/null 2>&1 || echo "$uri $tags" >> $hist
+ grep "$uri" $bmarks >/dev/null 2>&1 || echo "$uri" >> $bmarks
                 ;;
         "_SURF_URI_RAW")
- uri="`echo | $dmenu -p uri:`"
- s_set_uri "$uri"
+ uri=`echo $uri | $dmenu -p "uri:"`
+ s_xprop _SURF_URI "$uri"
                 ;;
         "_SURF_URI")
- sel=`tac $hist 2> /dev/null | cut -d ' ' -f 1 | $dmenu -p "uri [bdgtwy*]:"`
- # if we hit escape, then exit
+ sel=`tac $bmarks 2> /dev/null | $dmenu -p "uri [dgtwy*]:"`
                 [ -z "$sel" ] && exit
                 opt=$(echo $sel | cut -d ' ' -f 1)
                 arg=$(echo $sel | cut -d ' ' -f 2-)
                 case "$opt" in
- "b") # find in bookmarks
- kw=$(echo $arg | sed -s 's, , -e,g')
- uri="`grep -e $kw $hist | head -n 1 | cut -d ' ' -f 1`"
- ;;
                 "d") # del.icio.us
                         uri="http://del.icio.us/save?url=$uri"
                         ;;
_AT_@ -108,7 +100,7 @@
                         uri="$sel"
                         ;;
                 esac
- s_set_uri "$uri"
+ s_xprop _SURF_URI "$uri"
                 ;;
         *)
                 echo Unknown xprop
Received on Fri Apr 02 2010 - 13:25:04 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:31:12 CEST