[wiki] [sites] wiki updated

From: <hg_AT_suckless.org>
Date: Thu, 22 Apr 2010 04:58:35 +0000 (UTC)

changeset: 505:2307fd2eabbd
tag: tip
user: Andrew Antle <andrew dot antle at gmail dot com>
date: Thu Apr 22 00:56:26 2010 -0400
files: surf.suckless.org/files/bmarks-history.md surf.suckless.org/files/bmarks_history.md surf.suckless.org/files/bmarks_sprop.md surf.suckless.org/files/sprop_bookmarking.md
description:
Standardize filename for bmarks_history.md, update sprop bmark script.


diff -r e23de4bd6fed -r 2307fd2eabbd surf.suckless.org/files/bmarks-history.md
--- a/surf.suckless.org/files/bmarks-history.md Fri Apr 16 01:34:56 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
_AT_@ -1,170 +0,0 @@
-BOOKMARKS FOR SURF
-==================
-
-Description
------------
-
-This script enables bookmarks, url handlers, and history (find and url entries) for surf.
-NB: This script obviates the need to patch surf at all with, e.g., the history or the url handlers patches!
-
-Keybindings
------------
- ^I (get some information)
- ^b (bookmark current url with given tags)
- ^g (open url with bookmark autocompletion)
- ^G (open url without bookmark autocompletion)
-
-URL handlers
-------------
- This script implements several url handlers
- "d " (bookmark current url in delicious)
- "t " (create tinyurl from current page)
- "w word .." (lookup word in wikipedia)
- "g word .." (google for given word)
- "y word .." (search in youtube)
- "x word .." (remove an entry from the bookmarks file)
-Author
-------
-
-- The code was originally from Peter John Hartman, then filtered through pancake and nibble (see their bmarks)
-and now back to Peter John Hartman. You can get the latest version at http://durandus.trilidun.org/durandus/code/surf/.
-
-Installation
-------------
-
-Copy the following code into a shellscript named 'surf.sh' in $PATH. Edit config.h according to the rules explained in header.
-
-Code
-----
- #!/bin/sh
- # this script does:
- # * stores history of: (1) successful uri entries; (2) certain smart prefix entries, e.g., "g foobar"; (3) find entries
- # * direct bookmark (via ^b)
- # * information debug (via ^I)
- # * smart prefixes e.g. g for google search, t for tinyurl, etc.
- # * delete (with smart prefix x)
- #
- # $1 = $xid
- # $2 = $p = _SURF_FIND _SURF_BMARK _SURF_URI (what SETPROP sets in config.h)
- #
- # // replace default setprop with this one
- # #define SETPROP(p) { .v = (char *[]){ "/bin/sh", "-c", "surf.sh $1 $0", p, winid, NULL } }
- #
- # { MODKEY, GDK_b, spawn, SETPROP("_SURF_BMARK") },
- # { MODKEY|GDK_SHIFT_MASK, GDK_i, spawn, SETPROP("_SURF_INFO") },
- # { MODKEY|GDK_SHIFT_MASK, GDK_g, spawn, SETPROP("_SURF_URI_RAW") },
-
- font='-*-terminus-medium-*-*-*-*-*-*-*-*-*-*-*'
- normbgcolor='#181818'
- normfgcolor='#e9e9e9'
- selbgcolor='#dd6003'
- selfgcolor='#e9e9e9'
- bmarks=~/.surf/history.txt
- ffile=~/.surf/find.txt # pjh
-
- xid=$1
- p=$2
- dmenu="dmenu -e $xid -fn $font -nb $normbgcolor -nf $normfgcolor \
- -sb $selbgcolor -sf $selfgcolor"
-
- s_get_prop() { # xprop
- xprop -id $xid $1 | cut -d '"' -f 2
- }
-
- s_set_prop() { # xprop value
- [ -n "$2" ] && xprop -id $xid -f $1 8s -set $1 "$2"
- }
-
- s_write_f() { # file value
- [ -n "$2" ] && (sed -i "\|$2|d" $1; echo "$2" >> $1)
- #grep "$uri" $bmarks >/dev/null 2>&1 || echo "$uri" >> $bmarks
- }
-
- s_set_write_proper_uri() { # uri
- # input is whatever the use inputed, so don't store that!
- # first, clear the name field because surf doesn't sometimes
- s_set_prop WM_ICON_NAME ""
- # set the uri
- s_set_prop _SURF_URI "$1"
- # get the new name
- name=`s_get_prop WM_ICON_NAME`
- # loop until the [10%] stuff is finished and we have a load (is this necessary?)
- while echo $name | grep "[*%\]" >/dev/null 2>&1; do
- name=`s_get_prop WM_ICON_NAME`
- done
- # bail on error and don't store
- if [[ $name != "Error" ]]; then
- uri=`s_get_prop _SURF_URI`
- # store to the bmarks file the OFFICIAL url (with http://whatever)
- s_write_f $bmarks "$1"
- #grep "$uri" $bmarks >/dev/null 2>&1 || echo "$uri" >> $bmarks
- fi
- }
-
- case "$p" in
- "_SURF_INFO")
- xprop -id $xid | sed 's/\t/ /g' | $dmenu -b -l 20
- ;;
- "_SURF_FIND")
- find="`tac $ffile 2>/dev/null | $dmenu -b -p find:`"
- s_set_prop _SURF_FIND "$find"
- s_write_f $ffile "$find"
- ;;
- "_SURF_BMARK")
- uri=`s_get_prop _SURF_URI`
- s_write_f $bmarks "$uri"
- ;;
- "_SURF_URI_RAW")
- uri=`echo $(s_get_prop _SURF_URI) | $dmenu -b -p "uri:"`
- s_set_prop _SURF_URI "$uri"
- ;;
- "_SURF_URI")
- sel=`tac $bmarks 2> /dev/null | $dmenu -b -l 5 -p "uri [dgtwuy*]:"`
- [ -z "$sel" ] && exit
- opt=$(echo $sel | cut -d ' ' -f 1)
- arg=$(echo $sel | cut -d ' ' -f 2-)
- save=0
- case "$opt" in
- "d") # del.icio.us
- uri="http://del.icio.us/save?url=`s_get_prop _SURF_URI`"
- ;;
- "g") # google for it
- uri="http://www.google.com/search?q=$arg"
- save=1
- ;;
- "t") # tinyurl
- uri="http://tinyurl.com/create.php?url=`s_get_prop _SURF_URI`"
- ;;
- "w") # wikipedia
- uri="http://wikipedia.org/wiki/$arg"
- save=1
- ;;
- "u") # utoronto
- uri="http://search2.library.utoronto.ca/UTL/index?N=0&Ntk=Anywhere&Ntt=$arg&Ntx=mode%2Bmatchallpartial&Nu=p_work_normalized&Np=1&formName=search_form_simple"
- save=1
- ;;
- "y") # youtube
- uri="http://www.youtube.com/results?search_query=$arg&aq=f"
- save=1
- ;;
- "x") # delete
- sed -i "\|$arg|d" $bmarks
- exit;
- ;;
- *)
- uri="$sel"
- save=2
- ;;
- esac
-
- # only set the uri; don't write to file
- [ $save -eq 0 ] && s_set_prop _SURF_URI "$uri"
- # set the url and write exactly what the user inputed to the file
- [ $save -eq 1 ] && (s_set_prop _SURF_URI "$uri"; s_write_f $bmarks "$sel")
- # try to set the uri only if it is a success
- [ $save -eq 2 ] && s_set_write_proper_uri "$uri"
- ;;
- *)
- echo Unknown xprop
- ;;
- esac
diff -r e23de4bd6fed -r 2307fd2eabbd surf.suckless.org/files/bmarks_history.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/surf.suckless.org/files/bmarks_history.md Thu Apr 22 00:56:26 2010 -0400
_AT_@ -0,0 +1,170 @@
+BOOKMARKS FOR SURF
+==================
+
+Description
+-----------
+
+This script enables bookmarks, url handlers, and history (find and url entries) for surf.
+NB: This script obviates the need to patch surf at all with, e.g., the history or the url handlers patches!
+
+Keybindings
+-----------
+ ^I (get some information)
+ ^b (bookmark current url with given tags)
+ ^g (open url with bookmark autocompletion)
+ ^G (open url without bookmark autocompletion)
+
+URL handlers
+------------
+ This script implements several url handlers
+ "d " (bookmark current url in delicious)
+ "t " (create tinyurl from current page)
+ "w word .." (lookup word in wikipedia)
+ "g word .." (google for given word)
+ "y word .." (search in youtube)
+ "x word .." (remove an entry from the bookmarks file)
+Author
+------
+
+- The code was originally from Peter John Hartman, then filtered through pancake and nibble (see their bmarks)
+and now back to Peter John Hartman. You can get the latest version at http://durandus.trilidun.org/durandus/code/surf/.
+
+Installation
+------------
+
+Copy the following code into a shellscript named 'surf.sh' in $PATH. Edit config.h according to the rules explained in header.
+
+Code
+----
+ #!/bin/sh
+ # this script does:
+ # * stores history of: (1) successful uri entries; (2) certain smart prefix entries, e.g., "g foobar"; (3) find entries
+ # * direct bookmark (via ^b)
+ # * information debug (via ^I)
+ # * smart prefixes e.g. g for google search, t for tinyurl, etc.
+ # * delete (with smart prefix x)
+ #
+ # $1 = $xid
+ # $2 = $p = _SURF_FIND _SURF_BMARK _SURF_URI (what SETPROP sets in config.h)
+ #
+ # // replace default setprop with this one
+ # #define SETPROP(p) { .v = (char *[]){ "/bin/sh", "-c", "surf.sh $1 $0", p, winid, NULL } }
+ #
+ # { MODKEY, GDK_b, spawn, SETPROP("_SURF_BMARK") },
+ # { MODKEY|GDK_SHIFT_MASK, GDK_i, spawn, SETPROP("_SURF_INFO") },
+ # { MODKEY|GDK_SHIFT_MASK, GDK_g, spawn, SETPROP("_SURF_URI_RAW") },
+
+ font='-*-terminus-medium-*-*-*-*-*-*-*-*-*-*-*'
+ normbgcolor='#181818'
+ normfgcolor='#e9e9e9'
+ selbgcolor='#dd6003'
+ selfgcolor='#e9e9e9'
+ bmarks=~/.surf/history.txt
+ ffile=~/.surf/find.txt # pjh
+
+ xid=$1
+ p=$2
+ dmenu="dmenu -e $xid -fn $font -nb $normbgcolor -nf $normfgcolor \
+ -sb $selbgcolor -sf $selfgcolor"
+
+ s_get_prop() { # xprop
+ xprop -id $xid $1 | cut -d '"' -f 2
+ }
+
+ s_set_prop() { # xprop value
+ [ -n "$2" ] && xprop -id $xid -f $1 8s -set $1 "$2"
+ }
+
+ s_write_f() { # file value
+ [ -n "$2" ] && (sed -i "\|$2|d" $1; echo "$2" >> $1)
+ #grep "$uri" $bmarks >/dev/null 2>&1 || echo "$uri" >> $bmarks
+ }
+
+ s_set_write_proper_uri() { # uri
+ # input is whatever the use inputed, so don't store that!
+ # first, clear the name field because surf doesn't sometimes
+ s_set_prop WM_ICON_NAME ""
+ # set the uri
+ s_set_prop _SURF_URI "$1"
+ # get the new name
+ name=`s_get_prop WM_ICON_NAME`
+ # loop until the [10%] stuff is finished and we have a load (is this necessary?)
+ while echo $name | grep "[*%\]" >/dev/null 2>&1; do
+ name=`s_get_prop WM_ICON_NAME`
+ done
+ # bail on error and don't store
+ if [[ $name != "Error" ]]; then
+ uri=`s_get_prop _SURF_URI`
+ # store to the bmarks file the OFFICIAL url (with http://whatever)
+ s_write_f $bmarks "$1"
+ #grep "$uri" $bmarks >/dev/null 2>&1 || echo "$uri" >> $bmarks
+ fi
+ }
+
+ case "$p" in
+ "_SURF_INFO")
+ xprop -id $xid | sed 's/\t/ /g' | $dmenu -b -l 20
+ ;;
+ "_SURF_FIND")
+ find="`tac $ffile 2>/dev/null | $dmenu -b -p find:`"
+ s_set_prop _SURF_FIND "$find"
+ s_write_f $ffile "$find"
+ ;;
+ "_SURF_BMARK")
+ uri=`s_get_prop _SURF_URI`
+ s_write_f $bmarks "$uri"
+ ;;
+ "_SURF_URI_RAW")
+ uri=`echo $(s_get_prop _SURF_URI) | $dmenu -b -p "uri:"`
+ s_set_prop _SURF_URI "$uri"
+ ;;
+ "_SURF_URI")
+ sel=`tac $bmarks 2> /dev/null | $dmenu -b -l 5 -p "uri [dgtwuy*]:"`
+ [ -z "$sel" ] && exit
+ opt=$(echo $sel | cut -d ' ' -f 1)
+ arg=$(echo $sel | cut -d ' ' -f 2-)
+ save=0
+ case "$opt" in
+ "d") # del.icio.us
+ uri="http://del.icio.us/save?url=`s_get_prop _SURF_URI`"
+ ;;
+ "g") # google for it
+ uri="http://www.google.com/search?q=$arg"
+ save=1
+ ;;
+ "t") # tinyurl
+ uri="http://tinyurl.com/create.php?url=`s_get_prop _SURF_URI`"
+ ;;
+ "w") # wikipedia
+ uri="http://wikipedia.org/wiki/$arg"
+ save=1
+ ;;
+ "u") # utoronto
+ uri="http://search2.library.utoronto.ca/UTL/index?N=0&Ntk=Anywhere&Ntt=$arg&Ntx=mode%2Bmatchallpartial&Nu=p_work_normalized&Np=1&formName=search_form_simple"
+ save=1
+ ;;
+ "y") # youtube
+ uri="http://www.youtube.com/results?search_query=$arg&aq=f"
+ save=1
+ ;;
+ "x") # delete
+ sed -i "\|$arg|d" $bmarks
+ exit;
+ ;;
+ *)
+ uri="$sel"
+ save=2
+ ;;
+ esac
+
+ # only set the uri; don't write to file
+ [ $save -eq 0 ] && s_set_prop _SURF_URI "$uri"
+ # set the url and write exactly what the user inputed to the file
+ [ $save -eq 1 ] && (s_set_prop _SURF_URI "$uri"; s_write_f $bmarks "$sel")
+ # try to set the uri only if it is a success
+ [ $save -eq 2 ] && s_set_write_proper_uri "$uri"
+ ;;
+ *)
+ echo Unknown xprop
+ ;;
+ esac
diff -r e23de4bd6fed -r 2307fd2eabbd surf.suckless.org/files/bmarks_sprop.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/surf.suckless.org/files/bmarks_sprop.md Thu Apr 22 00:56:26 2010 -0400
_AT_@ -0,0 +1,18 @@
+BMARKS SPROP
+============
+
+Description
+-----------
+Peter, pancake, and nibble's bmarks script, clobbered to work with sprop(1).
+
+Development
+-----------
+Browse the [repository](http://bitbucket.org/antlechrist/bmarks_sprop/src) or
+get a copy using [Mercurial](http://www.selenic.com/mercurial/) with the
+following command:
+
+ hg clone http://bitbucket.org/antlechrist/bmarks_sprop/
+
+Clobberer
+---------
+Andrew Antle `<andrew dot antle at gmail dot com>`
diff -r e23de4bd6fed -r 2307fd2eabbd surf.suckless.org/files/sprop_bookmarking.md
--- a/surf.suckless.org/files/sprop_bookmarking.md Fri Apr 16 01:34:56 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
_AT_@ -1,50 +0,0 @@
-SPROP BOOKMARKING
-=================
-
-Description
------------
-Create bma.sh in your $PATH:
-
- $ cat ~/bin/bma.sh
- #!/bin/sh
-
- BMARKS=$HOME/.surf/bmarks
- URI="`sprop $1 _SURF_URI`"
-
- echo "$URI" >> $BMARKS
-
-Create bml.sh in your $PATH, as well:
-
- $ cat ~/bin/bml.sh
- #!/bin/sh
-
- CACHE=$HOME/.surf/bmarks
-
- cat "$CACHE" | sort | uniq > "$CACHE".$$ &&
- mv "$CACHE".$$ "$CACHE"
-
- cat "$CACHE" | dmenu
-
-Modify your config.h just before the definition of `keys[]`:
-
- #define BMA { .v = (char *[]){ "/bin/sh", "-c", \
- "bma.sh $0", winid, NULL } }
-
- #define BML(p) { .v = (char *[]){ "/bin/sh", "-c", \
- "sprop $1 $0 `bml.sh` || exit 0", \
- winid, NULL } }
-
-Then, inside `keys[]`, add:
-
- { MODKEY, GDK_b, spawn, BML("_SURF_URI") },
- { MODKEY|GDK_SHIFT_MASK,GDK_b, spawn, BMA },
-
-Development
------------
- hg clone http://bitbucket.org/antlechrist/sprop-bm-surf/
-
-or browse the [repository](http://bitbucket.org/antlechrist/sprop-bm-surf/)
-
-Author
-------
-Andrew Antle `<andrew dot antle at gmail dot com>`
Received on Thu Apr 22 2010 - 06:58:35 CEST

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