sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 354d9e36792848ca7fd1f5d6a08e0368f279b946
parent d0c02e1445c1d3156845d51eee17baa752ca6c8e
Author: Anselm R Garbe <garbeam@gmail.com>
Date:   Fri, 20 Nov 2009 13:52:15 +0000

up
Diffstat:
Adwm.suckless.org/patches/moveresize.md | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msta.li/index.md | 20++++++++++----------
Msurf.suckless.org/files/simple_bookmarking.md | 38++++++++++++++++++++++++++------------
Atools.suckless.org/dmenu/patches/dmenu-ms_nl.diff | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atools.suckless.org/dmenu/patches/dmenu_xmms.diff | 133+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atools.suckless.org/dmenu/patches/multiselect_and_newline.md | 19+++++++++++++++++++
Atools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md | 26++++++++++++++++++++++++++
7 files changed, 348 insertions(+), 22 deletions(-)

diff --git a/dwm.suckless.org/patches/moveresize.md b/dwm.suckless.org/patches/moveresize.md @@ -0,0 +1,55 @@ +# MOVERESIZE + +## Description + +This addition to `config.h` allows you to move and resize dwm's clients using +keyboard bindings. See [historical patches](historical) for older versions. + +## Usage + + 1. Put the following `moveresize()` function somewhere in your `config.h` file: + + static void + moveresize(const Arg *arg) + { + + XEvent ev; + Monitor *m = selmon; + + if(!(m->sel && arg && arg->v && m->sel->isfloating)) + return; + + resize(m->sel, m->sel->x + ((int *)arg->v)[0], + m->sel->y + ((int *)arg->v)[1], + m->sel->w + ((int *)arg->v)[2], + m->sel->h + ((int *)arg->v)[3], + True); + + while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); + } + + 2. Insert the bindings into the keys list. Here is an example which uses the + arrow keys to move (mod+arrow) or resize (mod+shift+arrow) the selected + client: + + { MODKEY, XK_Down, moveresize, {.v = (int []){ 0, 25, 0, 0 }}}, + { MODKEY, XK_Up, moveresize, {.v = (int []){ 0, -25, 0, 0 }}}, + { MODKEY, XK_Right, moveresize, {.v = (int []){ 25, 0, 0, 0 }}}, + { MODKEY, XK_Left, moveresize, {.v = (int []){ -25, 0, 0, 0 }}}, + { MODKEY|ShiftMask, XK_Down, moveresize, {.v = (int []){ 0, 0, 0, 25 }}}, + { MODKEY|ShiftMask, XK_Up, moveresize, {.v = (int []){ 0, 0, 0, -25 }}}, + { MODKEY|ShiftMask, XK_Right, moveresize, {.v = (int []){ 0, 0, 25, 0 }}}, + { MODKEY|ShiftMask, XK_Left, moveresize, {.v = (int []){ 0, 0, -25, 0 }}}, + +If you want to automatically toggle the client floating when move/resize, +replace the `if()` statement above with this code: + + if(!(m->sel && arg && arg->v)) + return; + if(m->sel->lt[m->sellt]->arrange && !m->sel->isfloating) + m->sel->isfloating = True; + +## Mantainer + + * Claudio M. Alessi - <smoppy@gmail.com> + diff --git a/sta.li/index.md b/sta.li/index.md @@ -17,26 +17,26 @@ General system design --------------------- * binary is primary focus, each executable is statically linked, potentially different executable format than ELF, since ELF is mainly designed to support dynamic linking -* kernel is a single monolit based on linux, by default no kernel module support -* system loader is lilo (maybe we start maintaining it) +* kernel is a single monolith based on linux, by default no kernel module support +* system loader is lilo (maybe we will start maintaining it) * no initrd initially -* perhaps later whole system in ramdisk? will see (20h idea) -* init system should be based on just 1 /etc/rc.{start,stop} script (look at p9 how they do it) +* perhaps later whole the system will be a ramdisk? will see (20h idea) +* init system should be based on just one /etc/rc.{start,stop} script (look at p9 how they do it) Basic filesystem design ----------------------- -Generally /usr will be removed, what a useless directory, for non-base system stuff we might consider /local perhaps +Generally, /usr will be removed, what a useless directory, for non-base system stuff we might consider /local * /bin - all executables go here * /bin/kernel (linux kernel) -* /dev - devices, check if we can avoid udev or what linux requires nowadays, simplest approach would be best +* /dev - devices, check if we can avoid udev or what linux requires nowadays, the simplest approach would be best * /etc - system config/program config/user setup/network setup -* /etc/rc.{start,stop} (init scripts) +* /etc/rc.{start,stop} - init scripts * /home/root (root's home) -* /home/* (user home dirs) -* /include (include) +* /home/* - user home dirs +* /include - include files * /lib - libraries, when used as devel box, only static libs, potentially -* /local - perhaps, dunno? +* /local - possibly for software that's no in the base * /mnt - mounts * /proc - linux crap * /share - man pages, locales and crap that several libraries ship diff --git a/surf.suckless.org/files/simple_bookmarking.md b/surf.suckless.org/files/simple_bookmarking.md @@ -4,32 +4,46 @@ SIMPLE_BOOKMARKING Description ----------- -This script assumes the simpliest surf usage, which probably will not be yours, change this script to fit your needs. -Make sure surf is launched with something like that : -surf -x >> ~/.surf/id - bookmarkurl : + #!/bin/sh file=~/.surf/bookmarks - surfid=`head -n 1 ~/.surf/id` - url=`xprop -id $surfid | grep URL | awk '{print $3}' | sed 's/\"/\ /g'` - title=`xprop -id $surfid | grep WM_ICON_NAME\(STRING\) | cut -c 24-` - echo -e `echo -e $url $title | dmenu` >> $file + url=`xprop -id $1 | grep URL | awk '{print $3}' | sed 's/\"//g'` + title=`xprop -id $1 | grep WM_ICON_NAME\(STRING\) | cut -c 24-` + echo $url $title | dmenu -nl >> $file - -to add tags, when dmenu displays, simply tab, space and write your tag +to add tags, when dmenu displays, simply tab, space and write your tag. + + loadbookmark : (needs a vertical patch on dmenu for convenience, choose the one you like, Meillo's is the lightweight, Fresch's is the full featured) - url=`cat ~/.surf/bookmarks | dmenu -i -b -l 10 | awk '{print $1}'` - xprop -id `head -n 1 ~/.surf/id` -f _SURF_URL 8s -set _SURF_URL $url + #!/bin/sh + cat ~/.surf/bookmarks | dmenu -i -b -l 10 | 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. + +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 } } + +and + + { MODKEY, GDK_a, spawn, ADDBMK }, + { MODKEY, GDK_b, spawn, LOADBMK("_SURF_URI") }, + +in the "static Key keys[] = {" part. + Author ------ diff --git a/tools.suckless.org/dmenu/patches/dmenu-ms_nl.diff b/tools.suckless.org/dmenu/patches/dmenu-ms_nl.diff @@ -0,0 +1,79 @@ +diff -up dmenu-4.0/dmenu.1 dmenu-4.0_ms_nl/dmenu.1 +--- dmenu-4.0/dmenu.1 2009-04-18 13:50:04.000000000 +0200 ++++ dmenu-4.0_ms_nl/dmenu.1 2009-11-19 23:01:15.000000000 +0100 +@@ -11,6 +11,8 @@ dmenu \- dynamic menu + .RB [ \-p " <prompt>"] + .RB [ \-sb " <color>"] + .RB [ \-sf " <color>"] ++.RB [ \-ms ] ++.RB [ \-nl ] + .RB [ \-v ] + .SH DESCRIPTION + .SS Overview +@@ -44,6 +46,12 @@ defines the selected background color (# + .B \-sf <color> + defines the selected foreground color (#RGB, #RRGGBB, and color names are supported). + .TP ++.B \-ms ++multi-select; selecting an item and pressing return won't terminate dmenu. ++.TP ++.B \-nl ++seperates standard output by newlines. ++.TP + .B \-v + prints version information to standard output, then exits. + .SH USAGE +diff -up dmenu-4.0/dmenu.c dmenu-4.0_ms_nl/dmenu.c +--- dmenu-4.0/dmenu.c 2009-04-18 13:50:04.000000000 +0200 ++++ dmenu-4.0_ms_nl/dmenu.c 2009-11-19 23:04:59.000000000 +0100 +@@ -69,6 +69,7 @@ static int textw(const char *text); + /* variables */ + static char *maxname = NULL; + static char *prompt = NULL; ++static char *nl = ""; + static char text[4096]; + static int cmdw = 0; + static int promptw = 0; +@@ -77,6 +78,7 @@ static int screen; + static unsigned int mw, mh; + static unsigned int numlockmask = 0; + static Bool running = True; ++static Bool multiselect = False; + static Display *dpy; + static DC dc; + static Item *allitems = NULL; /* first of all items */ +@@ -448,13 +450,13 @@ kpress(XKeyEvent * e) { + break; + case XK_Return: + if((e->state & ShiftMask) && *text) +- fprintf(stdout, "%s", text); ++ fprintf(stdout, "%s%s", text, nl); + else if(sel) +- fprintf(stdout, "%s", sel->text); ++ fprintf(stdout, "%s%s", sel->text, nl); + else if(*text) +- fprintf(stdout, "%s", text); ++ fprintf(stdout, "%s%s", text, nl); + fflush(stdout); +- running = False; ++ running = multiselect; + break; + case XK_Right: + if(!(sel && sel->right)) +@@ -694,11 +696,15 @@ main(int argc, char *argv[]) { + else if(!strcmp(argv[i], "-sf")) { + if(++i < argc) selfgcolor = argv[i]; + } ++ else if(!strcmp(argv[i], "-ms")) ++ multiselect = True; ++ else if(!strcmp(argv[i], "-nl")) ++ nl = "\n"; + else if(!strcmp(argv[i], "-v")) + eprint("dmenu-"VERSION", © 2006-2008 dmenu engineers, see LICENSE for details\n"); + else + eprint("usage: dmenu [-i] [-b] [-fn <font>] [-nb <color>] [-nf <color>]\n" +- " [-p <prompt>] [-sb <color>] [-sf <color>] [-v]\n"); ++ " [-p <prompt>] [-sb <color>] [-sf <color>] [-ms] [-nl] [-v]\n"); + if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) + fprintf(stderr, "warning: no locale support\n"); + if(!(dpy = XOpenDisplay(NULL))) diff --git a/tools.suckless.org/dmenu/patches/dmenu_xmms.diff b/tools.suckless.org/dmenu/patches/dmenu_xmms.diff @@ -0,0 +1,133 @@ +diff -up dmenu-4.0/config.h dmenu-4.0_xmms/config.h +--- dmenu-4.0/config.h 2009-04-18 13:50:04.000000000 +0200 ++++ dmenu-4.0_xmms/config.h 2009-11-19 21:31:17.000000000 +0100 +@@ -7,3 +7,4 @@ static const char *normfgcolor = "#00000 + static const char *selbgcolor = "#0066ff"; + static const char *selfgcolor = "#ffffff"; + static unsigned int spaceitem = 30; /* px between menu items */ ++static unsigned int maxtokens = 16; /* max. tokens for pattern matching */ +diff -up dmenu-4.0/dmenu.1 dmenu-4.0_xmms/dmenu.1 +--- dmenu-4.0/dmenu.1 2009-04-18 13:50:04.000000000 +0200 ++++ dmenu-4.0_xmms/dmenu.1 2009-11-19 21:14:24.000000000 +0100 +@@ -11,6 +11,7 @@ dmenu \- dynamic menu + .RB [ \-p " <prompt>"] + .RB [ \-sb " <color>"] + .RB [ \-sf " <color>"] ++.RB [ \-xs ] + .RB [ \-v ] + .SH DESCRIPTION + .SS Overview +@@ -44,6 +45,9 @@ defines the selected background color (# + .B \-sf <color> + defines the selected foreground color (#RGB, #RRGGBB, and color names are supported). + .TP ++.B \-xs ++xmms-like pattern matching. ++.TP + .B \-v + prints version information to standard output, then exits. + .SH USAGE +diff -up dmenu-4.0/dmenu.c dmenu-4.0_xmms/dmenu.c +--- dmenu-4.0/dmenu.c 2009-04-18 13:50:04.000000000 +0200 ++++ dmenu-4.0_xmms/dmenu.c 2009-11-19 21:56:30.000000000 +0100 +@@ -69,6 +69,7 @@ static int textw(const char *text); + /* variables */ + static char *maxname = NULL; + static char *prompt = NULL; ++static char **tokens = NULL; + static char text[4096]; + static int cmdw = 0; + static int promptw = 0; +@@ -77,6 +78,7 @@ static int screen; + static unsigned int mw, mh; + static unsigned int numlockmask = 0; + static Bool running = True; ++static Bool xmms = False; + static Display *dpy; + static DC dc; + static Item *allitems = NULL; /* first of all items */ +@@ -475,22 +477,55 @@ kpress(XKeyEvent * e) { + drawmenu(); + } + ++unsigned int tokenize(char *pat, char **tok) ++{ ++ unsigned int i = 0; ++ char tmp[4096] = {0}; ++ ++ strncpy(tmp, pat, strlen(pat)); ++ tok[0] = strtok(tmp, " "); ++ ++ while(tok[i] && i < maxtokens) ++ tok[++i] = strtok(NULL, " "); ++ return i; ++} ++ + void + match(char *pattern) { +- unsigned int plen; ++ unsigned int plen, tokencnt = 0; ++ char append = 0; + Item *i, *itemend, *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend; + + if(!pattern) + return; +- plen = strlen(pattern); ++ ++ if(!xmms) ++ tokens[(tokencnt = 1)-1] = pattern; ++ else ++ if(!(tokencnt = tokenize(pattern, tokens))) ++ tokens[(tokencnt = 1)-1] = ""; + item = lexact = lprefix = lsubstr = itemend = exactend = prefixend = substrend = NULL; +- for(i = allitems; i; i = i->next) +- if(!fstrncmp(pattern, i->text, plen + 1)) ++ for(i = allitems; i; i = i->next) { ++ for(int j = 0; j < tokencnt; ++j) { ++ plen = strlen(tokens[j]); ++ if(!fstrncmp(tokens[j], i->text, plen + 1)) ++ append = !append || append > 1 ? 1 : append; ++ else if(!fstrncmp(tokens[j], i->text, plen )) ++ append = !append || append > 2 ? 2 : append; ++ else if(fstrstr(i->text, tokens[j])) ++ append = append > 0 && append < 3 ? append : 3; ++ else { ++ append = 0; ++ break; ++ } ++ } ++ if(append == 1) + appenditem(i, &lexact, &exactend); +- else if(!fstrncmp(pattern, i->text, plen)) ++ else if(append == 2) + appenditem(i, &lprefix, &prefixend); +- else if(fstrstr(i->text, pattern)) ++ else if(append == 3) + appenditem(i, &lsubstr, &substrend); ++ } + if(lexact) { + item = lexact; + itemend = exactend; +@@ -643,6 +678,7 @@ setup(Bool topbar) { + if(promptw > mw / 5) + promptw = mw / 5; + text[0] = 0; ++ tokens = malloc((xmms?maxtokens:1)*sizeof(char*)); + match(text); + XMapRaised(dpy, win); + } +@@ -694,11 +730,13 @@ main(int argc, char *argv[]) { + else if(!strcmp(argv[i], "-sf")) { + if(++i < argc) selfgcolor = argv[i]; + } ++ else if(!strcmp(argv[i], "-xs")) ++ xmms = True; + else if(!strcmp(argv[i], "-v")) + eprint("dmenu-"VERSION", © 2006-2008 dmenu engineers, see LICENSE for details\n"); + else + eprint("usage: dmenu [-i] [-b] [-fn <font>] [-nb <color>] [-nf <color>]\n" +- " [-p <prompt>] [-sb <color>] [-sf <color>] [-v]\n"); ++ " [-p <prompt>] [-sb <color>] [-sf <color>] [-xs] [-v]\n"); + if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) + fprintf(stderr, "warning: no locale support\n"); + if(!(dpy = XOpenDisplay(NULL))) diff --git a/tools.suckless.org/dmenu/patches/multiselect_and_newline.md b/tools.suckless.org/dmenu/patches/multiselect_and_newline.md @@ -0,0 +1,19 @@ +MULTISELECT AND NEWLINE +======================= + +multi-select: selecting an item and pressing return won't terminate dmenu +newline : seperates standard outputs by newlines + +These two features are enabled by -ms and -nl command line flag, they can be useful in scripts where one wishes to print several elements from a list +with new line in between. + +The code comes from a vertical patch for dmenu_3.9 wrote by Fresch, the original patch has a lot of options, I just cutted out the one I use on top of Meillo's dmenu vertical patch. (these two and xmms-like pattern matching for huge strings) + +Cutter +------ +- Julien Steinhauser <[julien.steinhauser@orange.fr](mailto:julien.steinhauser@orange.fr)> + +Download +-------- + +* [dmenu-ms_nl.diff](dmenu-ms_nl.diff) diff --git a/tools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md b/tools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md @@ -0,0 +1,26 @@ +XMMS-LIKE PATTERN MATCHING +========================== + +This patch allows the user to match strings in several pieces. +For example to type: + + dme atc + +could match + + http://tools.suckless.org/dmenu/patches/ + + in someone's bookmarks file. + +This feature is enabled by -xs command line flag, it can be useful to ease the matching on huge strings. + +The code comes from a vertical patch for dmenu_3.9 wrote by Fresch, the original patch has a lot of options, I just cutted out the ones I use on top of Meillo's dmenu vertical patch. (multiselect, newline and this one) + +Cutter +------ +- Julien Steinhauser <[julien.steinhauser@orange.fr](mailto:julien.steinhauser@orange.fr)> + +Download +-------- + +* [dmenu_xmms.diff](dmenu_xmms.diff)