|
@ -20,50 +20,44 @@ typedef struct { |
|
|
Arg arg; |
|
|
Arg arg; |
|
|
} Key; |
|
|
} Key; |
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
const char *browse[] = { "firefox", NULL }; |
|
|
const char *browse[] = { "firefox", NULL }; |
|
|
const char *gimp[] = { "gimp", NULL }; |
|
|
const char *gimp[] = { "gimp", NULL }; |
|
|
*/ |
|
|
|
|
|
const char *term[] = { "xterm", NULL }; |
|
|
|
|
|
/* |
|
|
|
|
|
|
|
|
const char *term[] = { |
|
|
"urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white", |
|
|
"urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white", |
|
|
"-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL |
|
|
"-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL |
|
|
}; |
|
|
}; |
|
|
coonst char *xlock[] = { "xlock", NULL }; |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
const char *xlock[] = { "xlock", NULL }; |
|
|
|
|
|
|
|
|
static Key key[] = { |
|
|
static Key key[] = { |
|
|
/* modifier key function arguments */ |
|
|
|
|
|
{ ControlMask, XK_0, appendtag, { .i = Tscratch } }, |
|
|
|
|
|
{ ControlMask, XK_1, appendtag, { .i = Tdev } }, |
|
|
|
|
|
{ ControlMask, XK_2, appendtag, { .i = Twww } }, |
|
|
|
|
|
{ ControlMask, XK_3, appendtag, { .i = Twork } }, |
|
|
|
|
|
{ MODKEY, XK_0, view, { .i = Tscratch } }, |
|
|
|
|
|
{ MODKEY, XK_1, view, { .i = Tdev } }, |
|
|
|
|
|
{ MODKEY, XK_2, view, { .i = Twww } }, |
|
|
|
|
|
{ MODKEY, XK_3, view, { .i = Twork } }, |
|
|
|
|
|
{ MODKEY, XK_j, focusnext, { 0 } }, |
|
|
|
|
|
{ MODKEY, XK_k, focusprev, { 0 } }, |
|
|
|
|
|
{ MODKEY, XK_m, maximize, { 0 } }, |
|
|
|
|
|
{ MODKEY, XK_space, dotile, { 0 } }, |
|
|
|
|
|
{ MODKEY, XK_Return, zoom, { 0 } }, |
|
|
|
|
|
|
|
|
/* modifier key function arguments */ |
|
|
|
|
|
{ ControlMask, XK_0, appendtag, { .i = Tscratch } }, |
|
|
|
|
|
{ ControlMask, XK_1, appendtag, { .i = Tdev } }, |
|
|
|
|
|
{ ControlMask, XK_2, appendtag, { .i = Twww } }, |
|
|
|
|
|
{ ControlMask, XK_3, appendtag, { .i = Twork } }, |
|
|
|
|
|
{ MODKEY, XK_0, view, { .i = Tscratch } }, |
|
|
|
|
|
{ MODKEY, XK_1, view, { .i = Tdev } }, |
|
|
|
|
|
{ MODKEY, XK_2, view, { .i = Twww } }, |
|
|
|
|
|
{ MODKEY, XK_3, view, { .i = Twork } }, |
|
|
|
|
|
{ MODKEY, XK_j, focusnext, { 0 } }, |
|
|
|
|
|
{ MODKEY, XK_k, focusprev, { 0 } }, |
|
|
|
|
|
{ MODKEY, XK_m, maximize, { 0 } }, |
|
|
|
|
|
{ MODKEY, XK_space, dotile, { 0 } }, |
|
|
|
|
|
{ MODKEY, XK_Return, zoom, { 0 } }, |
|
|
{ ControlMask|ShiftMask,XK_0, heretag, { .i = Tscratch } }, |
|
|
{ ControlMask|ShiftMask,XK_0, heretag, { .i = Tscratch } }, |
|
|
{ ControlMask|ShiftMask,XK_1, heretag, { .i = Tdev } }, |
|
|
{ ControlMask|ShiftMask,XK_1, heretag, { .i = Tdev } }, |
|
|
{ ControlMask|ShiftMask,XK_2, heretag, { .i = Twww } }, |
|
|
{ ControlMask|ShiftMask,XK_2, heretag, { .i = Twww } }, |
|
|
{ ControlMask|ShiftMask,XK_3, heretag, { .i = Twork } }, |
|
|
{ ControlMask|ShiftMask,XK_3, heretag, { .i = Twork } }, |
|
|
{ MODKEY|ShiftMask, XK_0, replacetag, { .i = Tscratch } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_1, replacetag, { .i = Tdev } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_2, replacetag, { .i = Twww } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_3, replacetag, { .i = Twork } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_c, killclient, { 0 } }, |
|
|
|
|
|
/* |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_g, spawn, { .argv = gimp } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_l, spawn, { .argv = xlock } }, |
|
|
|
|
|
*/ |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_q, quit, { 0 } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_space, dofloat, { 0 } }, |
|
|
|
|
|
/*{ MODKEY|ShiftMask, XK_w, spawn, { .argv = browse } },*/ |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } }, |
|
|
|
|
|
|
|
|
{ MODKEY|ShiftMask, XK_0, replacetag, { .i = Tscratch } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_1, replacetag, { .i = Tdev } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_2, replacetag, { .i = Twww } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_3, replacetag, { .i = Twork } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_c, killclient, { 0 } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_g, spawn, { .argv = gimp } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_l, spawn, { .argv = xlock } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_q, quit, { 0 } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_space, dofloat, { 0 } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_w, spawn, { .argv = browse } }, |
|
|
|
|
|
{ MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } }, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/* static */ |
|
|
/* static */ |
|
@ -71,15 +65,15 @@ static Key key[] = { |
|
|
static void |
|
|
static void |
|
|
movemouse(Client *c) |
|
|
movemouse(Client *c) |
|
|
{ |
|
|
{ |
|
|
XEvent ev; |
|
|
|
|
|
int x1, y1, ocx, ocy, di; |
|
|
int x1, y1, ocx, ocy, di; |
|
|
unsigned int dui; |
|
|
unsigned int dui; |
|
|
Window dummy; |
|
|
Window dummy; |
|
|
|
|
|
XEvent ev; |
|
|
|
|
|
|
|
|
ocx = c->x; |
|
|
ocx = c->x; |
|
|
ocy = c->y; |
|
|
ocy = c->y; |
|
|
if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync, |
|
|
if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync, |
|
|
None, cursor[CurMove], CurrentTime) != GrabSuccess) |
|
|
|
|
|
|
|
|
None, cursor[CurMove], CurrentTime) != GrabSuccess) |
|
|
return; |
|
|
return; |
|
|
XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); |
|
|
XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); |
|
|
for(;;) { |
|
|
for(;;) { |
|
@ -105,9 +99,9 @@ movemouse(Client *c) |
|
|
static void |
|
|
static void |
|
|
resizemouse(Client *c) |
|
|
resizemouse(Client *c) |
|
|
{ |
|
|
{ |
|
|
XEvent ev; |
|
|
|
|
|
int ocx, ocy; |
|
|
int ocx, ocy; |
|
|
Corner sticky; |
|
|
Corner sticky; |
|
|
|
|
|
XEvent ev; |
|
|
|
|
|
|
|
|
ocx = c->x; |
|
|
ocx = c->x; |
|
|
ocy = c->y; |
|
|
ocy = c->y; |
|
@ -146,8 +140,8 @@ buttonpress(XEvent *e) |
|
|
{ |
|
|
{ |
|
|
int x; |
|
|
int x; |
|
|
Arg a; |
|
|
Arg a; |
|
|
XButtonPressedEvent *ev = &e->xbutton; |
|
|
|
|
|
Client *c; |
|
|
Client *c; |
|
|
|
|
|
XButtonPressedEvent *ev = &e->xbutton; |
|
|
|
|
|
|
|
|
if(barwin == ev->window) { |
|
|
if(barwin == ev->window) { |
|
|
switch(ev->button) { |
|
|
switch(ev->button) { |
|
@ -201,9 +195,9 @@ buttonpress(XEvent *e) |
|
|
static void |
|
|
static void |
|
|
configurerequest(XEvent *e) |
|
|
configurerequest(XEvent *e) |
|
|
{ |
|
|
{ |
|
|
|
|
|
Client *c; |
|
|
XConfigureRequestEvent *ev = &e->xconfigurerequest; |
|
|
XConfigureRequestEvent *ev = &e->xconfigurerequest; |
|
|
XWindowChanges wc; |
|
|
XWindowChanges wc; |
|
|
Client *c; |
|
|
|
|
|
|
|
|
|
|
|
ev->value_mask &= ~CWSibling; |
|
|
ev->value_mask &= ~CWSibling; |
|
|
if((c = getclient(ev->window))) { |
|
|
if((c = getclient(ev->window))) { |
|
@ -248,8 +242,8 @@ destroynotify(XEvent *e) |
|
|
static void |
|
|
static void |
|
|
enternotify(XEvent *e) |
|
|
enternotify(XEvent *e) |
|
|
{ |
|
|
{ |
|
|
XCrossingEvent *ev = &e->xcrossing; |
|
|
|
|
|
Client *c; |
|
|
Client *c; |
|
|
|
|
|
XCrossingEvent *ev = &e->xcrossing; |
|
|
|
|
|
|
|
|
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) |
|
|
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) |
|
|
return; |
|
|
return; |
|
@ -263,8 +257,8 @@ enternotify(XEvent *e) |
|
|
static void |
|
|
static void |
|
|
expose(XEvent *e) |
|
|
expose(XEvent *e) |
|
|
{ |
|
|
{ |
|
|
XExposeEvent *ev = &e->xexpose; |
|
|
|
|
|
Client *c; |
|
|
Client *c; |
|
|
|
|
|
XExposeEvent *ev = &e->xexpose; |
|
|
|
|
|
|
|
|
if(ev->count == 0) { |
|
|
if(ev->count == 0) { |
|
|
if(barwin == ev->window) |
|
|
if(barwin == ev->window) |
|
@ -277,10 +271,10 @@ expose(XEvent *e) |
|
|
static void |
|
|
static void |
|
|
keypress(XEvent *e) |
|
|
keypress(XEvent *e) |
|
|
{ |
|
|
{ |
|
|
XKeyEvent *ev = &e->xkey; |
|
|
|
|
|
static unsigned int len = key ? sizeof(key) / sizeof(key[0]) : 0; |
|
|
static unsigned int len = key ? sizeof(key) / sizeof(key[0]) : 0; |
|
|
unsigned int i; |
|
|
unsigned int i; |
|
|
KeySym keysym; |
|
|
KeySym keysym; |
|
|
|
|
|
XKeyEvent *ev = &e->xkey; |
|
|
|
|
|
|
|
|
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); |
|
|
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); |
|
|
for(i = 0; i < len; i++) |
|
|
for(i = 0; i < len; i++) |
|
@ -303,8 +297,8 @@ leavenotify(XEvent *e) |
|
|
static void |
|
|
static void |
|
|
maprequest(XEvent *e) |
|
|
maprequest(XEvent *e) |
|
|
{ |
|
|
{ |
|
|
XMapRequestEvent *ev = &e->xmaprequest; |
|
|
|
|
|
static XWindowAttributes wa; |
|
|
static XWindowAttributes wa; |
|
|
|
|
|
XMapRequestEvent *ev = &e->xmaprequest; |
|
|
|
|
|
|
|
|
if(!XGetWindowAttributes(dpy, ev->window, &wa)) |
|
|
if(!XGetWindowAttributes(dpy, ev->window, &wa)) |
|
|
return; |
|
|
return; |
|
@ -322,9 +316,9 @@ maprequest(XEvent *e) |
|
|
static void |
|
|
static void |
|
|
propertynotify(XEvent *e) |
|
|
propertynotify(XEvent *e) |
|
|
{ |
|
|
{ |
|
|
XPropertyEvent *ev = &e->xproperty; |
|
|
|
|
|
Window trans; |
|
|
|
|
|
Client *c; |
|
|
Client *c; |
|
|
|
|
|
Window trans; |
|
|
|
|
|
XPropertyEvent *ev = &e->xproperty; |
|
|
|
|
|
|
|
|
if(ev->state == PropertyDelete) |
|
|
if(ev->state == PropertyDelete) |
|
|
return; /* ignore */ |
|
|
return; /* ignore */ |
|
|