summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R Garbe <anselm@garbe.us>2009-07-02 20:37:26 +0100
committerAnselm R Garbe <anselm@garbe.us>2009-07-02 20:37:26 +0100
commita9e145fe6d8af4848e6706131ac41e99003cd997 (patch)
tree22406d3f4e1032f93817228436fc6ba8a06a8f6b
parentremoved some empty lines (diff)
downloaddwm-a9e145fe6d8af4848e6706131ac41e99003cd997.tar.gz
dwm-a9e145fe6d8af4848e6706131ac41e99003cd997.zip
changed focusmon/tagmon to work on prev/next instead (-1/+1), changed shortcuts to Mod1-, Mod1-. and Mod1-Shift-, Mod1-Shift-.
Diffstat (limited to '')
-rw-r--r--config.def.h8
-rw-r--r--dwm.126
-rw-r--r--dwm.c46
3 files changed, 49 insertions, 31 deletions
diff --git a/config.def.h b/config.def.h
index 34615b2..a729dcd 100644
--- a/config.def.h
+++ b/config.def.h
@@ -71,10 +71,10 @@ static Key keys[] = {
71 { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, 71 { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
72 { MODKEY, XK_0, view, {.ui = ~0 } }, 72 { MODKEY, XK_0, view, {.ui = ~0 } },
73 { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, 73 { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
74 { MODKEY, XK_w, focusmon, {.ui = 0 } }, 74 { MODKEY, XK_comma, focusmon, {.i = -1 } },
75 { MODKEY, XK_e, focusmon, {.ui = 1 } }, 75 { MODKEY, XK_period, focusmon, {.i = +1 } },
76 { MODKEY|ShiftMask, XK_w, tagmon, {.ui = 0 } }, 76 { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
77 { MODKEY|ShiftMask, XK_e, tagmon, {.ui = 1 } }, 77 { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
78 TAGKEYS( XK_1, 0) 78 TAGKEYS( XK_1, 0)
79 TAGKEYS( XK_2, 1) 79 TAGKEYS( XK_2, 1)
80 TAGKEYS( XK_3, 2) 80 TAGKEYS( XK_3, 2)
diff --git a/dwm.1 b/dwm.1
index 178de7c..a8dcc27 100644
--- a/dwm.1
+++ b/dwm.1
@@ -19,14 +19,14 @@ layout applied.
19Windows are grouped by tags. Each window can be tagged with one or multiple 19Windows are grouped by tags. Each window can be tagged with one or multiple
20tags. Selecting certain tags displays all windows with these tags. 20tags. Selecting certain tags displays all windows with these tags.
21.P 21.P
22dwm contains a small status bar which displays all available tags, the layout, 22Each screen contains a small status bar which displays all available tags, the layout,
23the title of the focused window, and the text read from the root window name 23the title of the focused window, and the text read from the root window name
24property. A floating window is indicated with an empty square and a maximised 24property, if the screen is focused. A floating window is indicated with an
25floating window is indicated with a filled square before the windows title. 25empty square and a maximised floating window is indicated with a filled square
26The selected tags are indicated with a different color. The tags of the focused 26before the windows title. The selected tags are indicated with a different
27window are indicated with a filled square in the top left corner. The tags 27color. The tags of the focused window are indicated with a filled square in the
28which are applied to one or more windows are indicated with an empty square in 28top left corner. The tags which are applied to one or more windows are
29the top left corner. 29indicated with an empty square in the top left corner.
30.P 30.P
31dwm draws a small border around windows to indicate the focus state. 31dwm draws a small border around windows to indicate the focus state.
32.SH OPTIONS 32.SH OPTIONS
@@ -57,6 +57,18 @@ click on a tag label adds/removes that tag to/from the focused window.
57Start 57Start
58.BR xterm. 58.BR xterm.
59.TP 59.TP
60.B Mod1\-,
61Focus previous screen, if any.
62.TP
63.B Mod1\-.
64Focus next screen, if any.
65.TP
66.B Mod1\-Shift\-,
67Send focused window to previous screen, if any.
68.TP
69.B Mod1\-Shift\-,
70Send focused window to next screen, if any.
71.TP
60.B Mod1\-b 72.B Mod1\-b
61Toggles bar on and off. 73Toggles bar on and off.
62.TP 74.TP
diff --git a/dwm.c b/dwm.c
index d47da3f..613a029 100644
--- a/dwm.c
+++ b/dwm.c
@@ -11,9 +11,9 @@
11 * in O(1) time. 11 * in O(1) time.
12 * 12 *
13 * Each child of the root window is called a client, except windows which have 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 14 * set the override_redirect flag. Clients are organized in a linked client
15 * linked client list, the focus history is remembered through a global 15 * list on each monitor, the focus history is remembered through a stack list
16 * stack list. Each client contains a bit array to indicate the tags of a 16 * on each monitor. Each client contains a bit array to indicate the tags of a
17 * client. 17 * client.
18 * 18 *
19 * Keys and tagging rules are organized as arrays and defined in config.h. 19 * Keys and tagging rules are organized as arrays and defined in config.h.
@@ -164,6 +164,7 @@ static void destroynotify(XEvent *e);
164static void detach(Client *c); 164static void detach(Client *c);
165static void detachstack(Client *c); 165static void detachstack(Client *c);
166static void die(const char *errstr, ...); 166static void die(const char *errstr, ...);
167static Monitor *dirtomon(int dir);
167static void drawbar(Monitor *m); 168static void drawbar(Monitor *m);
168static void drawbars(void); 169static void drawbars(void);
169static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]); 170static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]);
@@ -180,7 +181,6 @@ static long getstate(Window w);
180static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size); 181static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
181static void grabbuttons(Client *c, Bool focused); 182static void grabbuttons(Client *c, Bool focused);
182static void grabkeys(void); 183static void grabkeys(void);
183static Monitor *idxtomon(unsigned int n);
184static void initfont(const char *fontstr); 184static void initfont(const char *fontstr);
185static Bool isprotodel(Client *c); 185static Bool isprotodel(Client *c);
186static void keypress(XEvent *e); 186static void keypress(XEvent *e);
@@ -621,6 +621,22 @@ die(const char *errstr, ...) {
621 exit(EXIT_FAILURE); 621 exit(EXIT_FAILURE);
622} 622}
623 623
624Monitor *
625dirtomon(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
624void 640void
625drawbar(Monitor *m) { 641drawbar(Monitor *m) {
626 int x; 642 int x;
@@ -797,10 +813,11 @@ focusin(XEvent *e) { /* there are some broken focus acquiring clients */
797 813
798void 814void
799focusmon(const Arg *arg) { 815focusmon(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 return; 819 return;
820 m = dirtomon(arg->i);
804 unfocus(selmon->sel); 821 unfocus(selmon->sel);
805 selmon = m; 822 selmon = m;
806 focus(NULL); 823 focus(NULL);
@@ -934,15 +951,6 @@ grabkeys(void) {
934 } 951 }
935} 952}
936 953
937Monitor *
938idxtomon(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}
945
946void 954void
947initfont(const char *fontstr) { 955initfont(const char *fontstr) {
948 char *def, **missing; 956 char *def, **missing;
@@ -1512,11 +1520,9 @@ tag(const Arg *arg) {
1512 1520
1513void 1521void
1514tagmon(const Arg *arg) { 1522tagmon(const Arg *arg) {
1515 Monitor *m; 1523 if(!selmon->sel || !mons->next)
1516 1524 return
1517 if(!selmon->sel || !(m = idxtomon(arg->ui))) 1525 sendmon(selmon->sel, dirtomon(arg->i));
1518 return;
1519 sendmon(selmon->sel, m);
1520} 1526}
1521 1527
1522int 1528int