[wiki] [sites] wiki updated
changeset: 610:f8055a8c4c53
tag: tip
user: Rob Pilling <my name at gmail dot com>
date: Wed Aug 18 11:04:09 2010 +0100
files: tools.suckless.org/dmenu/patches/dmenu-tip-incremental.diff tools.suckless.org/dmenu/patches/incremental.md
description:
Updated incremental patch to apply cleanly to tip
diff -r 582d7ab05400 -r f8055a8c4c53 tools.suckless.org/dmenu/patches/dmenu-tip-incremental.diff
--- a/tools.suckless.org/dmenu/patches/dmenu-tip-incremental.diff Sat Aug 14 19:34:11 2010 +0100
+++ b/tools.suckless.org/dmenu/patches/dmenu-tip-incremental.diff Wed Aug 18 11:04:09 2010 +0100
_AT_@ -1,61 +1,62 @@
-diff -r 67d8f41d51d7 dmenu.1
---- a/dmenu.1 Fri Jul 02 06:49:05 2010 +0100
-+++ b/dmenu.1 Fri Jul 23 18:32:04 2010 +0100
+diff -r ccb2b92086bf dmenu.1
+--- a/dmenu.1 Thu Aug 12 15:35:51 2010 +0100
++++ b/dmenu.1 Wed Aug 18 10:59:14 2010 +0100
_AT_@ -5,6 +5,7 @@
.B dmenu
+ .RB [ \-b ]
.RB [ \-i ]
- .RB [ \-b ]
+.RB [ \-r ]
- .RB [ \-e " <xid>]"
- .RB [ \-l " <lines>]"
- .RB [ \-fn " <font>]"
-_AT_@ -38,6 +39,9 @@
- .B \-b
- defines that dmenu appears at the bottom.
+ .RB [ \-l
+ .IR lines ]
+ .RB [ \-p
+_AT_@ -48,6 +49,9 @@
+ .B \-i
+ dmenu matches menu items case insensitively.
.TP
+.B \-r
-+outputs the entered text, incrementally.
++dmenu outputs text each time a key is pressed.
+.TP
- .B \-e <xid>
- reparents dmenu to the window specified by xid.
+ .BI \-l " lines"
+ dmenu lists items vertically, with the given number of lines.
.TP
-diff -r 67d8f41d51d7 dmenu.c
---- a/dmenu.c Fri Jul 02 06:49:05 2010 +0100
-+++ b/dmenu.c Fri Jul 23 18:32:04 2010 +0100
-_AT_@ -34,6 +34,7 @@
- static char *maxname = NULL;
- static unsigned int cmdw = 0;
- static unsigned int lines = 0;
-+static int incremental = 0;
- static Item *allitems = NULL; /* first of all items */
- static Item *item = NULL; /* first of pattern matching items */
- static Item *sel = NULL;
-_AT_@ -331,6 +332,10 @@
- dinput();
+diff -r ccb2b92086bf dmenu.c
+--- a/dmenu.c Thu Aug 12 15:35:51 2010 +0100
++++ b/dmenu.c Wed Aug 18 10:59:14 2010 +0100
+_AT_@ -53,7 +53,7 @@
+ static unsigned long normcol[ColLast];
+ static unsigned long selcol[ColLast];
+ static Atom utf8;
+-static Bool topbar = True;
++static Bool topbar = True, incremental = False;
+ static DC *dc;
+ static Item *items = NULL;
+ static Item *matches, *sel;
+_AT_@ -317,6 +317,10 @@
+ match();
break;
}
+ if(incremental) {
+ fprintf(stdout, "%s\n", text);
+ fflush(stdout);
+ }
- drawbar();
+ drawmenu();
}
-
-_AT_@ -413,6 +418,8 @@
+
+_AT_@ -487,7 +491,7 @@
+
+ void
+ usage(void) {
+- fputs("usage: dmenu [-b] [-i] [-l lines] [-p prompt] [-fn font] [-nb color]\n"
++ fputs("usage: dmenu [-b] [-r] [-i] [-l lines] [-p prompt] [-fn font] [-nb color]\n"
+ " [-nf color] [-sb color] [-sf color] [-v]\n", stderr);
+ exit(EXIT_FAILURE);
+ }
+_AT_@ -505,6 +509,8 @@
}
else if(!strcmp(argv[i], "-b"))
topbar = False;
+ else if(!strcmp(argv[i], "-r"))
-+ incremental = 1;
- else if(!strcmp(argv[i], "-l")) {
- if(++i < argc) lines = atoi(argv[i]);
- if(lines > 0)
-_AT_@ -441,7 +448,7 @@
- exit(EXIT_SUCCESS);
- }
- else {
-- fputs("usage: dmenu [-i] [-b] [-l <lines>] [-fn <font>] [-nb <color>]\n"
-+ fputs("usage: dmenu [-i] [-b] [-r] [-l <lines>] [-fn <font>] [-nb <color>]\n"
- " [-nf <color>] [-p <prompt>] [-sb <color>] [-sf <color>] [-v]\n", stderr);
- exit(EXIT_FAILURE);
- }
++ incremental = True;
+ else if(!strcmp(argv[i], "-i"))
+ fstrncmp = strncasecmp;
+ else if(i == argc-1)
diff -r 582d7ab05400 -r f8055a8c4c53 tools.suckless.org/dmenu/patches/incremental.md
--- a/tools.suckless.org/dmenu/patches/incremental.md Sat Aug 14 19:34:11 2010 +0100
+++ b/tools.suckless.org/dmenu/patches/incremental.md Wed Aug 18 11:04:09 2010 +0100
_AT_@ -5,9 +5,9 @@
This is useful as an incremental search feature, for example in surf's config.h:
-`#define INCSEARCH { .v = (char *[]){ "/bin/sh", "-c", \
- "dmenu -r < /dev/null | while read -r find;do xprop -id $0 -f _SURF_FIND 8s "\
- "-set _SURF_FIND \"$find\";done", \
+`#define INCSEARCH { .v = (char *[]){ "/bin/sh", "-c",
+ "dmenu -r < /dev/null | while read -r find; do xprop -id $0 -f _SURF_FIND 8s "
+ "-set _SURF_FIND \"$find\"; done",
winid, NULL } }`
Received on Wed Aug 18 2010 - 11:56:39 CEST
This archive was generated by hypermail 2.3.0
: Thu Sep 13 2012 - 19:31:26 CEST