diff options
| author | Anselm R. Garbe <arg@suckless.org> | 2007-02-19 17:00:32 +0100 |
|---|---|---|
| committer | Anselm R. Garbe <arg@suckless.org> | 2007-02-19 17:00:32 +0100 |
| commit | cee56d38632bbac08e7f59d58c7c7ab1370be329 (patch) | |
| tree | 53869a5d9d948bbd25f51a57f531e9b7d4f282af | |
| parent | removed debug compile flags (diff) | |
| download | dwm-cee56d38632bbac08e7f59d58c7c7ab1370be329.tar.gz dwm-cee56d38632bbac08e7f59d58c7c7ab1370be329.zip | |
renamed floating into swimming (this does not clash with C naming conventions and fits better the fish symbol) - also in man page
Diffstat (limited to '')
| -rw-r--r-- | client.c | 8 | ||||
| -rw-r--r-- | config.arg.h | 8 | ||||
| -rw-r--r-- | config.default.h | 8 | ||||
| -rw-r--r-- | dwm.1 | 20 | ||||
| -rw-r--r-- | dwm.h | 7 | ||||
| -rw-r--r-- | event.c | 8 | ||||
| -rw-r--r-- | screen.c | 133 |
7 files changed, 96 insertions, 96 deletions
| @@ -253,8 +253,8 @@ manage(Window w, XWindowAttributes *wa) { | |||
| 253 | updatetitle(c); | 253 | updatetitle(c); |
| 254 | for(t = clients; t && t->win != trans; t = t->next); | 254 | for(t = clients; t && t->win != trans; t = t->next); |
| 255 | settags(c, t); | 255 | settags(c, t); |
| 256 | if(!c->isfloat) | 256 | if(!c->swimming) |
| 257 | c->isfloat = (t != NULL) || c->isfixed; | 257 | c->swimming = (t != NULL) || c->isfixed; |
| 258 | attach(c); | 258 | attach(c); |
| 259 | attachstack(c); | 259 | attachstack(c); |
| 260 | c->isbanned = True; | 260 | c->isbanned = True; |
| @@ -268,7 +268,7 @@ manage(Window w, XWindowAttributes *wa) { | |||
| 268 | 268 | ||
| 269 | Client * | 269 | Client * |
| 270 | nexttiled(Client *c) { | 270 | nexttiled(Client *c) { |
| 271 | for(; c && (c->isfloat || !isvisible(c)); c = c->next); | 271 | for(; c && (c->swimming || !isvisible(c)); c = c->next); |
| 272 | return c; | 272 | return c; |
| 273 | } | 273 | } |
| 274 | 274 | ||
| @@ -440,7 +440,7 @@ zoom(Arg *arg) { | |||
| 440 | 440 | ||
| 441 | if(!sel) | 441 | if(!sel) |
| 442 | return; | 442 | return; |
| 443 | if(sel->isfloat || (lt->arrange == dofloat)) { | 443 | if(sel->swimming || (lt->arrange == swim)) { |
| 444 | togglemax(sel); | 444 | togglemax(sel); |
| 445 | return; | 445 | return; |
| 446 | } | 446 | } |
diff --git a/config.arg.h b/config.arg.h index 67069a6..7b54ca2 100644 --- a/config.arg.h +++ b/config.arg.h | |||
| @@ -8,8 +8,8 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; | |||
| 8 | #define LAYOUTS \ | 8 | #define LAYOUTS \ |
| 9 | static Layout layout[] = { \ | 9 | static Layout layout[] = { \ |
| 10 | /* symbol function */ \ | 10 | /* symbol function */ \ |
| 11 | { "[]=", dotile }, /* first entry is default */ \ | 11 | { "[]=", tile }, /* first entry is default */ \ |
| 12 | { "><>", dofloat }, \ | 12 | { "><>", swim }, \ |
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| 15 | #define BORDERPX 1 | 15 | #define BORDERPX 1 |
| @@ -64,7 +64,7 @@ static Key key[] = { \ | |||
| 64 | { MODKEY|ControlMask|ShiftMask, XK_9, toggletag, { .i = 8 } }, \ | 64 | { MODKEY|ControlMask|ShiftMask, XK_9, toggletag, { .i = 8 } }, \ |
| 65 | { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \ | 65 | { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \ |
| 66 | { MODKEY, XK_space, togglelayout, { 0 } }, \ | 66 | { MODKEY, XK_space, togglelayout, { 0 } }, \ |
| 67 | { MODKEY|ShiftMask, XK_space, togglefloat, { 0 } }, \ | 67 | { MODKEY|ShiftMask, XK_space, toggleswimming, { 0 } }, \ |
| 68 | { MODKEY, XK_0, view, { .i = -1 } }, \ | 68 | { MODKEY, XK_0, view, { .i = -1 } }, \ |
| 69 | { MODKEY, XK_1, view, { .i = 0 } }, \ | 69 | { MODKEY, XK_1, view, { .i = 0 } }, \ |
| 70 | { MODKEY, XK_2, view, { .i = 1 } }, \ | 70 | { MODKEY, XK_2, view, { .i = 1 } }, \ |
| @@ -89,7 +89,7 @@ static Key key[] = { \ | |||
| 89 | 89 | ||
| 90 | #define RULES \ | 90 | #define RULES \ |
| 91 | static Rule rule[] = { \ | 91 | static Rule rule[] = { \ |
| 92 | /* class:instance:title regex tags regex isfloat */ \ | 92 | /* class:instance:title regex tags regex swimming */ \ |
| 93 | { "Firefox", "3", False }, \ | 93 | { "Firefox", "3", False }, \ |
| 94 | { "Gimp", NULL, True }, \ | 94 | { "Gimp", NULL, True }, \ |
| 95 | { "MPlayer", NULL, True }, \ | 95 | { "MPlayer", NULL, True }, \ |
diff --git a/config.default.h b/config.default.h index c318973..1b6b349 100644 --- a/config.default.h +++ b/config.default.h | |||
| @@ -8,8 +8,8 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; | |||
| 8 | #define LAYOUTS \ | 8 | #define LAYOUTS \ |
| 9 | Layout layout[] = { \ | 9 | Layout layout[] = { \ |
| 10 | /* symbol function */ \ | 10 | /* symbol function */ \ |
| 11 | { "[]=", dotile }, /* first entry is default */ \ | 11 | { "[]=", tile }, /* first entry is default */ \ |
| 12 | { "><>", dofloat }, \ | 12 | { "><>", swim }, \ |
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| 15 | #define BORDERPX 1 | 15 | #define BORDERPX 1 |
| @@ -59,7 +59,7 @@ static Key key[] = { \ | |||
| 59 | { MODKEY|ControlMask|ShiftMask, XK_9, toggletag, { .i = 8 } }, \ | 59 | { MODKEY|ControlMask|ShiftMask, XK_9, toggletag, { .i = 8 } }, \ |
| 60 | { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \ | 60 | { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \ |
| 61 | { MODKEY, XK_space, togglelayout, { 0 } }, \ | 61 | { MODKEY, XK_space, togglelayout, { 0 } }, \ |
| 62 | { MODKEY|ShiftMask, XK_space, togglefloat, { 0 } }, \ | 62 | { MODKEY|ShiftMask, XK_space, toggleswimming, { 0 } }, \ |
| 63 | { MODKEY, XK_0, view, { .i = -1 } }, \ | 63 | { MODKEY, XK_0, view, { .i = -1 } }, \ |
| 64 | { MODKEY, XK_1, view, { .i = 0 } }, \ | 64 | { MODKEY, XK_1, view, { .i = 0 } }, \ |
| 65 | { MODKEY, XK_2, view, { .i = 1 } }, \ | 65 | { MODKEY, XK_2, view, { .i = 1 } }, \ |
| @@ -86,7 +86,7 @@ static Key key[] = { \ | |||
| 86 | * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */ | 86 | * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */ |
| 87 | #define RULES \ | 87 | #define RULES \ |
| 88 | static Rule rule[] = { \ | 88 | static Rule rule[] = { \ |
| 89 | /* class:instance:title regex tags regex isfloat */ \ | 89 | /* class:instance:title regex tags regex swimming */ \ |
| 90 | { "Gimp", NULL, True }, \ | 90 | { "Gimp", NULL, True }, \ |
| 91 | { "MPlayer", NULL, True }, \ | 91 | { "MPlayer", NULL, True }, \ |
| 92 | { "Acroread", NULL, True }, \ | 92 | { "Acroread", NULL, True }, \ |
| @@ -6,13 +6,13 @@ dwm \- dynamic window manager | |||
| 6 | .RB [ \-v ] | 6 | .RB [ \-v ] |
| 7 | .SH DESCRIPTION | 7 | .SH DESCRIPTION |
| 8 | dwm is a dynamic window manager for X. It manages windows in tiling and | 8 | dwm is a dynamic window manager for X. It manages windows in tiling and |
| 9 | floating layouts. Either layout can be applied dynamically, optimizing the | 9 | swimming layouts. Either layout can be applied dynamically, optimizing the |
| 10 | environment for the application in use and the task performed. | 10 | environment for the application in use and the task performed. |
| 11 | .P | 11 | .P |
| 12 | In tiling layout windows are managed in a master and stacking area. The master | 12 | In tiling layout windows are managed in a master and stacking area. The master |
| 13 | area contains the windows which currently need most attention, whereas the | 13 | area contains the windows which currently need most attention, whereas the |
| 14 | stacking area contains all other windows. In floating layout windows can be | 14 | stacking area contains all other windows. In swimming layout windows can be |
| 15 | resized and moved freely. Dialog windows are always managed floating, | 15 | resized and moved freely. Dialog windows are always managed swimming, |
| 16 | regardless of the layout applied. | 16 | regardless of the layout applied. |
| 17 | .P | 17 | .P |
| 18 | Windows are grouped by tags. Each window can be tagged with one or multiple | 18 | Windows are grouped by tags. Each window can be tagged with one or multiple |
| @@ -38,7 +38,7 @@ is read and displayed in the status text area. | |||
| 38 | .TP | 38 | .TP |
| 39 | .B Button1 | 39 | .B Button1 |
| 40 | click on a tag label to display all windows with that tag, click on the layout | 40 | click on a tag label to display all windows with that tag, click on the layout |
| 41 | label toggles between tiling and floating layout. | 41 | label toggles between tiling and swimming layout. |
| 42 | .TP | 42 | .TP |
| 43 | .B Button3 | 43 | .B Button3 |
| 44 | click on a tag label adds/removes all windows with that tag to/from the view. | 44 | click on a tag label adds/removes all windows with that tag to/from the view. |
| @@ -67,7 +67,7 @@ Focus next window. | |||
| 67 | Focus previous window. | 67 | Focus previous window. |
| 68 | .TP | 68 | .TP |
| 69 | .B Mod1-Return | 69 | .B Mod1-Return |
| 70 | Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (floating layout). | 70 | Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (swimming layout). |
| 71 | .TP | 71 | .TP |
| 72 | .B Mod1-g | 72 | .B Mod1-g |
| 73 | Grow master area (tiling layout only). | 73 | Grow master area (tiling layout only). |
| @@ -98,10 +98,10 @@ tag to/from current window. | |||
| 98 | Close focused window. | 98 | Close focused window. |
| 99 | .TP | 99 | .TP |
| 100 | .B Mod1-space | 100 | .B Mod1-space |
| 101 | Toggle between tiling and floating layout (affects all windows). | 101 | Toggle between tiling and swimming layout (affects all windows). |
| 102 | .TP | 102 | .TP |
| 103 | .B Mod1-Shift-space | 103 | .B Mod1-Shift-space |
| 104 | Toggle focused window between floating and non-floating state (tiling layout only). | 104 | Toggle focused window between swimming and non-swimming state (tiling layout only). |
| 105 | .TP | 105 | .TP |
| 106 | .B Mod1-[1..n] | 106 | .B Mod1-[1..n] |
| 107 | View all windows with | 107 | View all windows with |
| @@ -121,13 +121,13 @@ Quit dwm. | |||
| 121 | .SS Mouse commands | 121 | .SS Mouse commands |
| 122 | .TP | 122 | .TP |
| 123 | .B Mod1-Button1 | 123 | .B Mod1-Button1 |
| 124 | Move current window while dragging (floating layout only). | 124 | Move current window while dragging (swimming layout only). |
| 125 | .TP | 125 | .TP |
| 126 | .B Mod1-Button2 | 126 | .B Mod1-Button2 |
| 127 | Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (floating layout). | 127 | Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (swimming layout). |
| 128 | .TP | 128 | .TP |
| 129 | .B Mod1-Button3 | 129 | .B Mod1-Button3 |
| 130 | Resize current window while dragging (floating layout only). | 130 | Resize current window while dragging (swimming layout only). |
| 131 | .SH CUSTOMIZATION | 131 | .SH CUSTOMIZATION |
| 132 | dwm is customized by creating a custom config.h and (re)compiling the source | 132 | dwm is customized by creating a custom config.h and (re)compiling the source |
| 133 | code. This keeps it fast, secure and simple. | 133 | code. This keeps it fast, secure and simple. |
| @@ -72,7 +72,7 @@ struct Client { | |||
| 72 | int minax, minay, maxax, maxay; | 72 | int minax, minay, maxax, maxay; |
| 73 | long flags; | 73 | long flags; |
| 74 | unsigned int border; | 74 | unsigned int border; |
| 75 | Bool isbanned, isfixed, isfloat, ismax; | 75 | Bool isbanned, isfixed, ismax, swimming; |
| 76 | Bool *tags; | 76 | Bool *tags; |
| 77 | Client *next; | 77 | Client *next; |
| 78 | Client *prev; | 78 | Client *prev; |
| @@ -129,16 +129,15 @@ extern int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */ | |||
| 129 | 129 | ||
| 130 | /* screen.c */ | 130 | /* screen.c */ |
| 131 | extern void compileregs(void); /* initialize regexps of rules defined in config.h */ | 131 | extern void compileregs(void); /* initialize regexps of rules defined in config.h */ |
| 132 | extern void dofloat(void); /* arranges all windows floating */ | ||
| 133 | extern void dotile(void); /* arranges all windows tiled */ | ||
| 134 | extern void incnmaster(Arg *arg); /* increments nmaster with arg's index value */ | 132 | extern void incnmaster(Arg *arg); /* increments nmaster with arg's index value */ |
| 135 | extern void initlayouts(void); /* initialize layout array */ | 133 | extern void initlayouts(void); /* initialize layout array */ |
| 136 | extern Bool isvisible(Client *c); /* returns True if client is visible */ | 134 | extern Bool isvisible(Client *c); /* returns True if client is visible */ |
| 137 | extern void resizemaster(Arg *arg); /* resizes the master percent with arg's index value */ | 135 | extern void resizemaster(Arg *arg); /* resizes the master percent with arg's index value */ |
| 138 | extern void restack(void); /* restores z layers of all clients */ | 136 | extern void restack(void); /* restores z layers of all clients */ |
| 139 | extern void settags(Client *c, Client *trans); /* sets tags of c */ | 137 | extern void settags(Client *c, Client *trans); /* sets tags of c */ |
| 138 | extern void swim(void); /* arranges all windows swimming */ | ||
| 140 | extern void tag(Arg *arg); /* tags c with arg's index */ | 139 | extern void tag(Arg *arg); /* tags c with arg's index */ |
| 141 | extern void togglefloat(Arg *arg); /* toggles focusesd client between floating/non-floating state */ | 140 | extern void toggleswimming(Arg *arg); /* toggles focusesd client between swimming/and non-swimming state */ |
| 142 | extern void togglelayout(Arg *arg); /* toggles layout */ | 141 | extern void togglelayout(Arg *arg); /* toggles layout */ |
| 143 | extern void toggletag(Arg *arg); /* toggles c tags with arg's index */ | 142 | extern void toggletag(Arg *arg); /* toggles c tags with arg's index */ |
| 144 | extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */ | 143 | extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */ |
| @@ -156,14 +156,14 @@ buttonpress(XEvent *e) { | |||
| 156 | focus(c); | 156 | focus(c); |
| 157 | if(CLEANMASK(ev->state) != MODKEY) | 157 | if(CLEANMASK(ev->state) != MODKEY) |
| 158 | return; | 158 | return; |
| 159 | if(ev->button == Button1 && (lt->arrange == dofloat || c->isfloat)) { | 159 | if(ev->button == Button1 && (lt->arrange == swim || c->swimming)) { |
| 160 | restack(); | 160 | restack(); |
| 161 | movemouse(c); | 161 | movemouse(c); |
| 162 | } | 162 | } |
| 163 | else if(ev->button == Button2) | 163 | else if(ev->button == Button2) |
| 164 | zoom(NULL); | 164 | zoom(NULL); |
| 165 | else if(ev->button == Button3 | 165 | else if(ev->button == Button3 |
| 166 | && (lt->arrange == dofloat || c->isfloat) && !c->isfixed) | 166 | && (lt->arrange == swim || c->swimming) && !c->isfixed) |
| 167 | { | 167 | { |
| 168 | restack(); | 168 | restack(); |
| 169 | resizemouse(c); | 169 | resizemouse(c); |
| @@ -181,7 +181,7 @@ configurerequest(XEvent *e) { | |||
| 181 | c->ismax = False; | 181 | c->ismax = False; |
| 182 | if(ev->value_mask & CWBorderWidth) | 182 | if(ev->value_mask & CWBorderWidth) |
| 183 | c->border = ev->border_width; | 183 | c->border = ev->border_width; |
| 184 | if(c->isfixed || c->isfloat || (lt->arrange == dofloat)) { | 184 | if(c->isfixed || c->swimming || (lt->arrange == swim)) { |
| 185 | if(ev->value_mask & CWX) | 185 | if(ev->value_mask & CWX) |
| 186 | c->x = ev->x; | 186 | c->x = ev->x; |
| 187 | if(ev->value_mask & CWY) | 187 | if(ev->value_mask & CWY) |
| @@ -309,7 +309,7 @@ propertynotify(XEvent *e) { | |||
| 309 | default: break; | 309 | default: break; |
| 310 | case XA_WM_TRANSIENT_FOR: | 310 | case XA_WM_TRANSIENT_FOR: |
| 311 | XGetTransientForHint(dpy, c->win, &trans); | 311 | XGetTransientForHint(dpy, c->win, &trans); |
| 312 | if(!c->isfloat && (c->isfloat = (trans != 0))) | 312 | if(!c->swimming && (c->swimming = (getclient(trans) != NULL))) |
| 313 | lt->arrange(); | 313 | lt->arrange(); |
| 314 | break; | 314 | break; |
| 315 | case XA_WM_NORMAL_HINTS: | 315 | case XA_WM_NORMAL_HINTS: |
| @@ -19,7 +19,7 @@ Layout *lt = NULL; | |||
| 19 | typedef struct { | 19 | typedef struct { |
| 20 | const char *prop; | 20 | const char *prop; |
| 21 | const char *tags; | 21 | const char *tags; |
| 22 | Bool isfloat; | 22 | Bool swimming; |
| 23 | } Rule; | 23 | } Rule; |
| 24 | 24 | ||
| 25 | typedef struct { | 25 | typedef struct { |
| @@ -27,7 +27,6 @@ typedef struct { | |||
| 27 | regex_t *tagregex; | 27 | regex_t *tagregex; |
| 28 | } Regs; | 28 | } Regs; |
| 29 | 29 | ||
| 30 | LAYOUTS | ||
| 31 | TAGS | 30 | TAGS |
| 32 | RULES | 31 | RULES |
| 33 | 32 | ||
| @@ -35,60 +34,8 @@ static Regs *regs = NULL; | |||
| 35 | static unsigned int nrules = 0; | 34 | static unsigned int nrules = 0; |
| 36 | static unsigned int nlayouts = 0; | 35 | static unsigned int nlayouts = 0; |
| 37 | 36 | ||
| 38 | /* extern */ | 37 | static void |
| 39 | 38 | tile(void) { | |
| 40 | void | ||
| 41 | compileregs(void) { | ||
| 42 | unsigned int i; | ||
| 43 | regex_t *reg; | ||
| 44 | |||
| 45 | if(regs) | ||
| 46 | return; | ||
| 47 | nrules = sizeof rule / sizeof rule[0]; | ||
| 48 | regs = emallocz(nrules * sizeof(Regs)); | ||
| 49 | for(i = 0; i < nrules; i++) { | ||
| 50 | if(rule[i].prop) { | ||
| 51 | reg = emallocz(sizeof(regex_t)); | ||
| 52 | if(regcomp(reg, rule[i].prop, REG_EXTENDED)) | ||
| 53 | free(reg); | ||
| 54 | else | ||
| 55 | regs[i].propregex = reg; | ||
| 56 | } | ||
| 57 | if(rule[i].tags) { | ||
| 58 | reg = emallocz(sizeof(regex_t)); | ||
| 59 | if(regcomp(reg, rule[i].tags, REG_EXTENDED)) | ||
| 60 | free(reg); | ||
| 61 | else | ||
| 62 | regs[i].tagregex = reg; | ||
| 63 | } | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | void | ||
| 68 | dofloat(void) { | ||
| 69 | Client *c; | ||
| 70 | |||
| 71 | for(c = clients; c; c = c->next) { | ||
| 72 | if(isvisible(c)) { | ||
| 73 | if(c->isbanned) | ||
| 74 | XMoveWindow(dpy, c->win, c->x, c->y); | ||
| 75 | c->isbanned = False; | ||
| 76 | resize(c, c->x, c->y, c->w, c->h, True); | ||
| 77 | } | ||
| 78 | else { | ||
| 79 | c->isbanned = True; | ||
| 80 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | ||
| 81 | } | ||
| 82 | } | ||
| 83 | if(!sel || !isvisible(sel)) { | ||
| 84 | for(c = stack; c && !isvisible(c); c = c->snext); | ||
| 85 | focus(c); | ||
| 86 | } | ||
| 87 | restack(); | ||
| 88 | } | ||
| 89 | |||
| 90 | void | ||
| 91 | dotile(void) { | ||
| 92 | unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th; | 39 | unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th; |
| 93 | Client *c; | 40 | Client *c; |
| 94 | 41 | ||
| @@ -105,7 +52,7 @@ dotile(void) { | |||
| 105 | if(c->isbanned) | 52 | if(c->isbanned) |
| 106 | XMoveWindow(dpy, c->win, c->x, c->y); | 53 | XMoveWindow(dpy, c->win, c->x, c->y); |
| 107 | c->isbanned = False; | 54 | c->isbanned = False; |
| 108 | if(c->isfloat) | 55 | if(c->swimming) |
| 109 | continue; | 56 | continue; |
| 110 | c->ismax = False; | 57 | c->ismax = False; |
| 111 | nx = wax; | 58 | nx = wax; |
| @@ -139,9 +86,40 @@ dotile(void) { | |||
| 139 | restack(); | 86 | restack(); |
| 140 | } | 87 | } |
| 141 | 88 | ||
| 89 | LAYOUTS | ||
| 90 | |||
| 91 | /* extern */ | ||
| 92 | |||
| 93 | void | ||
| 94 | compileregs(void) { | ||
| 95 | unsigned int i; | ||
| 96 | regex_t *reg; | ||
| 97 | |||
| 98 | if(regs) | ||
| 99 | return; | ||
| 100 | nrules = sizeof rule / sizeof rule[0]; | ||
| 101 | regs = emallocz(nrules * sizeof(Regs)); | ||
| 102 | for(i = 0; i < nrules; i++) { | ||
| 103 | if(rule[i].prop) { | ||
| 104 | reg = emallocz(sizeof(regex_t)); | ||
| 105 | if(regcomp(reg, rule[i].prop, REG_EXTENDED)) | ||
| 106 | free(reg); | ||
| 107 | else | ||
| 108 | regs[i].propregex = reg; | ||
| 109 | } | ||
| 110 | if(rule[i].tags) { | ||
| 111 | reg = emallocz(sizeof(regex_t)); | ||
| 112 | if(regcomp(reg, rule[i].tags, REG_EXTENDED)) | ||
| 113 | free(reg); | ||
| 114 | else | ||
| 115 | regs[i].tagregex = reg; | ||
| 116 | } | ||
| 117 | } | ||
| 118 | } | ||
| 119 | |||
| 142 | void | 120 | void |
| 143 | incnmaster(Arg *arg) { | 121 | incnmaster(Arg *arg) { |
| 144 | if((lt->arrange == dofloat) || (nmaster + arg->i < 1) | 122 | if((lt->arrange != tile) || (nmaster + arg->i < 1) |
| 145 | || (wah / (nmaster + arg->i) <= 2 * BORDERPX)) | 123 | || (wah / (nmaster + arg->i) <= 2 * BORDERPX)) |
| 146 | return; | 124 | return; |
| 147 | nmaster += arg->i; | 125 | nmaster += arg->i; |
| @@ -176,7 +154,7 @@ isvisible(Client *c) { | |||
| 176 | 154 | ||
| 177 | void | 155 | void |
| 178 | resizemaster(Arg *arg) { | 156 | resizemaster(Arg *arg) { |
| 179 | if(lt->arrange != dotile) | 157 | if(lt->arrange != tile) |
| 180 | return; | 158 | return; |
| 181 | if(arg->i == 0) | 159 | if(arg->i == 0) |
| 182 | master = MASTER; | 160 | master = MASTER; |
| @@ -197,10 +175,10 @@ restack(void) { | |||
| 197 | drawstatus(); | 175 | drawstatus(); |
| 198 | if(!sel) | 176 | if(!sel) |
| 199 | return; | 177 | return; |
| 200 | if(sel->isfloat || lt->arrange == dofloat) | 178 | if(sel->swimming || lt->arrange == swim) |
| 201 | XRaiseWindow(dpy, sel->win); | 179 | XRaiseWindow(dpy, sel->win); |
| 202 | if(lt->arrange != dofloat) { | 180 | if(lt->arrange != swim) { |
| 203 | if(!sel->isfloat) | 181 | if(!sel->swimming) |
| 204 | XLowerWindow(dpy, sel->win); | 182 | XLowerWindow(dpy, sel->win); |
| 205 | for(c = nexttiled(clients); c; c = nexttiled(c->next)) { | 183 | for(c = nexttiled(clients); c; c = nexttiled(c->next)) { |
| 206 | if(c == sel) | 184 | if(c == sel) |
| @@ -230,7 +208,7 @@ settags(Client *c, Client *trans) { | |||
| 230 | ch.res_name ? ch.res_name : "", c->name); | 208 | ch.res_name ? ch.res_name : "", c->name); |
| 231 | for(i = 0; i < nrules; i++) | 209 | for(i = 0; i < nrules; i++) |
| 232 | if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) { | 210 | if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) { |
| 233 | c->isfloat = rule[i].isfloat; | 211 | c->swimming = rule[i].swimming; |
| 234 | for(j = 0; regs[i].tagregex && j < ntags; j++) { | 212 | for(j = 0; regs[i].tagregex && j < ntags; j++) { |
| 235 | if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) { | 213 | if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) { |
| 236 | matched = True; | 214 | matched = True; |
| @@ -249,6 +227,29 @@ settags(Client *c, Client *trans) { | |||
| 249 | } | 227 | } |
| 250 | 228 | ||
| 251 | void | 229 | void |
| 230 | swim(void) { | ||
| 231 | Client *c; | ||
| 232 | |||
| 233 | for(c = clients; c; c = c->next) { | ||
| 234 | if(isvisible(c)) { | ||
| 235 | if(c->isbanned) | ||
| 236 | XMoveWindow(dpy, c->win, c->x, c->y); | ||
| 237 | c->isbanned = False; | ||
| 238 | resize(c, c->x, c->y, c->w, c->h, True); | ||
| 239 | } | ||
| 240 | else { | ||
| 241 | c->isbanned = True; | ||
| 242 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | ||
| 243 | } | ||
| 244 | } | ||
| 245 | if(!sel || !isvisible(sel)) { | ||
| 246 | for(c = stack; c && !isvisible(c); c = c->snext); | ||
| 247 | focus(c); | ||
| 248 | } | ||
| 249 | restack(); | ||
| 250 | } | ||
| 251 | |||
| 252 | void | ||
| 252 | tag(Arg *arg) { | 253 | tag(Arg *arg) { |
| 253 | unsigned int i; | 254 | unsigned int i; |
| 254 | 255 | ||
| @@ -262,10 +263,10 @@ tag(Arg *arg) { | |||
| 262 | } | 263 | } |
| 263 | 264 | ||
| 264 | void | 265 | void |
| 265 | togglefloat(Arg *arg) { | 266 | toggleswimming(Arg *arg) { |
| 266 | if(!sel || lt->arrange == dofloat) | 267 | if(!sel || lt->arrange == swim) |
| 267 | return; | 268 | return; |
| 268 | sel->isfloat = !sel->isfloat; | 269 | sel->swimming = !sel->swimming; |
| 269 | lt->arrange(); | 270 | lt->arrange(); |
| 270 | } | 271 | } |
| 271 | 272 | ||
