sites

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

surf-0.6-bookmarks.diff (1541B)


      1 diff --git a/config.def.h b/config.def.h
      2 index 08ff707..3800f63 100644
      3 --- a/config.def.h
      4 +++ b/config.def.h
      5 @@ -25,7 +25,8 @@ static Bool allowgeolocation = TRUE;
      6  
      7  #define SETPROP(p, q) { \
      8  	.v = (char *[]){ "/bin/sh", "-c", \
      9 -		"prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | xargs -0 printf %b | dmenu`\" &&" \
     10 +		"prop=\"`(xprop -id $2 $0 | cut -d '\"' -f 2 | xargs -0 printf %b && "\
     11 +                "cat ~/.surf/bookmarks) | dmenu`\" &&" \
     12  		"xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
     13  		p, q, winid, NULL \
     14  	} \
     15 @@ -41,6 +42,12 @@ static Bool allowgeolocation = TRUE;
     16  	} \
     17  }
     18  
     19 +#define BM_ADD { .v = (char *[]){ "/bin/sh", "-c", \
     20 +  "(echo `xprop -id $0 _SURF_URI | cut -d '\"' -f 2` && "\
     21 +  "cat ~/.surf/bookmarks) | awk '!seen[$0]++' > ~/.surf/bookmarks_new && "\
     22 +  "mv ~/.surf/bookmarks_new ~/.surf/bookmarks", \
     23 +  winid, NULL } }
     24 +
     25  #define MODKEY GDK_CONTROL_MASK
     26  
     27  /* hotkeys */
     28 @@ -72,6 +79,7 @@ static Key keys[] = {
     29      { MODKEY,               GDK_space,       scroll_v,   { .i = +10000 } },
     30      { MODKEY,               GDK_i,           scroll_h,   { .i = +1 } },
     31      { MODKEY,               GDK_u,           scroll_h,   { .i = -1 } },
     32 +    { MODKEY,               GDK_b,      spawn,      BM_ADD },
     33  
     34      { 0,                    GDK_F11,    fullscreen, { 0 } },
     35      { 0,                    GDK_Escape, stop,       { 0 } },
     36 @@ -93,4 +101,3 @@ static Key keys[] = {
     37      { MODKEY|GDK_SHIFT_MASK,GDK_b,      togglescrollbars,{ 0 } },
     38      { MODKEY|GDK_SHIFT_MASK,GDK_g,      togglegeolocation, { 0 } },
     39  };
     40 -