renamed floating into swimming (this does not clash with C naming conventions and fits better the fish symbol) - also in man page
cee56d38
7 file(s) · +96 −96
| 253 | 253 | updatetitle(c); |
|
| 254 | 254 | for(t = clients; t && t->win != trans; t = t->next); |
|
| 255 | 255 | settags(c, t); |
|
| 256 | - | if(!c->isfloat) |
|
| 257 | - | c->isfloat = (t != NULL) || c->isfixed; |
|
| 256 | + | if(!c->swimming) |
|
| 257 | + | c->swimming = (t != NULL) || c->isfixed; |
|
| 258 | 258 | attach(c); |
|
| 259 | 259 | attachstack(c); |
|
| 260 | 260 | c->isbanned = True; |
|
| 268 | 268 | ||
| 269 | 269 | Client * |
|
| 270 | 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 | 272 | return c; |
|
| 273 | 273 | } |
|
| 274 | 274 | ||
| 440 | 440 | ||
| 441 | 441 | if(!sel) |
|
| 442 | 442 | return; |
|
| 443 | - | if(sel->isfloat || (lt->arrange == dofloat)) { |
|
| 443 | + | if(sel->swimming || (lt->arrange == swim)) { |
|
| 444 | 444 | togglemax(sel); |
|
| 445 | 445 | return; |
|
| 446 | 446 | } |
|
| 8 | 8 | #define LAYOUTS \ |
|
| 9 | 9 | static Layout layout[] = { \ |
|
| 10 | 10 | /* symbol function */ \ |
|
| 11 | - | { "[]=", dotile }, /* first entry is default */ \ |
|
| 12 | - | { "><>", dofloat }, \ |
|
| 11 | + | { "[]=", tile }, /* first entry is default */ \ |
|
| 12 | + | { "><>", swim }, \ |
|
| 13 | 13 | }; |
|
| 14 | 14 | ||
| 15 | 15 | #define BORDERPX 1 |
|
| 64 | 64 | { MODKEY|ControlMask|ShiftMask, XK_9, toggletag, { .i = 8 } }, \ |
|
| 65 | 65 | { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \ |
|
| 66 | 66 | { MODKEY, XK_space, togglelayout, { 0 } }, \ |
|
| 67 | - | { MODKEY|ShiftMask, XK_space, togglefloat, { 0 } }, \ |
|
| 67 | + | { MODKEY|ShiftMask, XK_space, toggleswimming, { 0 } }, \ |
|
| 68 | 68 | { MODKEY, XK_0, view, { .i = -1 } }, \ |
|
| 69 | 69 | { MODKEY, XK_1, view, { .i = 0 } }, \ |
|
| 70 | 70 | { MODKEY, XK_2, view, { .i = 1 } }, \ |
|
| 89 | 89 | ||
| 90 | 90 | #define RULES \ |
|
| 91 | 91 | static Rule rule[] = { \ |
|
| 92 | - | /* class:instance:title regex tags regex isfloat */ \ |
|
| 92 | + | /* class:instance:title regex tags regex swimming */ \ |
|
| 93 | 93 | { "Firefox", "3", False }, \ |
|
| 94 | 94 | { "Gimp", NULL, True }, \ |
|
| 95 | 95 | { "MPlayer", NULL, True }, \ |
|
| 8 | 8 | #define LAYOUTS \ |
|
| 9 | 9 | Layout layout[] = { \ |
|
| 10 | 10 | /* symbol function */ \ |
|
| 11 | - | { "[]=", dotile }, /* first entry is default */ \ |
|
| 12 | - | { "><>", dofloat }, \ |
|
| 11 | + | { "[]=", tile }, /* first entry is default */ \ |
|
| 12 | + | { "><>", swim }, \ |
|
| 13 | 13 | }; |
|
| 14 | 14 | ||
| 15 | 15 | #define BORDERPX 1 |
|
| 59 | 59 | { MODKEY|ControlMask|ShiftMask, XK_9, toggletag, { .i = 8 } }, \ |
|
| 60 | 60 | { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \ |
|
| 61 | 61 | { MODKEY, XK_space, togglelayout, { 0 } }, \ |
|
| 62 | - | { MODKEY|ShiftMask, XK_space, togglefloat, { 0 } }, \ |
|
| 62 | + | { MODKEY|ShiftMask, XK_space, toggleswimming, { 0 } }, \ |
|
| 63 | 63 | { MODKEY, XK_0, view, { .i = -1 } }, \ |
|
| 64 | 64 | { MODKEY, XK_1, view, { .i = 0 } }, \ |
|
| 65 | 65 | { MODKEY, XK_2, view, { .i = 1 } }, \ |
|
| 86 | 86 | * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */ |
|
| 87 | 87 | #define RULES \ |
|
| 88 | 88 | static Rule rule[] = { \ |
|
| 89 | - | /* class:instance:title regex tags regex isfloat */ \ |
|
| 89 | + | /* class:instance:title regex tags regex swimming */ \ |
|
| 90 | 90 | { "Gimp", NULL, True }, \ |
|
| 91 | 91 | { "MPlayer", NULL, True }, \ |
|
| 92 | 92 | { "Acroread", NULL, True }, \ |
|
| 6 | 6 | .RB [ \-v ] |
|
| 7 | 7 | .SH DESCRIPTION |
|
| 8 | 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 | 10 | environment for the application in use and the task performed. |
|
| 11 | 11 | .P |
|
| 12 | 12 | In tiling layout windows are managed in a master and stacking area. The master |
|
| 13 | 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 |
|
| 15 | - | resized and moved freely. Dialog windows are always managed floating, |
|
| 14 | + | stacking area contains all other windows. In swimming layout windows can be |
|
| 15 | + | resized and moved freely. Dialog windows are always managed swimming, |
|
| 16 | 16 | regardless of the layout applied. |
|
| 17 | 17 | .P |
|
| 18 | 18 | Windows are grouped by tags. Each window can be tagged with one or multiple |
|
| 38 | 38 | .TP |
|
| 39 | 39 | .B Button1 |
|
| 40 | 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 | 42 | .TP |
|
| 43 | 43 | .B Button3 |
|
| 44 | 44 | click on a tag label adds/removes all windows with that tag to/from the view. |
|
| 67 | 67 | Focus previous window. |
|
| 68 | 68 | .TP |
|
| 69 | 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 | 71 | .TP |
|
| 72 | 72 | .B Mod1-g |
|
| 73 | 73 | Grow master area (tiling layout only). |
|
| 98 | 98 | Close focused window. |
|
| 99 | 99 | .TP |
|
| 100 | 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 | 102 | .TP |
|
| 103 | 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 | 105 | .TP |
|
| 106 | 106 | .B Mod1-[1..n] |
|
| 107 | 107 | View all windows with |
|
| 121 | 121 | .SS Mouse commands |
|
| 122 | 122 | .TP |
|
| 123 | 123 | .B Mod1-Button1 |
|
| 124 | - | Move current window while dragging (floating layout only). |
|
| 124 | + | Move current window while dragging (swimming layout only). |
|
| 125 | 125 | .TP |
|
| 126 | 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 | 128 | .TP |
|
| 129 | 129 | .B Mod1-Button3 |
|
| 130 | - | Resize current window while dragging (floating layout only). |
|
| 130 | + | Resize current window while dragging (swimming layout only). |
|
| 131 | 131 | .SH CUSTOMIZATION |
|
| 132 | 132 | dwm is customized by creating a custom config.h and (re)compiling the source |
|
| 133 | 133 | code. This keeps it fast, secure and simple. |
|
| 72 | 72 | int minax, minay, maxax, maxay; |
|
| 73 | 73 | long flags; |
|
| 74 | 74 | unsigned int border; |
|
| 75 | - | Bool isbanned, isfixed, isfloat, ismax; |
|
| 75 | + | Bool isbanned, isfixed, ismax, swimming; |
|
| 76 | 76 | Bool *tags; |
|
| 77 | 77 | Client *next; |
|
| 78 | 78 | Client *prev; |
|
| 129 | 129 | ||
| 130 | 130 | /* screen.c */ |
|
| 131 | 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 | 132 | extern void incnmaster(Arg *arg); /* increments nmaster with arg's index value */ |
|
| 135 | 133 | extern void initlayouts(void); /* initialize layout array */ |
|
| 136 | 134 | extern Bool isvisible(Client *c); /* returns True if client is visible */ |
|
| 137 | 135 | extern void resizemaster(Arg *arg); /* resizes the master percent with arg's index value */ |
|
| 138 | 136 | extern void restack(void); /* restores z layers of all clients */ |
|
| 139 | 137 | extern void settags(Client *c, Client *trans); /* sets tags of c */ |
|
| 138 | + | extern void swim(void); /* arranges all windows swimming */ |
|
| 140 | 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 | 141 | extern void togglelayout(Arg *arg); /* toggles layout */ |
|
| 143 | 142 | extern void toggletag(Arg *arg); /* toggles c tags with arg's index */ |
|
| 144 | 143 | extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */ |
|
| 156 | 156 | focus(c); |
|
| 157 | 157 | if(CLEANMASK(ev->state) != MODKEY) |
|
| 158 | 158 | return; |
|
| 159 | - | if(ev->button == Button1 && (lt->arrange == dofloat || c->isfloat)) { |
|
| 159 | + | if(ev->button == Button1 && (lt->arrange == swim || c->swimming)) { |
|
| 160 | 160 | restack(); |
|
| 161 | 161 | movemouse(c); |
|
| 162 | 162 | } |
|
| 163 | 163 | else if(ev->button == Button2) |
|
| 164 | 164 | zoom(NULL); |
|
| 165 | 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 | 168 | restack(); |
|
| 169 | 169 | resizemouse(c); |
|
| 181 | 181 | c->ismax = False; |
|
| 182 | 182 | if(ev->value_mask & CWBorderWidth) |
|
| 183 | 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 | 185 | if(ev->value_mask & CWX) |
|
| 186 | 186 | c->x = ev->x; |
|
| 187 | 187 | if(ev->value_mask & CWY) |
|
| 309 | 309 | default: break; |
|
| 310 | 310 | case XA_WM_TRANSIENT_FOR: |
|
| 311 | 311 | XGetTransientForHint(dpy, c->win, &trans); |
|
| 312 | - | if(!c->isfloat && (c->isfloat = (trans != 0))) |
|
| 312 | + | if(!c->swimming && (c->swimming = (getclient(trans) != NULL))) |
|
| 313 | 313 | lt->arrange(); |
|
| 314 | 314 | break; |
|
| 315 | 315 | case XA_WM_NORMAL_HINTS: |
|
| 19 | 19 | typedef struct { |
|
| 20 | 20 | const char *prop; |
|
| 21 | 21 | const char *tags; |
|
| 22 | - | Bool isfloat; |
|
| 22 | + | Bool swimming; |
|
| 23 | 23 | } Rule; |
|
| 24 | 24 | ||
| 25 | 25 | typedef struct { |
|
| 27 | 27 | regex_t *tagregex; |
|
| 28 | 28 | } Regs; |
|
| 29 | 29 | ||
| 30 | - | LAYOUTS |
|
| 31 | 30 | TAGS |
|
| 32 | 31 | RULES |
|
| 33 | 32 | ||
| 35 | 34 | static unsigned int nrules = 0; |
|
| 36 | 35 | static unsigned int nlayouts = 0; |
|
| 37 | 36 | ||
| 38 | - | /* extern */ |
|
| 39 | - | ||
| 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) { |
|
| 37 | + | static void |
|
| 38 | + | tile(void) { |
|
| 92 | 39 | unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th; |
|
| 93 | 40 | Client *c; |
|
| 94 | 41 | ||
| 105 | 52 | if(c->isbanned) |
|
| 106 | 53 | XMoveWindow(dpy, c->win, c->x, c->y); |
|
| 107 | 54 | c->isbanned = False; |
|
| 108 | - | if(c->isfloat) |
|
| 55 | + | if(c->swimming) |
|
| 109 | 56 | continue; |
|
| 110 | 57 | c->ismax = False; |
|
| 111 | 58 | nx = wax; |
|
| 139 | 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 | 120 | void |
|
| 143 | 121 | incnmaster(Arg *arg) { |
|
| 144 | - | if((lt->arrange == dofloat) || (nmaster + arg->i < 1) |
|
| 122 | + | if((lt->arrange != tile) || (nmaster + arg->i < 1) |
|
| 145 | 123 | || (wah / (nmaster + arg->i) <= 2 * BORDERPX)) |
|
| 146 | 124 | return; |
|
| 147 | 125 | nmaster += arg->i; |
|
| 176 | 154 | ||
| 177 | 155 | void |
|
| 178 | 156 | resizemaster(Arg *arg) { |
|
| 179 | - | if(lt->arrange != dotile) |
|
| 157 | + | if(lt->arrange != tile) |
|
| 180 | 158 | return; |
|
| 181 | 159 | if(arg->i == 0) |
|
| 182 | 160 | master = MASTER; |
|
| 197 | 175 | drawstatus(); |
|
| 198 | 176 | if(!sel) |
|
| 199 | 177 | return; |
|
| 200 | - | if(sel->isfloat || lt->arrange == dofloat) |
|
| 178 | + | if(sel->swimming || lt->arrange == swim) |
|
| 201 | 179 | XRaiseWindow(dpy, sel->win); |
|
| 202 | - | if(lt->arrange != dofloat) { |
|
| 203 | - | if(!sel->isfloat) |
|
| 180 | + | if(lt->arrange != swim) { |
|
| 181 | + | if(!sel->swimming) |
|
| 204 | 182 | XLowerWindow(dpy, sel->win); |
|
| 205 | 183 | for(c = nexttiled(clients); c; c = nexttiled(c->next)) { |
|
| 206 | 184 | if(c == sel) |
|
| 230 | 208 | ch.res_name ? ch.res_name : "", c->name); |
|
| 231 | 209 | for(i = 0; i < nrules; i++) |
|
| 232 | 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 | 212 | for(j = 0; regs[i].tagregex && j < ntags; j++) { |
|
| 235 | 213 | if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) { |
|
| 236 | 214 | matched = True; |
|
| 249 | 227 | } |
|
| 250 | 228 | ||
| 251 | 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 | 253 | tag(Arg *arg) { |
|
| 253 | 254 | unsigned int i; |
|
| 254 | 255 | ||
| 262 | 263 | } |
|
| 263 | 264 | ||
| 264 | 265 | void |
|
| 265 | - | togglefloat(Arg *arg) { |
|
| 266 | - | if(!sel || lt->arrange == dofloat) |
|
| 266 | + | toggleswimming(Arg *arg) { |
|
| 267 | + | if(!sel || lt->arrange == swim) |
|
| 267 | 268 | return; |
|
| 268 | - | sel->isfloat = !sel->isfloat; |
|
| 269 | + | sel->swimming = !sel->swimming; |
|
| 269 | 270 | lt->arrange(); |
|
| 270 | 271 | } |
|
| 271 | 272 | ||