sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit cfc3d443d9982b4d93b4efc2cbf58cc591fc8f0f
parent b80ddc50177bdeaca5309e280b08fad48c3c1544
Author: kais <kais.euchi@gmail.com>
Date:   Mon, 29 Jan 2018 01:33:46 +0100

Updated to match new SETPROP, fixed keybindings

Diffstat:
Msurf.suckless.org/files/simple_bookmarking.md | 28+++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/surf.suckless.org/files/simple_bookmarking.md b/surf.suckless.org/files/simple_bookmarking.md @@ -11,8 +11,8 @@ bookmarkurl : #!/bin/sh file=~/.surf/bookmarks url=`xprop -id $1 | grep URI | awk '{print $3}' | sed 's/\"//g'` - title=`xprop -id $1 | grep WM_ICON_NAME\(STRING\) | cut -c 24-` - echo $url $title | dmenu -nl >> $file + title=`xprop -id $1 | grep WM_ICON_NAME\(STRING\) | cut -c 40- | sed 's/.$//g` + echo $url $title | dmenu -p 'Add Bookmark' -b -w $1 >> $file to add tags, when dmenu displays, simply tab, space and write your tag. @@ -23,7 +23,7 @@ loadbookmark : Meillo's is the lightweight, Fresch's is the full featured) #!/bin/sh - cat ~/.surf/bookmarks | dmenu -i -b -l 10 | awk '{print $1}' + cat ~/.surf/bookmarks | dmenu -p 'Load Bookmark' -i -b -l 10 -w $1 | awk '{print $1}' To make dmenu display bookmark with a tag only, add a grep part in the first line and launch this script with the tag as argument. @@ -31,16 +31,22 @@ first line and launch this script with the tag as argument. bookmarkurl and loadbookmark can be launched with the following in config.h above the "static Key keys[] = {" line : - #define ADDBMK { .v = (char *[]){ "/bin/sh", "-c", \ - "bookmarkurl $0", winid, NULL } } - #define LOADBMK(p) { .v = (char *[]){ "/bin/sh", "-c", \ - "xprop -id $1 -f $0 8s -set $0 `loadbookmark` || exit 0", \ - p, winid, NULL } } - + #define ADDBMK { \ + .v = (char *[]){ "/bin/sh", "-c", \ + "bookmarkurl $0", winid, NULL \ + } \ + } + + #define LOADBMK(r, s, p) { \ + .v = (const char *[]){ "/bin/sh", "-c", \ + "prop=\"$(loadbookmark $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \ + "surf-setprop", winid, r, s, p, NULL \ + } \ + } and - { MODKEY, GDK_a, spawn, ADDBMK }, - { MODKEY, GDK_b, spawn, LOADBMK("_SURF_URI") }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_z, spawn, ADDBMK }, + { MODKEY, GDK_KEY_z, spawn, LOADBMK("_SURF_URI", "_SURF_GO", PROMPT_GO) }, in the "static Key keys[] = {" part.