index.md (1530B)
1 Simple bookmarking 2 ================== 3 4 Description 5 ----------- 6 7 change this script to fit your needs. 8 9 bookmarkurl: 10 11 #!/bin/sh 12 file=~/.surf/bookmarks 13 url=`xprop -id $1 | grep URI | awk '{print $3}' | sed 's/\"//g'` 14 title=`xprop -id $1 | grep WM_ICON_NAME\(STRING\) | cut -c 40- | sed 's/.$//g` 15 echo $url $title | dmenu -p 'Add Bookmark' -b -w $1 >> $file 16 17 to add tags, when dmenu displays, simply tab, space and write your tag. 18 19 20 loadbookmark: 21 22 (needs a vertical patch on dmenu for convenience, choose the one you like, 23 Meillo's is the lightweight, Fresch's is the full featured) 24 25 #!/bin/sh 26 cat ~/.surf/bookmarks | dmenu -p 'Load Bookmark' -i -b -l 10 -w $1 | awk '{print $1}' 27 28 To make dmenu display bookmark with a tag only, add a grep part in the 29 first line and launch this script with the tag as argument. 30 31 bookmarkurl and loadbookmark can be launched with the following in config.h above the 32 "static Key keys[] = {" line: 33 34 #define ADDBMK { \ 35 .v = (char *[]){ "/bin/sh", "-c", \ 36 "bookmarkurl $0", winid, NULL \ 37 } \ 38 } 39 40 #define LOADBMK(r, s, p) { \ 41 .v = (const char *[]){ "/bin/sh", "-c", \ 42 "prop=\"$(loadbookmark $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \ 43 "surf-setprop", winid, r, s, p, NULL \ 44 } \ 45 } 46 and 47 48 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_z, spawn, ADDBMK }, 49 { MODKEY, GDK_KEY_z, spawn, LOADBMK("_SURF_URI", "_SURF_GO", PROMPT_GO) }, 50 51 in the "static Key keys[] = {" part. 52 53 Author 54 ------ 55 - Julien Steinhauser <julien.steinhauser@orange.fr>