about summary refs log tree commit diff stats
path: root/README
Commit message (Expand)AuthorAgeFilesLines
* small changes to dwm.1, rearranged order within main event loopAnselm R.Garbe2006-08-211-1/+1
* applied Sanders doc changes, added a PHONY line and changed the output of con...arg@10ksloc.org2006-08-031-1/+2
* implemented the idea presented by Sander for dwm targetarg@10ksloc.org2006-08-021-2/+1
* fixed a type in README, and patched config.mkarg@10ksloc.org2006-08-021-1/+1
* removed the CONFIG variable from config.mk, renamed config.h into config.defa...arg@10ksloc.org2006-08-021-5/+1
* simplified READMEarg@10ksloc.org2006-08-011-4/+1
* centralized/externalized configuration to config.harg@10ksloc.org2006-08-011-2/+6
* applied Sanders patchesarg@10ksloc.org2006-08-011-8/+9
* s/sleep 5/sleep 2/arg@10ksloc.org2006-07-211-1/+1
* changed the status info README hint (more simple now, no extra script necessary)arg@10ksloc.org2006-07-211-7/+1
* added a note how to achieve status info in the bararg@10ksloc.org2006-07-211-1/+17
* updated READMEAnselm R. Garbe2006-07-171-2/+2
* added dev.c instead of kb.cAnselm R. Garbe2006-07-131-1/+1
* small changes to READMEAnselm R. Garbe2006-07-131-3/+3
* added logo+descriptionAnselm R. Garbe2006-07-131-13/+12
* removed unnecessary crapAnselm R. Garbe2006-07-131-4/+2
* added mouse-based resizalsAnselm R. Garbe2006-07-111-9/+1
* updated READMEAnselm R. Garbe2006-07-111-5/+15
* fixed several stuff (gridwm gets better and better)Anselm R. Garbe2006-07-111-0/+1
* initial importAnselm R. Garbe2006-07-101-0/+40
lass='alt'>














                                                                                          












                                                                            
                                                        


                               
/*
 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
 * See LICENSE file for license details.
 */

#include "wm.h"

#include <X11/keysym.h>

static const char *term[] = { 
	"xterm", "-bg", "black", "-fg", "white", "-fn",
	"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", 0 
};

static const char *proglist[] = {
		"sh", "-c", "exec `ls -lL /bin /sbin /usr/bin /usr/local/bin 2>/dev/null | awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq | gridmenu`", 0
};

static Key key[] = {
	{ Mod1Mask, XK_Return, run, term },
	{ Mod1Mask, XK_p, run, proglist }, 
	{ Mod1Mask | ShiftMask, XK_c, kill, NULL}, 
	{ Mod1Mask | ShiftMask, XK_q, quit, NULL},
};

void
update_keys()
{
	unsigned int i, len;
	KeyCode code;

	len = sizeof(key) / sizeof(key[0]);
	for(i = 0; i < len; i++) {
		code = XKeysymToKeycode(dpy, key[i].keysym);
		XUngrabKey(dpy, code, key[i].mod, root);
		XGrabKey(dpy, code, key[i].mod, root, True, GrabModeAsync, GrabModeAsync);
	}
}

void
keypress(XEvent *e)
{
	XKeyEvent *ev = &e->xkey;
	unsigned int i, len;
	KeySym keysym;

	keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
	len = sizeof(key) / sizeof(key[0]);
	for(i = 0; i < len; i++)
		if((keysym == key[i].keysym) && (key[i].mod == ev->state)) {
			if(key[i].func)
				key[i].func(key[i].aux);
			return;
		}
}