changed focusmon/tagmon to work on prev/next instead (-1/+1), changed shortcuts to Mod1-, Mod1-. and Mod1-Shift-, Mod1-Shift-.
a9e145fe
3 file(s) · +49 −31
| 71 | 71 | { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, |
|
| 72 | 72 | { MODKEY, XK_0, view, {.ui = ~0 } }, |
|
| 73 | 73 | { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, |
|
| 74 | - | { MODKEY, XK_w, focusmon, {.ui = 0 } }, |
|
| 75 | - | { MODKEY, XK_e, focusmon, {.ui = 1 } }, |
|
| 76 | - | { MODKEY|ShiftMask, XK_w, tagmon, {.ui = 0 } }, |
|
| 77 | - | { MODKEY|ShiftMask, XK_e, tagmon, {.ui = 1 } }, |
|
| 74 | + | { MODKEY, XK_comma, focusmon, {.i = -1 } }, |
|
| 75 | + | { MODKEY, XK_period, focusmon, {.i = +1 } }, |
|
| 76 | + | { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, |
|
| 77 | + | { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, |
|
| 78 | 78 | TAGKEYS( XK_1, 0) |
|
| 79 | 79 | TAGKEYS( XK_2, 1) |
|
| 80 | 80 | TAGKEYS( XK_3, 2) |
| 19 | 19 | Windows are grouped by tags. Each window can be tagged with one or multiple |
|
| 20 | 20 | tags. Selecting certain tags displays all windows with these tags. |
|
| 21 | 21 | .P |
|
| 22 | - | dwm contains a small status bar which displays all available tags, the layout, |
|
| 22 | + | Each screen contains a small status bar which displays all available tags, the layout, |
|
| 23 | 23 | the title of the focused window, and the text read from the root window name |
|
| 24 | - | property. A floating window is indicated with an empty square and a maximised |
|
| 25 | - | floating window is indicated with a filled square before the windows title. |
|
| 26 | - | The selected tags are indicated with a different color. The tags of the focused |
|
| 27 | - | window are indicated with a filled square in the top left corner. The tags |
|
| 28 | - | which are applied to one or more windows are indicated with an empty square in |
|
| 29 | - | the top left corner. |
|
| 24 | + | property, if the screen is focused. A floating window is indicated with an |
|
| 25 | + | empty square and a maximised floating window is indicated with a filled square |
|
| 26 | + | before the windows title. The selected tags are indicated with a different |
|
| 27 | + | color. The tags of the focused window are indicated with a filled square in the |
|
| 28 | + | top left corner. The tags which are applied to one or more windows are |
|
| 29 | + | indicated with an empty square in the top left corner. |
|
| 30 | 30 | .P |
|
| 31 | 31 | dwm draws a small border around windows to indicate the focus state. |
|
| 32 | 32 | .SH OPTIONS |
|
| 56 | 56 | .B Mod1\-Shift\-Return |
|
| 57 | 57 | Start |
|
| 58 | 58 | .BR xterm. |
|
| 59 | + | .TP |
|
| 60 | + | .B Mod1\-, |
|
| 61 | + | Focus previous screen, if any. |
|
| 62 | + | .TP |
|
| 63 | + | .B Mod1\-. |
|
| 64 | + | Focus next screen, if any. |
|
| 65 | + | .TP |
|
| 66 | + | .B Mod1\-Shift\-, |
|
| 67 | + | Send focused window to previous screen, if any. |
|
| 68 | + | .TP |
|
| 69 | + | .B Mod1\-Shift\-, |
|
| 70 | + | Send focused window to next screen, if any. |
|
| 59 | 71 | .TP |
|
| 60 | 72 | .B Mod1\-b |
|
| 61 | 73 | Toggles bar on and off. |
|
| 11 | 11 | * in O(1) time. |
|
| 12 | 12 | * |
|
| 13 | 13 | * Each child of the root window is called a client, except windows which have |
|
| 14 | - | * set the override_redirect flag. Clients are organized in a global |
|
| 15 | - | * linked client list, the focus history is remembered through a global |
|
| 16 | - | * stack list. Each client contains a bit array to indicate the tags of a |
|
| 14 | + | * set the override_redirect flag. Clients are organized in a linked client |
|
| 15 | + | * list on each monitor, the focus history is remembered through a stack list |
|
| 16 | + | * on each monitor. Each client contains a bit array to indicate the tags of a |
|
| 17 | 17 | * client. |
|
| 18 | 18 | * |
|
| 19 | 19 | * Keys and tagging rules are organized as arrays and defined in config.h. |
|
| 164 | 164 | static void detach(Client *c); |
|
| 165 | 165 | static void detachstack(Client *c); |
|
| 166 | 166 | static void die(const char *errstr, ...); |
|
| 167 | + | static Monitor *dirtomon(int dir); |
|
| 167 | 168 | static void drawbar(Monitor *m); |
|
| 168 | 169 | static void drawbars(void); |
|
| 169 | 170 | static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]); |
|
| 180 | 181 | static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size); |
|
| 181 | 182 | static void grabbuttons(Client *c, Bool focused); |
|
| 182 | 183 | static void grabkeys(void); |
|
| 183 | - | static Monitor *idxtomon(unsigned int n); |
|
| 184 | 184 | static void initfont(const char *fontstr); |
|
| 185 | 185 | static Bool isprotodel(Client *c); |
|
| 186 | 186 | static void keypress(XEvent *e); |
|
| 621 | 621 | exit(EXIT_FAILURE); |
|
| 622 | 622 | } |
|
| 623 | 623 | ||
| 624 | + | Monitor * |
|
| 625 | + | dirtomon(int dir) { |
|
| 626 | + | Monitor *m = NULL; |
|
| 627 | + | ||
| 628 | + | if(dir > 0) |
|
| 629 | + | if(!(m = selmon->next)) |
|
| 630 | + | m = mons; |
|
| 631 | + | else { |
|
| 632 | + | if(selmon == mons) |
|
| 633 | + | for(m = mons; m->next; m = m->next); |
|
| 634 | + | else |
|
| 635 | + | for(m = mons; m->next != selmon; m = m->next); |
|
| 636 | + | } |
|
| 637 | + | return m; |
|
| 638 | + | } |
|
| 639 | + | ||
| 624 | 640 | void |
|
| 625 | 641 | drawbar(Monitor *m) { |
|
| 626 | 642 | int x; |
|
| 797 | 813 | ||
| 798 | 814 | void |
|
| 799 | 815 | focusmon(const Arg *arg) { |
|
| 800 | - | Monitor *m; |
|
| 816 | + | Monitor *m = NULL; |
|
| 801 | 817 | ||
| 802 | - | if(!(m = idxtomon(arg->ui)) || m == selmon) |
|
| 818 | + | if(!mons->next) |
|
| 803 | 819 | return; |
|
| 820 | + | m = dirtomon(arg->i); |
|
| 804 | 821 | unfocus(selmon->sel); |
|
| 805 | 822 | selmon = m; |
|
| 806 | 823 | focus(NULL); |
|
| 932 | 949 | True, GrabModeAsync, GrabModeAsync); |
|
| 933 | 950 | } |
|
| 934 | 951 | } |
|
| 935 | - | } |
|
| 936 | - | ||
| 937 | - | Monitor * |
|
| 938 | - | idxtomon(unsigned int n) { |
|
| 939 | - | unsigned int i; |
|
| 940 | - | Monitor *m; |
|
| 941 | - | ||
| 942 | - | for(m = mons, i = 0; m && i != n; m = m->next, i++); |
|
| 943 | - | return m; |
|
| 944 | 952 | } |
|
| 945 | 953 | ||
| 946 | 954 | void |
|
| 1512 | 1520 | ||
| 1513 | 1521 | void |
|
| 1514 | 1522 | tagmon(const Arg *arg) { |
|
| 1515 | - | Monitor *m; |
|
| 1516 | - | ||
| 1517 | - | if(!selmon->sel || !(m = idxtomon(arg->ui))) |
|
| 1518 | - | return; |
|
| 1519 | - | sendmon(selmon->sel, m); |
|
| 1523 | + | if(!selmon->sel || !mons->next) |
|
| 1524 | + | return |
|
| 1525 | + | sendmon(selmon->sel, dirtomon(arg->i)); |
|
| 1520 | 1526 | } |
|
| 1521 | 1527 | ||
| 1522 | 1528 | int |
|