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
|
diff --git a/src/config.h.def b/src/config.h.def
index 19f656b..4d5fa41 100644
--- a/src/config.h.def
+++ b/src/config.h.def
@@ -1,6 +1,6 @@
/* config.h for dminiwm.c [ 0.1.6 ]
*
- * Started from catwm 31/12/10
+ * Started from catwm 31/12/10
* Bad window error checking and numlock checking used from
* 2wm at http://hg.suckless.org/2wm/
*
@@ -96,6 +96,8 @@ static key keys[] = {
{ MOD1|ShiftMask, XK_h, switch_horizontal, {NULL}},
{ MOD1|ShiftMask, XK_m, switch_fullscreen, {NULL}},
{ MOD1|ShiftMask, XK_v, switch_vertical, {NULL}},
+ { MOD1|ShiftMask, XK_r, quit, {.i = 0}}, /* restart */
+ { MOD1|ShiftMask, XK_q, quit, {.i = 1}}, /* quit */
// Control + alt + shortcut
{ MOD1|ControlMask, XK_q, quit, {NULL}},
{ MOD1|ControlMask, XK_r, spawn, {.com = rebootcmd}},
diff --git a/src/dminiwm.c b/src/dminiwm.c
index 2c4915e..05df5c2 100644
--- a/src/dminiwm.c
+++ b/src/dminiwm.c
@@ -1,6 +1,6 @@
/* dminiwm.c [ 0.1.6 ]
*
-* I started this from catwm 31/12/10
+* I started this from catwm 31/12/10
* Bad window error checking and numlock checking used from
* 2wm at http://hg.suckless.org/2wm/
*
@@ -118,7 +118,7 @@ static void next_desktop();
static void next_win();
static void prev_desktop();
static void prev_win();
-static void quit();
+static void quit(const Arg arg);
static void remove_window(Window w);
static void save_desktop(int i);
static void select_desktop(int i);
@@ -189,7 +189,7 @@ void add_window(Window w) {
else {
if(ATTACH_ASIDE == 0) {
for(t=head;t->next;t=t->next);
-
+
c->next = NULL;
c->prev = t;
c->win = w;
@@ -522,7 +522,7 @@ void tile() {
wdt = sw - BORDER_WIDTH;
if((n == x) && (n == 8))
wdt = 2*sw/3 - BORDER_WIDTH;
- } else
+ } else
if(x >= 5) {
wdt = (sw/3) - BORDER_WIDTH;
ht = (sh/2) - BORDER_WIDTH;
@@ -817,7 +817,7 @@ void enternotify(XEvent *e) {
}
}
-void send_kill_signal(Window w) {
+void send_kill_signal(Window w) {
XEvent ke;
ke.type = ClientMessage;
ke.xclient.window = w;
@@ -839,11 +839,11 @@ unsigned long getcolor(const char* color) {
return c.pixel;
}
-void quit() {
+void quit(const Arg arg) {
Window root_return, parent;
Window *children;
int i;
- unsigned int nchildren;
+ unsigned int nchildren;
XEvent ev;
/*
@@ -859,6 +859,7 @@ void quit() {
logger(" \033[0;33mThanks for using!");
XCloseDisplay(dis);
logger("\033[0;31mforced shutdown");
+ exit(arg.i);
}
bool_quit = 1;
@@ -876,12 +877,13 @@ void quit() {
XUngrabKey(dis,AnyKey,AnyModifier,root);
logger("\033[0;34mYou Quit : Thanks for using!");
+ exit(arg.i);
}
void logger(const char* e) {
fprintf(stdout,"\n\033[0;34m:: dminiwm : %s \033[0;m\n", e);
}
-
+
void setup() {
// Install a signal
sigchld(0);
@@ -1004,7 +1006,7 @@ void start() {
int main(int argc, char **argv) {
- // Open display
+ // Open display
if(!(dis = XOpenDisplay(NULL))) {
logger("\033[0;31mCannot open display!");
exit(1);
|