simplified Mod-m
This commit is contained in:
parent
d66ad1457e
commit
5f19423c7b
@ -46,7 +46,7 @@ Key keys[] = {
|
|||||||
{ MODKEY, XK_k, focusprev, NULL },
|
{ MODKEY, XK_k, focusprev, NULL },
|
||||||
{ MODKEY, XK_h, setmwfact, "-0.05" },
|
{ MODKEY, XK_h, setmwfact, "-0.05" },
|
||||||
{ MODKEY, XK_l, setmwfact, "+0.05" },
|
{ MODKEY, XK_l, setmwfact, "+0.05" },
|
||||||
{ MODKEY, XK_m, togglemax, NULL },
|
{ MODKEY, XK_m, maximize, NULL },
|
||||||
{ MODKEY, XK_r, reapply, NULL },
|
{ MODKEY, XK_r, reapply, NULL },
|
||||||
{ MODKEY, XK_Return, zoom, NULL },
|
{ MODKEY, XK_Return, zoom, NULL },
|
||||||
{ MODKEY, XK_Tab, viewprevtag, NULL },
|
{ MODKEY, XK_Tab, viewprevtag, NULL },
|
||||||
|
2
dwm.1
2
dwm.1
@ -78,7 +78,7 @@ Focus previous window.
|
|||||||
Increases the master area width about 5% (tiled layout only).
|
Increases the master area width about 5% (tiled layout only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-m
|
.B Mod1\-m
|
||||||
Toggles maximization of current window.
|
Maximizes current window (floating layout/window only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-r
|
.B Mod1\-r
|
||||||
Re-applies tagging rules to all windows.
|
Re-applies tagging rules to all windows.
|
||||||
|
46
dwm.c
46
dwm.c
@ -61,12 +61,11 @@ typedef struct Client Client;
|
|||||||
struct Client {
|
struct Client {
|
||||||
char name[256];
|
char name[256];
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
int rx, ry, rw, rh; /* revert geometry */
|
|
||||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||||
int minax, maxax, minay, maxay;
|
int minax, maxax, minay, maxay;
|
||||||
long flags;
|
long flags;
|
||||||
unsigned int border, oldborder;
|
unsigned int border, oldborder;
|
||||||
Bool isbanned, isfixed, ismax, isfloating, wasfloating;
|
Bool isbanned, isfixed, isfloating;
|
||||||
Bool *tags;
|
Bool *tags;
|
||||||
Client *next;
|
Client *next;
|
||||||
Client *prev;
|
Client *prev;
|
||||||
@ -157,6 +156,7 @@ void leavenotify(XEvent *e);
|
|||||||
void manage(Window w, XWindowAttributes *wa);
|
void manage(Window w, XWindowAttributes *wa);
|
||||||
void mappingnotify(XEvent *e);
|
void mappingnotify(XEvent *e);
|
||||||
void maprequest(XEvent *e);
|
void maprequest(XEvent *e);
|
||||||
|
void maximize(const char *arg);
|
||||||
void movemouse(Client *c);
|
void movemouse(Client *c);
|
||||||
Client *nexttiled(Client *c);
|
Client *nexttiled(Client *c);
|
||||||
void propertynotify(XEvent *e);
|
void propertynotify(XEvent *e);
|
||||||
@ -178,7 +178,6 @@ unsigned int textw(const char *text);
|
|||||||
void tile(void);
|
void tile(void);
|
||||||
void togglebar(const char *arg);
|
void togglebar(const char *arg);
|
||||||
void togglefloating(const char *arg);
|
void togglefloating(const char *arg);
|
||||||
void togglemax(const char *arg);
|
|
||||||
void toggletag(const char *arg);
|
void toggletag(const char *arg);
|
||||||
void toggleview(const char *arg);
|
void toggleview(const char *arg);
|
||||||
void unban(Client *c);
|
void unban(Client *c);
|
||||||
@ -466,7 +465,6 @@ configurerequest(XEvent *e) {
|
|||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
if((c = getclient(ev->window))) {
|
if((c = getclient(ev->window))) {
|
||||||
c->ismax = False;
|
|
||||||
if(ev->value_mask & CWBorderWidth)
|
if(ev->value_mask & CWBorderWidth)
|
||||||
c->border = ev->border_width;
|
c->border = ev->border_width;
|
||||||
if(c->isfixed || c->isfloating || (floating == layout->arrange)) {
|
if(c->isfixed || c->isfloating || (floating == layout->arrange)) {
|
||||||
@ -563,7 +561,7 @@ drawbar(void) {
|
|||||||
dc.x = x;
|
dc.x = x;
|
||||||
if(sel) {
|
if(sel) {
|
||||||
drawtext(sel->name, dc.sel);
|
drawtext(sel->name, dc.sel);
|
||||||
drawsquare(sel->ismax, sel->isfloating, dc.sel);
|
drawsquare(False, sel->isfloating, dc.sel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
drawtext(NULL, dc.norm);
|
drawtext(NULL, dc.norm);
|
||||||
@ -1078,6 +1076,13 @@ maprequest(XEvent *e) {
|
|||||||
manage(ev->window, &wa);
|
manage(ev->window, &wa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
maximize(const char *arg) {
|
||||||
|
if(!sel || (!sel->isfloating && layout->arrange != floating))
|
||||||
|
return;
|
||||||
|
resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
movemouse(Client *c) {
|
movemouse(Client *c) {
|
||||||
int x1, y1, ocx, ocy, di, nx, ny;
|
int x1, y1, ocx, ocy, di, nx, ny;
|
||||||
@ -1090,7 +1095,6 @@ movemouse(Client *c) {
|
|||||||
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;
|
||||||
c->ismax = False;
|
|
||||||
XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
|
XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
|
||||||
for(;;) {
|
for(;;) {
|
||||||
XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask, &ev);
|
XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask, &ev);
|
||||||
@ -1248,7 +1252,6 @@ resizemouse(Client *c) {
|
|||||||
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||||
None, cursor[CurResize], CurrentTime) != GrabSuccess)
|
None, cursor[CurResize], CurrentTime) != GrabSuccess)
|
||||||
return;
|
return;
|
||||||
c->ismax = False;
|
|
||||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->border - 1, c->h + c->border - 1);
|
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->border - 1, c->h + c->border - 1);
|
||||||
for(;;) {
|
for(;;) {
|
||||||
XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask , &ev);
|
XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask , &ev);
|
||||||
@ -1609,7 +1612,6 @@ tile(void) {
|
|||||||
ny = way;
|
ny = way;
|
||||||
nw = 0; /* gcc stupidity requires this */
|
nw = 0; /* gcc stupidity requires this */
|
||||||
for(i = 0, c = mc = nexttiled(clients); c; c = nexttiled(c->next), i++) {
|
for(i = 0, c = mc = nexttiled(clients); c; c = nexttiled(c->next), i++) {
|
||||||
c->ismax = False;
|
|
||||||
if(i == 0) { /* master */
|
if(i == 0) { /* master */
|
||||||
nw = mw - 2 * c->border;
|
nw = mw - 2 * c->border;
|
||||||
nh = wah - 2 * c->border;
|
nh = wah - 2 * c->border;
|
||||||
@ -1654,34 +1656,6 @@ togglefloating(const char *arg) {
|
|||||||
arrange();
|
arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
togglemax(const char *arg) {
|
|
||||||
XEvent ev;
|
|
||||||
|
|
||||||
if(!sel || sel->isfixed)
|
|
||||||
return;
|
|
||||||
if((sel->ismax = !sel->ismax)) {
|
|
||||||
if((layout->arrange == floating) || sel->isfloating)
|
|
||||||
sel->wasfloating = True;
|
|
||||||
else {
|
|
||||||
togglefloating(NULL);
|
|
||||||
sel->wasfloating = False;
|
|
||||||
}
|
|
||||||
sel->rx = sel->x;
|
|
||||||
sel->ry = sel->y;
|
|
||||||
sel->rw = sel->w;
|
|
||||||
sel->rh = sel->h;
|
|
||||||
resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
|
|
||||||
if(!sel->wasfloating)
|
|
||||||
togglefloating(NULL);
|
|
||||||
}
|
|
||||||
drawbar();
|
|
||||||
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
toggletag(const char *arg) {
|
toggletag(const char *arg) {
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
Loading…
Reference in New Issue
Block a user