diff options
| -rw-r--r-- | config.h | 80 | ||||
| -rw-r--r-- | drw.c | 6 | ||||
| -rw-r--r-- | dwm.c | 350 |
3 files changed, 217 insertions, 219 deletions
@@ -24,9 +24,9 @@ static const char *colors[][5] = { /* autostart */ static const char *const autostart[] = { /* program arguments options null terminator */ - "xhidecursor", "", "", NULL, - "hsetroot", "-fill", WALLPAPER, NULL, - NULL + "xhidecursor", "", "", NULL, + "hsetroot", "-fill", WALLPAPER, NULL, + NULL }; /* tagging */ @@ -38,17 +38,17 @@ static const Rule rules[] = { * WM_NAME(STRING) = title */ /* class instance title tags mask isfloating isterminal noswallow monitor */ - { "steam", "steamwebhelper", NULL, 0, 1, 0, 0, -1 }, - { "Steam", "Steam", NULL, 0, 1, 0, 0, -1 }, - { "steam", "steamwebhelper", "Steam", 0, 0, 0, 0, -1 }, - { "steam", NULL, "Steam Settings", 0, 1, 0, 0, -1 }, - { "qemu-system-x86_64","qemu-system-x86_64",NULL, 0, 1, 0, 0, -1 }, - { "st-256color", "st-256color", NULL, 0, 0, 1, 1, -1 }, - { "stfloat", "st-256color", NULL, 0, 1, 1, 1, -1 }, - { "Nsxiv", NULL, NULL, 0, 1, 0, 0, -1 }, - { "scrcpy", NULL, NULL, 0, 1, 0, 0, -1 }, - { "steam_app_1237950","steam_app_1237950",NULL, 0, 1, 0, 1, -1 }, - { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, + { "steam", "steamwebhelper", NULL, 0, 1, 0, 0, -1 }, + { "Steam", "Steam", NULL, 0, 1, 0, 0, -1 }, + { "steam", "steamwebhelper", "Steam", 0, 0, 0, 0, -1 }, + { "steam", NULL, "Steam Settings", 0, 1, 0, 0, -1 }, + { "qemu-system-x86_64","qemu-system-x86_64",NULL, 0, 1, 0, 0, -1 }, + { "st-256color", "st-256color", NULL, 0, 0, 1, 1, -1 }, + { "stfloat", "st-256color", NULL, 0, 1, 1, 1, -1 }, + { "Nsxiv", NULL, NULL, 0, 1, 0, 0, -1 }, + { "scrcpy", NULL, NULL, 0, 1, 0, 0, -1 }, + { "steam_app_1237950","steam_app_1237950",NULL, 0, 1, 0, 1, -1 }, + { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, }; /* layout(s) */ @@ -60,8 +60,8 @@ static const int lockfullscreen = 0; /* 1 will force focus on the fullscreen win static const Layout layouts[] = { /* symbol arrange function */ { NULL, tile }, /* first entry is default */ - { NULL, NULL }, - { NULL, monocle }, + { NULL, NULL }, + { NULL, monocle }, }; /* key definitions */ @@ -82,7 +82,7 @@ static const char *termcmd[] = { TERMINAL, NULL }; #include <X11/XF86keysym.h> static const Key keys[] = { /* modifier key function argument */ - { MODKEY, XK_space, spawn, {.v = termcmd } }, + { MODKEY, XK_space, spawn, {.v = termcmd } }, { MODKEY, XK_d, spawn, SHCMD("dmenu_run") }, { MODKEYTWO, XK_space, spawn, SHCMD(TERMINAL" -c stfloat") }, { MODKEY, XK_j, focusstack, {.i = +1 } }, @@ -97,7 +97,7 @@ static const Key keys[] = { { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY|ShiftMask, XK_Return, togglefullscr, {0} }, + { MODKEY|ShiftMask, XK_Return, togglefullscr, {0} }, { MODKEY, XK_Return, togglefloating, {0} }, { MODKEY, XK_grave, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_grave, tag, {.ui = ~0 } }, @@ -116,33 +116,33 @@ static const Key keys[] = { { MODKEY, XK_n, spawn, SHCMD(TERMINAL" -e newsboat") }, { MODKEY, XK_Escape, spawn, SHCMD(TERMINAL" -e htop") }, { MODKEYTWO, XK_Escape, spawn, SHCMD(TERMINAL" -c stfloat -e htop") }, - { MODKEY, XK_x, spawn, SHCMD("xkill") }, - { MODKEY, XK_w, spawn, SHCMD(BROWSER) }, - { MODKEY|ShiftMask, XK_w, spawn, SHCMD("icecat") }, + { MODKEY, XK_x, spawn, SHCMD("xkill") }, + { MODKEY, XK_w, spawn, SHCMD(BROWSER) }, + { MODKEY|ShiftMask, XK_w, spawn, SHCMD("icecat") }, { MODKEY, XK_a, swapfocus, {0} }, { MODKEY|ShiftMask, XK_a, spawn, SHCMD("scrcpy") }, { MODKEY, XK_BackSpace, swapfocus, {0} }, { MODKEY, XK_r, resetmfact, {0} }, #ifdef __linux__ - { MODKEY, XK_g, spawn, SHCMD(TERMINAL" -c stfloat -e watch -c -n 2 genlop -c") }, - { MODKEY, XK_s, spawn, SHCMD("steam -dev") }, - { MODKEY|ShiftMask, XK_s, spawn, SHCMD("pkill steam") }, + { MODKEY, XK_g, spawn, SHCMD(TERMINAL" -c stfloat -e watch -c -n 2 genlop -c") }, + { MODKEY, XK_s, spawn, SHCMD("steam -dev") }, + { MODKEY|ShiftMask, XK_s, spawn, SHCMD("pkill steam") }, - { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("amixer sset Master 5%+ 1> /dev/null") }, - { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("amixer sset Master 5%- 1> /dev/null") }, - { 0, XF86XK_AudioMute, spawn, SHCMD("amixer sset Master toggle 1> /dev/null") }, + { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("amixer sset Master 5%+ 1> /dev/null") }, + { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("amixer sset Master 5%- 1> /dev/null") }, + { 0, XF86XK_AudioMute, spawn, SHCMD("amixer sset Master toggle 1> /dev/null") }, - { MODKEYTWO, XK_t, spawn, SHCMD(TERMINAL" -c stfloat -e watch -n 1 transmission-remote -l") }, + { MODKEYTWO, XK_t, spawn, SHCMD(TERMINAL" -c stfloat -e watch -n 1 transmission-remote -l") }, #endif #ifdef __OpenBSD__ - { MODKEYTWO, XK_t, spawn, SHCMD(TERMINAL" -c stfloat -e gnuwatch -n 1 transmission-remote -l") }, + { MODKEYTWO, XK_t, spawn, SHCMD(TERMINAL" -c stfloat -e gnuwatch -n 1 transmission-remote -l") }, #endif { 0, XF86XK_MonBrightnessUp, spawn, SHCMD("xbacklight -inc 10") }, { 0, XF86XK_MonBrightnessDown, spawn, SHCMD("xbacklight -dec 10") }, - { MODKEY, XK_Print, spawn, SHCMD("maimpick") }, + { MODKEY, XK_Print, spawn, SHCMD("maimpick") }, { MODKEY, XK_p, search, {.i = 0} }, { MODKEY|ShiftMask, XK_p, search, {.i = 1} }, @@ -150,13 +150,13 @@ static const Key keys[] = { { MODKEY, XK_o, togglemouse, {0} }, - // move (rightmost 'wasd' like cluster of keys in ISO layout) + // move (rightmost 'wasd' like cluster of keys in ISO layout) { MODKEY, XK_apostrophe, moveresize, {.v = "0x 15y 0w 0h" } }, { MODKEY, XK_bracketleft, moveresize, {.v = "0x -15y 0w 0h" } }, { MODKEY, XK_numbersign, moveresize, {.v = "15x 0y 0w 0h" } }, { MODKEY, XK_semicolon, moveresize, {.v = "-15x 0y 0w 0h" } }, - // resize (rightmost 'wasd' like cluster of keys in ISO layout) + // resize (rightmost 'wasd' like cluster of keys in ISO layout) { MODKEY|ShiftMask, XK_apostrophe, moveresize, {.v = "0x 0y 0w 15h" } }, { MODKEY|ShiftMask, XK_bracketleft, moveresize, {.v = "0x 0y 0w -15h" } }, { MODKEY|ShiftMask, XK_numbersign, moveresize, {.v = "0x 0y 15w 0h" } }, @@ -168,21 +168,21 @@ static const Key keys[] = { /* button definitions */ static const Button buttons[] = { - /* click event mask button function argument */ - { ClkClientWin, MODKEY|ShiftMask, Button1, movemouse, {0} }, // regular window move - { ClkClientWin, MODKEY, Button1, movemouse, {.i = 1} }, // tiled window move - { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + /* click event mask button function argument */ + { ClkClientWin, MODKEY|ShiftMask, Button1, movemouse, {0} }, // regular window move + { ClkClientWin, MODKEY, Button1, movemouse, {.i = 1} }, // tiled window move + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, MODKEY, Button3, clientresize, {0} }, - /* Focus windows with scroll wheel */ + /* Focus windows with scroll wheel */ { ClkClientWin, MODKEY, Button4, focusstack, {.i = -1 } }, { ClkClientWin, MODKEY, Button5, focusstack, {.i = +1 } }, { ClkRootWin, MODKEY, Button4, focusstack, {.i = -1 } }, { ClkRootWin, MODKEY, Button5, focusstack, {.i = +1 } }, - /* Focus monitors with side mouse buttons */ + /* Focus monitors with side mouse buttons */ { ClkClientWin, MODKEY, Button8, focusmon, {.i = -1 } }, - { ClkClientWin, MODKEY, Button9, focusmon, {.i = +1 } }, + { ClkClientWin, MODKEY, Button9, focusmon, {.i = +1 } }, { ClkRootWin, MODKEY, Button8, focusmon, {.i = -1 } }, - { ClkRootWin, MODKEY, Button9, focusmon, {.i = +1 } }, + { ClkRootWin, MODKEY, Button9, focusmon, {.i = +1 } }, }; @@ -8,8 +8,6 @@ #include "drw.h" #include "util.h" -#define UTF_INVALID 0xFFFD - Drw * drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) { @@ -42,8 +40,8 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname) return; if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), - DefaultColormap(drw->dpy, drw->screen), - clrname, dest)) + DefaultColormap(drw->dpy, drw->screen), + clrname, dest)) die("error, cannot allocate color '%s'", clrname); dest->pixel |= 0xff << 24; @@ -97,7 +97,7 @@ struct Client { int bw, oldbw; unsigned int tags; int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow; - int issteam; + int issteam; pid_t pid; Client *next; Client *snext; @@ -838,17 +838,17 @@ focus(Client *c) attachstack(c); grabbuttons(c, 1); - if (c == nexttiled(selmon->clients)) { - XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColMaster].pixel); - } else if(c->isfloating || !selmon->lt[selmon->sellt]->arrange) { - XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColFloat].pixel); - } else { - XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); - } + if (c == nexttiled(selmon->clients)) { + XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColMaster].pixel); + } else if(c->isfloating || !selmon->lt[selmon->sellt]->arrange) { + XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColFloat].pixel); + } else { + XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); + } setfocus(c); - if (selmon->lt[selmon->sellt]->arrange == monocle) - XRaiseWindow(dpy, c->win); + if (selmon->lt[selmon->sellt]->arrange == monocle) + XRaiseWindow(dpy, c->win); } else { XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); XDeleteProperty(dpy, root, netatom[NetActiveWindow]); @@ -1115,19 +1115,19 @@ manage(Window w, XWindowAttributes *wa) wc.border_width = c->bw; XConfigureWindow(dpy, w, CWBorderWidth, &wc); - if (c == nexttiled(selmon->clients)) { + if (c == nexttiled(selmon->clients)) { XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColMaster].pixel); - } else if(c->isfloating || !selmon->lt[selmon->sellt]->arrange) { + } else if(c->isfloating || !selmon->lt[selmon->sellt]->arrange) { XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColFloat].pixel); - } else + } else XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); configure(c); /* propagates border_width, if size doesn't change */ updatewindowtype(c); updatesizehints(c); updatewmhints(c); - c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2; - c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2; + c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2; + c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2; XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); grabbuttons(c, 0); if (!c->isfloating) @@ -1256,15 +1256,15 @@ moveresize(const Arg *arg) { Bool xqp = XQueryPointer(dpy, root, &dummy, &dummy, &msx, &msy, &dx, &dy, &dui); resize(c, nx, ny, nw, nh, True); - if (!ml) { - if (xqp && ox <= msx && (ox + ow) >= msx && oy <= msy && (oy + oh) >= msy) - { - nmx = c->x - ox + c->w - ow; - nmy = c->y - oy + c->h - oh; - if ((msx + nmx) > c->x && (msy + nmy) > c->y) - XWarpPointer(dpy, None, None, 0, 0, 0, 0, nmx, nmy); - } - } + if (!ml) { + if (xqp && ox <= msx && (ox + ow) >= msx && oy <= msy && (oy + oh) >= msy) + { + nmx = c->x - ox + c->w - ow; + nmy = c->y - oy + c->h - oh; + if ((msx + nmx) > c->x && (msy + nmy) > c->y) + XWarpPointer(dpy, None, None, 0, 0, 0, 0, nmx, nmy); + } + } } void @@ -1274,7 +1274,7 @@ movemouse(const Arg *arg) Client *c; Monitor *m; XEvent ev; - Time lasttime = 0; + Time lasttime = 0; if (!(c = selmon->sel)) return; @@ -1404,7 +1404,7 @@ propertynotify(XEvent *e) Window trans; XPropertyEvent *ev = &e->xproperty; - if (ev->state == PropertyDelete) + if (ev->state == PropertyDelete) return; /* ignore */ else if ((c = wintoclient(ev->window))) { switch(ev->atom) { @@ -1433,15 +1433,15 @@ void quit(const Arg *arg) { if(arg->i) restart = 1; - size_t i; + size_t i; - for (i = 0; i < autostart_len; i++) { - if (0 < autostart_pids[i]) { - kill(autostart_pids[i], SIGTERM); - waitpid(autostart_pids[i], NULL, 0); - } - } - running = 0; + for (i = 0; i < autostart_len; i++) { + if (0 < autostart_pids[i]) { + kill(autostart_pids[i], SIGTERM); + waitpid(autostart_pids[i], NULL, 0); + } + } + running = 0; } Monitor * @@ -1476,9 +1476,9 @@ resizeclient(Client *c, int x, int y, int w, int h) c->oldh = c->h; c->h = wc.height = h; wc.border_width = c->bw; if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next)) - || &monocle == c->mon->lt[c->mon->sellt]->arrange) - && !c->isfullscreen && !c->isfloating - && NULL != c->mon->lt[c->mon->sellt]->arrange) { + || &monocle == c->mon->lt[c->mon->sellt]->arrange) + && !c->isfullscreen && !c->isfloating + && NULL != c->mon->lt[c->mon->sellt]->arrange) { c->w = wc.width += c->bw * 2; c->h = wc.height += c->bw * 2; wc.border_width = 0; @@ -1496,7 +1496,7 @@ resizemouse(const Arg *arg) Client *c; Monitor *m; XEvent ev; - Time lasttime = 0; + Time lasttime = 0; if (!(c = selmon->sel)) return; @@ -1762,7 +1762,7 @@ setup(void) XSetWindowAttributes wa; Atom utf8string; struct sigaction sa; - pid_t pid; + pid_t pid; /* do not transform children into zombies when they terminate */ sigemptyset(&sa.sa_mask); @@ -1771,20 +1771,20 @@ setup(void) sigaction(SIGCHLD, &sa, NULL); /* clean up any zombies (inherited from .xinitrc etc) immediately */ - while (0 < (pid = waitpid(-1, NULL, WNOHANG))) { - pid_t *p, *lim; + while (0 < (pid = waitpid(-1, NULL, WNOHANG))) { + pid_t *p, *lim; - if (!(p = autostart_pids)) - continue; - lim = &p[autostart_len]; + if (!(p = autostart_pids)) + continue; + lim = &p[autostart_len]; - for (; p < lim; p++) { - if (*p == pid) { - *p = -1; - break; - } - } - } + for (; p < lim; p++) { + if (*p == pid) { + *p = -1; + break; + } + } + } signal(SIGHUP, sighup); @@ -1823,8 +1823,8 @@ setup(void) for (i = 0; i < LENGTH(colors); i++) scheme[i] = drw_scm_create(drw, colors[i], 5); - /* init mouse */ - mousedefault == 0 ? togglemouse(NULL) : (void)0 ; + /* init mouse */ + mousedefault == 0 ? togglemouse(NULL) : (void)0 ; /* supporting window for NetWMCheck */ wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0); @@ -1983,12 +1983,12 @@ togglefloating(const Arg *arg) if (selmon->sel->isfloating) XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColFloat].pixel); else { - if (selmon->sel == nexttiled(selmon->clients)) { - XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColMaster].pixel); - } else { - XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColBorder].pixel); - } - } + if (selmon->sel == nexttiled(selmon->clients)) { + XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColMaster].pixel); + } else { + XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColBorder].pixel); + } + } if(selmon->sel->isfloating) resize(selmon->sel, selmon->sel->x, selmon->sel->y, selmon->sel->w, selmon->sel->h, 0); @@ -1999,7 +1999,7 @@ void togglefullscr(const Arg *arg) { if(selmon->sel) - setfullscreen(selmon->sel, !selmon->sel->isfullscreen); + setfullscreen(selmon->sel, !selmon->sel->isfullscreen); } void @@ -2036,10 +2036,10 @@ unfocus(Client *c, int setfocus) return; prevclient = c; grabbuttons(c, 0); - if (c->isfloating || !selmon->lt[selmon->sellt]->arrange) - XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColFloat].pixel); - else - XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); + if (c->isfloating || !selmon->lt[selmon->sellt]->arrange) + XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColFloat].pixel); + else + XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); if (setfocus) { XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); XDeleteProperty(dpy, root, netatom[NetActiveWindow]); @@ -2086,9 +2086,9 @@ unmanage(Client *c, int destroyed) arrange(m); focus(NULL); updateclientlist(); - if (m == selmon && m->sel) - XWarpPointer(dpy, None, m->sel->win, 0, 0, 0, 0, - m->sel->w/2, m->sel->h/2); + if (m == selmon && m->sel) + XWarpPointer(dpy, None, m->sel->win, 0, 0, 0, 0, + m->sel->w/2, m->sel->h/2); } } @@ -2344,18 +2344,18 @@ winpid(Window w) #endif /* __linux__ */ #ifdef __OpenBSD__ - Atom type; - int format; - unsigned long len, bytes; - unsigned char *prop; - pid_t ret; + Atom type; + int format; + unsigned long len, bytes; + unsigned char *prop; + pid_t ret; - if (XGetWindowProperty(dpy, w, XInternAtom(dpy, "_NET_WM_PID", 0), 0, 1, False, AnyPropertyType, &type, &format, &len, &bytes, &prop) != Success || !prop) - return 0; + if (XGetWindowProperty(dpy, w, XInternAtom(dpy, "_NET_WM_PID", 0), 0, 1, False, AnyPropertyType, &type, &format, &len, &bytes, &prop) != Success || !prop) + return 0; - ret = *(pid_t*)prop; - XFree(prop); - result = ret; + ret = *(pid_t*)prop; + XFree(prop); + result = ret; #endif /* __OpenBSD__ */ return result; @@ -2514,7 +2514,7 @@ zoom(const Arg *arg) return; pop(c); - XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2); + XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2); } void @@ -2527,7 +2527,7 @@ search(const Arg *arg) { int clientnum = 0; Client **clients = NULL; size_t clientsize = 0; - int mode = arg->i; + int mode = arg->i; for (m = mons; m; m = m->next) { for (c = m->clients; c; c = c->next) { @@ -2563,9 +2563,9 @@ search(const Arg *arg) { die("search: realloc failed"); } - strlcpy(names + nameslen, ts, namesize - nameslen); - nameslen += tl; - strlcpy(names + nameslen, c->name, namesize - nameslen); + strlcpy(names + nameslen, ts, namesize - nameslen); + nameslen += tl; + strlcpy(names + nameslen, c->name, namesize - nameslen); nameslen += namelen; names[nameslen] = '\n'; @@ -2605,42 +2605,42 @@ search(const Arg *arg) { if (strcmp(clients[i]->name, clientname) == 0) { Client *selclient = clients[i]; - if (mode == 1 || mode == 2) { - selclient->tags = selmon->tagset[selmon->seltags]; - - if (selclient->mon != selmon) { - detach(selclient); - detachstack(selclient); - selclient->mon = selmon; - attach(selclient); - attachstack(selclient); - } - - focus(selclient); - - if (mode == 1) { - arrange(selmon); - if (selclient != nexttiled(selmon->clients)) { - zoom(0); - } - } else if (mode == 2) - killclient(0); - - } else { - if (selclient->mon != selmon) - selmon = selclient->mon; - - Arg view_arg; - view_arg.ui = selclient->tags; - view(&view_arg); - - focus(selclient); - - if (selclient != nexttiled(selmon->clients)) { - zoom(0); - } - - } + if (mode == 1 || mode == 2) { + selclient->tags = selmon->tagset[selmon->seltags]; + + if (selclient->mon != selmon) { + detach(selclient); + detachstack(selclient); + selclient->mon = selmon; + attach(selclient); + attachstack(selclient); + } + + focus(selclient); + + if (mode == 1) { + arrange(selmon); + if (selclient != nexttiled(selmon->clients)) { + zoom(0); + } + } else if (mode == 2) + killclient(0); + + } else { + if (selclient->mon != selmon) + selmon = selclient->mon; + + Arg view_arg; + view_arg.ui = selclient->tags; + view(&view_arg); + + focus(selclient); + + if (selclient != nexttiled(selmon->clients)) { + zoom(0); + } + + } break; } @@ -2655,71 +2655,71 @@ search(const Arg *arg) { void togglemouse(const Arg *arg) { - if (ml) { - XUngrabPointer(dpy, CurrentTime); + if (ml) { + XUngrabPointer(dpy, CurrentTime); XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2); - if (fw) { - XDestroyWindow(dpy, fw); - fw = 0; - } - ml = 0; - return; - } - - Window root = RootWindow(dpy, screen); - - XSetWindowAttributes attrs; - attrs.override_redirect = True; - attrs.event_mask = 0; - - fw = XCreateWindow( - dpy, root, 0, sh - 1, 1, 1, 0, - DefaultDepth(dpy, screen), - InputOutput, DefaultVisual(dpy, screen), - CWOverrideRedirect | CWEventMask, &attrs - ); - - XMapRaised(dpy, fw); - XSync(dpy, False); - - XWarpPointer(dpy, None, root, 0, 0, 0, 0, 0, sh - 1); - - if (XGrabPointer(dpy, fw, True, - 0, - GrabModeAsync, - GrabModeAsync, - fw, - None, - CurrentTime) != GrabSuccess) { - XDestroyWindow(dpy, fw); - fw = 0; - return; - } - - ml = 1; + if (fw) { + XDestroyWindow(dpy, fw); + fw = 0; + } + ml = 0; + return; + } + + Window root = RootWindow(dpy, screen); + + XSetWindowAttributes attrs; + attrs.override_redirect = True; + attrs.event_mask = 0; + + fw = XCreateWindow( + dpy, root, 0, sh - 1, 1, 1, 0, + DefaultDepth(dpy, screen), + InputOutput, DefaultVisual(dpy, screen), + CWOverrideRedirect | CWEventMask, &attrs + ); + + XMapRaised(dpy, fw); + XSync(dpy, False); + + XWarpPointer(dpy, None, root, 0, 0, 0, 0, 0, sh - 1); + + if (XGrabPointer(dpy, fw, True, + 0, + GrabModeAsync, + GrabModeAsync, + fw, + None, + CurrentTime) != GrabSuccess) { + XDestroyWindow(dpy, fw); + fw = 0; + return; + } + + ml = 1; } static void autostart_exec() { - const char *const *p; - size_t i = 0; + const char *const *p; + size_t i = 0; - for (p = autostart; *p; autostart_len++, p++) - while (*++p); + for (p = autostart; *p; autostart_len++, p++) + while (*++p); - autostart_pids = malloc(autostart_len * sizeof(pid_t)); + autostart_pids = malloc(autostart_len * sizeof(pid_t)); - for (p = autostart; *p; i++, p++) { - if ((autostart_pids[i] = fork()) == 0) { - setsid(); - execvp(*p, (char *const *)p); - fprintf(stderr, "dwm: execvp %s\n", *p); - perror(" failed"); - _exit(EXIT_FAILURE); - } + for (p = autostart; *p; i++, p++) { + if ((autostart_pids[i] = fork()) == 0) { + setsid(); + execvp(*p, (char *const *)p); + fprintf(stderr, "dwm: execvp %s\n", *p); + perror(" failed"); + _exit(EXIT_FAILURE); + } - while (*++p); - } + while (*++p); + } } int @@ -2736,7 +2736,7 @@ main(int argc, char *argv[]) if (!(xcon = XGetXCBConnection(dpy))) die("dwm: cannot get xcb connection\n"); checkotherwm(); - autostart_exec(); + autostart_exec(); setup(); #ifdef __OpenBSD__ if (pledge("stdio rpath proc exec ps", NULL) == -1) |
