updated manpage, changed keybinds 9a33a72c
M- binds tend to be wm level, and there were up to 3 binds for the same action
M-{hjkl} also no longer made sense in vlist mode
Connor Lane Smith · 2010-06-20 15:04 2 file(s) · +59 −71
dmenu.1 +20 −26
14 14
.RB [ \-sb " <color>]"
15 15
.RB [ \-sf " <color>]"
16 16
.RB [ \-v ]
17 +
18 +
.B dmenu_run
19 +
[<options...>]
20 +
21 +
.BR dmenu_path
17 22
.SH DESCRIPTION
18 23
.SS Overview
19 24
dmenu is a generic menu for X, originally designed for
20 25
.BR dwm (1).
21 26
It manages huge amounts (up to 10.000 and more) of user defined menu items
22 27
efficiently.
28 +
29 +
dmenu_run is a dmenu script used by dwm which lists executables in the user's PATH
30 +
and executes the selected item.
31 +
32 +
dmenu_path is a script used by dmenu_run to find and cache a list of executables.
23 33
.SS Options
24 34
.TP
25 35
.B \-i
33 43
.TP
34 44
.B \-l <lines>
35 45
activates vertical list mode.
36 -
The given number of lines will be displayed. Window height will get adjusted.
46 +
The given number of lines will be displayed. Window height will be adjusted.
37 47
.TP
38 48
.B \-fn <font>
39 49
defines the font.
60 70
menu.  When the user selects an item or enters any text and presses Return, his/her
61 71
choice is printed to standard output and dmenu terminates.
62 72
.P
63 -
dmenu is completely controlled by the keyboard. The following keys are recognized:
64 -
.TP
65 -
.B Any printable character
66 -
Appends the character to the text in the input field.  This works as a filter:
67 -
only items containing this text will be displayed.
68 -
.TP
69 -
.B Left/Right (Up/Down) (Mod1\-h/Mod1\-l)
70 -
Select the previous/next item.
71 -
.TP
72 -
.B PageUp/PageDown (Mod1\-k/Mod1\-j)
73 -
Select the first item of the previous/next 'page' of items.
74 -
.TP
75 -
.B Home/End (Mod1\-g/Mod1\-G)
76 -
Select the first/last item.
73 +
dmenu is completely controlled by the keyboard. Besides standard Unix line editing,
74 +
and item selection (Up/Down or Left/Right, PageUp/PageDown, Home/End), the following
75 +
keys are recognized:
77 76
.TP
78 77
.B Tab (Control\-i)
79 78
Copy the selected item to the input field.
84 83
on termination.
85 84
.TP
86 85
.B Shift\-Return (Control\-Shift\-j)
87 -
Confirm selection and quit (print the text in the input field to standard output).
86 +
Confirm input and quit (print the text in the input field to standard output).
88 87
Returns
89 88
.B 0
90 89
on termination.
91 90
.TP
92 -
.B Escape (Control\-bracketleft)
91 +
.B Escape (Control\-c)
93 92
Quit without selecting an item. Returns
94 93
.B 1
95 94
on termination.
96 95
.TP
97 -
.B Backspace (Control\-h)
98 -
Remove a character from the input field.
99 -
.TP
100 -
.B Control\-u
101 -
Remove all characters from the input field.
102 -
.TP
103 -
.B Control\-w
104 -
Remove all characters of current word from the input field.
96 +
.B Control\-y
97 +
Pastes the X selection into the input field. This requires
98 +
.BR sselp (1).
105 99
.SH SEE ALSO
106 100
.BR dwm (1),
107 -
.BR wmii (1) .
101 +
.BR wmii (1).
dmenu.c +39 −45
355 355
	/* first check if a control mask is omitted */
356 356
	if(e->state & ControlMask) {
357 357
		switch(tolower(ksym)) {
358 -
		default:	/* ignore other control sequences */
358 +
		default:
359 359
			return;
360 360
		case XK_a:
361 361
			ksym = XK_Home;
362 362
			break;
363 +
		case XK_b:
364 +
			ksym = XK_Left;
365 +
			break;
363 366
		case XK_c:
364 367
			ksym = XK_Escape;
365 368
			break;
366 369
		case XK_e:
367 370
			ksym = XK_End;
368 371
			break;
372 +
		case XK_f:
373 +
			ksym = XK_Right;
374 +
			break;
369 375
		case XK_h:
370 376
			ksym = XK_BackSpace;
371 377
			break;
378 384
		case XK_k:
379 385
			text[cursor] = '\0';
380 386
			break;
387 +
		case XK_n:
388 +
			ksym = XK_Down;
389 +
			break;
390 +
		case XK_p:
391 +
			ksym = XK_Up;
392 +
			break;
381 393
		case XK_u:
382 394
			memmove(text, text + cursor, sizeof text - cursor + 1);
383 395
			cursor = 0;
393 405
				match(text);
394 406
			}
395 407
			break;
396 -
		}
397 -
	}
398 -
	if(CLEANMASK(e->state) & Mod1Mask) {
399 -
		switch(ksym) {
400 -
		default:
401 -
			return;
402 -
		case XK_h:
403 -
			ksym = XK_Left;
404 -
			break;
405 -
		case XK_l:
406 -
			ksym = XK_Right;
407 -
			break;
408 -
		case XK_j:
409 -
			ksym = XK_Next;
410 -
			break;
411 -
		case XK_k:
412 -
			ksym = XK_Prior;
413 -
			break;
414 -
		case XK_g:
415 -
			ksym = XK_Home;
416 -
			break;
417 -
		case XK_G:
418 -
			ksym = XK_End;
419 -
			break;
420 -
		case XK_p:
408 +
		case XK_y:
421 409
			{
422 410
				FILE *fp;
423 411
				char *s;
453 441
		match(text);
454 442
		break;
455 443
	case XK_Delete:
444 +
		if(cursor == len)
445 +
			return;
456 446
		for(i = 1; cursor + i < len && !IS_UTF8_1ST_CHAR(text[cursor + i]); i++);
457 447
		memmove(text + cursor, text + cursor + i, sizeof text - cursor);
458 448
		match(text);
482 472
		calcoffsets();
483 473
		break;
484 474
	case XK_Left:
475 +
		if(cursor > 0 && (!sel || !sel->left)) {
476 +
			while(cursor-- > 0 && !IS_UTF8_1ST_CHAR(text[cursor]));
477 +
			break;
478 +
		}
479 +
		if(lines > 0)
480 +
			return;
485 481
	case XK_Up:
486 -
		if(sel && sel->left){
487 -
			sel = sel->left;
488 -
			if(sel->right == curr) {
489 -
				curr = prev;
490 -
				calcoffsets();
491 -
			}
492 -
		}
493 -
		else if(cursor > 0)
494 -
			while(cursor-- > 0 && !IS_UTF8_1ST_CHAR(text[cursor]));
495 -
		else
482 +
		if(!sel || !sel->left)
496 483
			return;
484 +
		sel = sel->left;
485 +
		if(sel->right == curr) {
486 +
			curr = prev;
487 +
			calcoffsets();
488 +
		}
497 489
		break;
498 490
	case XK_Next:
499 491
		if(!next)
516 508
		running = False;
517 509
		return;
518 510
	case XK_Right:
519 -
	case XK_Down:
520 -
		if(cursor < len)
511 +
		if(cursor < len) {
521 512
			while(cursor++ < len && !IS_UTF8_1ST_CHAR(text[cursor]));
522 -
		else if(sel && sel->right) {
523 -
			sel = sel->right;
524 -
			if(sel == next) {
525 -
				curr = next;
526 -
				calcoffsets();
527 -
			}
513 +
			break;
528 514
		}
529 -
		else
515 +
		if(lines > 0)
516 +
			return;
517 +
	case XK_Down:
518 +
		if(!sel || !sel->right)
530 519
			return;
520 +
		sel = sel->right;
521 +
		if(sel == next) {
522 +
			curr = next;
523 +
			calcoffsets();
524 +
		}
531 525
		break;
532 526
	case XK_Tab:
533 527
		if(!sel)