about summary refs log tree commit diff stats
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
parent5dd92c765570caa6d96ab125aa655e30cf82eb20 (diff)
downloaddwm-a9e145fe6d8af4848e6706131ac41e99003cd997.tar.gz
changed focusmon/tagmon to work on prev/next instead (-1/+1), changed shortcuts to Mod1-, Mod1-. and Mod1-Shift-, Mod1-Shift-.
-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[] = {
 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
 	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
 	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
-	{ MODKEY,                       XK_w,      focusmon,       {.ui = 0 } },
-	{ MODKEY,                       XK_e,      focusmon,       {.ui = 1 } },
-	{ MODKEY|ShiftMask,             XK_w,      tagmon,         {.ui = 0 } },
-	{ MODKEY|ShiftMask,             XK_e,      tagmon,         {.ui = 1 } },
+	{ MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
+	{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
+	{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
+	{ MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
 	TAGKEYS(                        XK_1,                      0)
 	TAGKEYS(                        XK_2,                      1)
 	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.
 Windows are grouped by tags. Each window can be tagged with one or multiple
 tags. Selecting certain tags displays all windows with these tags.
 .P
-dwm contains a small status bar which displays all available tags, the layout,
+Each screen contains a small status bar which displays all available tags, the layout,
 the title of the focused window, and the text read from the root window name
-property. A floating window is indicated with an empty square and a maximised
-floating window is indicated with a filled square before the windows title.
-The selected tags are indicated with a different color. The tags of the focused
-window are indicated with a filled square in the top left corner.  The tags
-which are applied to one or more windows are indicated with an empty square in
-the top left corner.
+property, if the screen is focused. A floating window is indicated with an
+empty square and a maximised floating window is indicated with a filled square
+before the windows title.  The selected tags are indicated with a different
+color. The tags of the focused window are indicated with a filled square in the
+top left corner.  The tags which are applied to one or more windows are
+indicated with an empty square in the top left corner.
 .P
 dwm draws a small border around windows to indicate the focus state.
 .SH OPTIONS
@@ -57,6 +57,18 @@ click on a tag label adds/removes that tag to/from the focused window.
 Start
 .BR xterm.
 .TP
+.B Mod1\-,
+Focus previous screen, if any.
+.TP
+.B Mod1\-.
+Focus next screen, if any.
+.TP
+.B Mod1\-Shift\-,
+Send focused window to previous screen, if any.
+.TP
+.B Mod1\-Shift\-,
+Send focused window to next screen, if any.
+.TP
 .B Mod1\-b
 Toggles bar on and off.
 .TP
diff --git a/dwm.c b/dwm.c
index d47da3f..613a029 100644
--- a/dwm.c
+++ b/dwm.c
@@ -11,9 +11,9 @@
  * in O(1) time.
  *
  * Each child of the root window is called a client, except windows which have
- * set the override_redirect flag.  Clients are organized in a global
- * linked client list, the focus history is remembered through a global
- * stack list. Each client contains a bit array to indicate the tags of a
+ * set the override_redirect flag.  Clients are organized in a linked client
+ * list on each monitor, the focus history is remembered through a stack list
+ * on each monitor. Each client contains a bit array to indicate the tags of a
  * client.
  *
  * Keys and tagging rules are organized as arrays and defined in config.h.
@@ -164,6 +164,7 @@ static void destroynotify(XEvent *e);
 static void detach(Client *c);
 static void detachstack(Client *c);
 static void die(const char *errstr, ...);
+static Monitor *dirtomon(int dir);
 static void drawbar(Monitor *m);
 static void drawbars(void);
 static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]);
@@ -180,7 +181,6 @@ static long getstate(Window w);
 static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
 static void grabbuttons(Client *c, Bool focused);
 static void grabkeys(void);
-static Monitor *idxtomon(unsigned int n);
 static void initfont(const char *fontstr);
 static Bool isprotodel(Client *c);
 static void keypress(XEvent *e);
@@ -621,6 +621,22 @@ die(const char *errstr, ...) {
 	exit(EXIT_FAILURE);
 }
 
+Monitor *
+dirtomon(int dir) {
+	Monitor *m = NULL;
+
+	if(dir > 0)
+		if(!(m = selmon->next))
+			m = mons;
+	else {
+		if(selmon == mons)
+			for(m = mons; m->next; m = m->next);
+		else
+			for(m = mons; m->next != selmon; m = m->next);
+	}
+	return m;
+}
+
 void
 drawbar(Monitor *m) {
 	int x;
@@ -797,10 +813,11 @@ focusin(XEvent *e) { /* there are some broken focus acquiring clients */
 
 void
 focusmon(const Arg *arg) {
-	Monitor *m;
+	Monitor *m = NULL;
 
-	if(!(m = idxtomon(arg->ui)) || m == selmon)
+	if(!mons->next)
 		return;
+	m = dirtomon(arg->i);
 	unfocus(selmon->sel);
 	selmon = m;
 	focus(NULL);
@@ -934,15 +951,6 @@ grabkeys(void) {
 	}
 }
 
-Monitor *
-idxtomon(unsigned int n) {
-	unsigned int i;
-	Monitor *m;
-
-	for(m = mons, i = 0; m && i != n; m = m->next, i++);
-	return m;
-}
-
 void
 initfont(const char *fontstr) {
 	char *def, **missing;
@@ -1512,11 +1520,9 @@ tag(const Arg *arg) {
 
 void
 tagmon(const Arg *arg) {
-	Monitor *m;
-
-	if(!selmon->sel || !(m = idxtomon(arg->ui)))
-		return;
-	sendmon(selmon->sel, m);
+	if(!selmon->sel || !mons->next)
+		return
+	sendmon(selmon->sel, dirtomon(arg->i));
 }
 
 int
itter Anselm R. Garbe <garbeam@wmii.de> 2006-07-13 09:32:22 +0200 added logo+description' href='/acidbong/suckless/dwm/commit/wm.h?h=5.7&id=650a1fb4e1a798aca48a53739f5bb2649191bc1c'>650a1fb ^
8b59083 ^
8b59083 ^

0025572 ^
bf35794 ^


8b59083 ^

1076f2b
da2bbd3 ^
3399650 ^
1173723 ^

a05beb6 ^
2e836ec ^
a05beb6 ^
95e8d12 ^
901b3ed ^
4688ad1 ^
b355755 ^
1076f2b
72707c2 ^
bf35794 ^

1076f2b

b355755 ^
8cc7f3b ^
d7413ff ^
ee31e38 ^
66da153 ^

bf35794 ^
292ccc4 ^
efa7e51 ^
bf35794 ^


bf35794 ^
39677ec ^
439e15d ^
dba2306 ^
3399650 ^
adaa28a ^
dba2306 ^
adaa28a ^
adaa28a ^
adaa28a ^
04eb016 ^
adaa28a ^

4688ad1 ^
adaa28a ^
3399650 ^
d7e1708 ^
dba2306 ^
c0705ee ^
adaa28a ^
c0705ee ^

8cc7f3b ^
d7e1708 ^
dba2306 ^
29355bd ^
b6ad663 ^
b9da4b0 ^
9e8b325 ^
adaa28a ^
c47da14 ^
dba2306 ^
adaa28a ^
9e8b325 ^
dba2306 ^
e21d93b ^
937cabf ^
72707c2 ^
adaa28a ^
19da197 ^
19da197 ^
29355bd ^
8b59083 ^
8b59083 ^
adaa28a ^
d4b7a9a ^
c47da14 ^
aa13727 ^











1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140