about summary refs log tree commit diff stats
path: root/dwm.html
blob: 0df44b562a1803baa12b6bf25d2016c887fb5a20 (plain) (blame)
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
<html>
	<head>
		<title>dwm - dynamic window manager</title>
		<meta name="author" content="Anselm R. Garbe">
		<meta name="generator" content="ed">
		<meta name="copyright" content="(C)opyright 2006 by Anselm R. Garbe">
		<style type="text/css">
			body {
				color: #000000;
				font-family: sans-serif;
				margin: 20px 20px 20px 20px;
			}
		</style>
	</head>
	<body>
		<center>
			<img src="dwm.png"/><br />
			<h3>dynamic window manager</h3>
		</center>
		<h3>Description</h3>
		<p>
		dwm is a dynamic window manager for X11.
		</p>
		<h3>Philosophy</h3>
		<p>
		As founder and main developer of wmii I came to the conclusion that
		wmii is too clunky for my needs. I don't need so many funky features
		and all this hype about remote control through a 9P service, I only
		want to manage my windows in a simple, but dynamic way. wmii never got
		finished because I listened to users, who proposed arbitrary ideas I
		considered useful. This resulted in an extreme <a href="http://www.jwz.org/doc/cadt.html">CADT</a>
		development model, which was a mistake. Thus the philosophy of
		dwm is simply <i>to fit my needs</i> (maybe yours as well). That's it.
		</p>
		<h3>Differences to wmii</h3	
		<p>
		In contrast to wmii, dwm is only a window manager, and nothing else.
		Hence, it is much smaller, faster and simpler.
		</p>
		<ul>
			<li>
			dwm has no 9P support, no editable tagbars, no shell-based
			configuration and remote control and comes without any additional
			tools like printing the selection or warping the mouse.
			</li>
			<li>
			dwm is only a single binary, it's source code is intended to never
			exceed 2000 SLOC.
			</li>
			<li>
			dwm is customized through editing its source code, that makes it
			extremely fast and secure - it does not process any input data which
			hasn't been known at compile time, except window title names.
			</li>
			<li>
			dwm is based on tagging and dynamic window management (however simpler
			than wmii or larswm).
			</li>
			<li>
			dwm don't distinguishes between layers, there is no floating or
			managed layer. Wether the clients of currently selected tag are
			managed or not, you can re-arrange all clients on the fly. Popup-
			and fixed-size windows are treated unmanaged. 
			</li>
			<li>
			dwm uses 1-pixel borders to provide the maximum of screen real
			estate to clients. Small titlebars are only drawn in front of unfocused
			clients.
			</li>
			<li>
			dwm reads from <b>stdin</b> to print arbitrary status text (like the
			date, load, battery charge). That's much simpler than larsremote,
			wmiir and what not...
			</li>
			<li>
			Anselm <b>does not</b> want any feedback to dwm. If you ask for support,
			feature requests, or if you report bugs, they will be <b>ignored</b>
			with a high chance. dwm is only intended to fit Anselms needs.
			However you are free to download and distribute/relicense it, with the
			conditions of the <a href="http://wmii.de/cgi-bin/hgwebdir.cgi/dwm?f=f10eb1139362;file=LICENSE;style=raw">MIT/X Consortium license</a>.
			</li>
		</ul>
		<h3>Screenshot</h3>
		<p>
		<a href="http://wmii.de/shots/dwm-20060714.png">Click here for a screenshot</a> (20060714)
		</p>
		<h3>Development</h3>
		<p>
		dwm is actively developed in parallel to wmii. You can <a href="http://wmii.de/cgi-bin/hgwebdir.cgi/dwm">browse</a> its source code repository or get a copy using <a href="http://www.selenic.com/mercurial/">Mercurial</a> with following command:
		</p>
		<p>
		<code>hg clone http://wmii.de/cgi-bin/hgwebdir.cgi/dwm</code>
		</p>
		<h3>Download</h3>
		<ul>
			<li><a href="http://wmii.de/download/dwm-0.1.tar.gz">dwm 0.1</a> (12kb) (20060714)</li>
		</ul>
		<h3>Miscellaneous</h3>
		<p>
		You can purchase this <a href="https://www.spreadshirt.net/shop.php?op=article&article_id=3298632&view=403">tricot</a>
		if you like dwm and the dwm logo, which has been designed by Anselm.
		</p>
		<p><small>--Anselm (20060714)</small></p>
	</body>
</html>
n map' href='/akkartik/mu/commit/075scenario_console.cc?h=hlt&id=795f5244abc9b9f26ff621fd1997db427289d2ba'>795f5244 ^
665fb11e ^
9dcbec39 ^
795f5244 ^
665fb11e ^
795f5244 ^
665fb11e ^

795f5244 ^
665fb11e ^
45c08fea ^

a5840f21 ^



263e6b2a ^
a5840f21 ^

b24eb476 ^


263e6b2a ^
795f5244 ^
a5840f21 ^


263e6b2a ^
795f5244 ^
a5840f21 ^





c6034af3 ^

795f5244 ^
263e6b2a ^
c6034af3 ^
b24eb476 ^
263e6b2a ^

d8f2d0b1 ^

56c0e796 ^

a5840f21 ^


665fb11e ^
b24eb476 ^
665fb11e ^





































bd345189 ^
665fb11e ^


















45c08fea ^


2dab0edb ^
45c08fea ^
665fb11e ^
45c08fea ^
2dab0edb ^

45c08fea ^
b0bf5321 ^


45c08fea ^
b0bf5321 ^
45c08fea ^
b0bf5321 ^
45c08fea ^
b0bf5321 ^
45c08fea ^

















8f060500 ^
665fb11e ^
45c08fea ^






2dab0edb ^

4938a720 ^
fedebaf5 ^




795f5244 ^
166e3c0d ^



fedebaf5 ^


795f5244 ^
1b76245c ^
35064671 ^

b24eb476 ^



795f5244 ^

b24eb476 ^
795f5244 ^
fedebaf5 ^



4938a720 ^
b24eb476 ^


4938a720 ^
4938a720 ^



4938a720 ^



b24eb476 ^
4938a720 ^
b24eb476 ^
4938a720 ^
32597844 ^
4938a720 ^
c6034af3 ^
4938a720 ^


b24eb476 ^
4938a720 ^
b24eb476 ^
4938a720 ^
795f5244 ^
32597844 ^
263e6b2a ^
c6034af3 ^
4938a720 ^

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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299




                                                                       

                            


                                
              

       



                                                                                                  

                         








                                


   
                                
                                                           

                                                  

                                   
                                     
                                
 
                                             
               
                                        
                                                      



                                       
                                                
                      

                                                                                    

                    
                                   
                                                   
                                                                                          
                     
                                                  


                                                                     
                                           

                                            
                                                                                                         



                                                                                                                              

                                                
                                    
                                                                                                    

                                               
                                                               
                                      
                                                        
          
                                                                          
                                                                
                                  
                                                                                                        

                                   
                                                                                                           
       

                                                



                                  
                                                                                                   

                                                           


                                                         
                                                                                          
                                                                                                        


                                                                      
                                                                                                                    
                                                                                              





                                                            

                                                 
                                               
                                                                                 
                                              
                                                       

                                                                                                                  

                                      

                                   


        
                       
                     





































                                          
                                                                                    


















                                


                              
              
                   
                  
            

       
                                                        


                                                 
                 
                                                  
                           
                                                  
                          
                                                  

















                              
                        
                           






                     

   
 




                                                                          
                                                              



                                       


                                                
                                        
                                                  

          



                                                                                

                                                                           
                                             
                                                   



        
       


                                           
                                            



                                                            



                
                     
                                       
                        
                            
                                           
                         
              


                
                       
                                       
                        
                            
                                       
                                             
                                       
              

                
//: Clean syntax to manipulate and check the console in scenarios.
//: Instruction 'assume-console' implicitly creates a variable called
//: 'console' that is accessible inside other 'run' instructions in the
//: scenario. Like with the fake screen, 'assume-console' transparently
//: supports unicode.

:(scenarios run_mu_scenario)
:(scenario keyboard_in_scenario)
scenario keyboard-in-scenario [
  assume-console [
    type [abc]
  ]
  run [
    1:character, console:address:console, 2:boolean <- read-key console:address:console
    3:character, console:address:console, 4:boolean <- read-key console:address:console
    5:character, console:address:console, 6:boolean <- read-key console:address:console
    7:character, console:address:console, 8:boolean, 9:boolean <- read-key console:address:console
  ]
  memory-should-contain [
    1 <- 97  # 'a'
    2 <- 1
    3 <- 98  # 'b'
    4 <- 1
    5 <- 99  # 'c'
    6 <- 1
    7 <- 0  # unset
    8 <- 1
    9 <- 1  # end of test events
  ]
]

:(before "End Scenario Globals")
const int CONSOLE = Next_predefined_global_for_scenarios++;
:(before "End Special Scenario Variable Names(r)")
Name[r]["console"] = CONSOLE;

//: allow naming just for 'console'
:(before "End is_special_name Cases")
if (s == "console") return true;

:(before "End Primitive Recipe Declarations")
ASSUME_CONSOLE,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "assume-console", ASSUME_CONSOLE);
:(before "End Primitive Recipe Checks")
case ASSUME_CONSOLE: {
  break;
}
:(before "End Primitive Recipe Implementations")
case ASSUME_CONSOLE: {
  // create a temporary recipe just for parsing; it won't contain valid instructions
  istringstream in("[" + current_instruction().ingredients.at(0).name + "]");
  recipe r;
  slurp_body(in, r);
  int num_events = count_events(r);
  // initialize the events like in new-fake-console
  int size = /*space for refcount*/1 + /*space for length*/1 + num_events*size_of_event();
  ensure_space(size);
  int event_data_address = Current_routine->alloc;
  // store length
  put(Memory, Current_routine->alloc+/*skip refcount*/1, num_events);
  Current_routine->alloc += /*skip refcount and length*/2;
  for (int i = 0; i < SIZE(r.steps); ++i) {
    const instruction& curr = r.steps.at(i);
    if (curr.name == "left-click") {
      trace(9999, "mem") << "storing 'left-click' event starting at " << Current_routine->alloc << end();
      put(Memory, Current_routine->alloc, /*tag for 'touch-event' variant of 'event' exclusive-container*/2);
      put(Memory, Current_routine->alloc+1+/*offset of 'type' in 'mouse-event'*/0, TB_KEY_MOUSE_LEFT);
      put(Memory, Current_routine->alloc+1+/*offset of 'row' in 'mouse-event'*/1, to_integer(curr.ingredients.at(0).name));
      put(Memory, Current_routine->alloc+1+/*offset of 'column' in 'mouse-event'*/2, to_integer(curr.ingredients.at(1).name));
      Current_routine->alloc += size_of_event();
    }
    else if (curr.name == "press") {
      trace(9999, "mem") << "storing 'press' event starting at " << Current_routine->alloc << end();
      string key = curr.ingredients.at(0).name;
      if (is_integer(key))
        put(Memory, Current_routine->alloc+1, to_integer(key));
      else if (contains_key(Key, key))
        put(Memory, Current_routine->alloc+1, Key[key]);
      else
        raise << "assume-console: can't press '" << key << "'\n" << end();
      if (get_or_insert(Memory, Current_routine->alloc+1) < 256)
        // these keys are in ascii
        put(Memory, Current_routine->alloc, /*tag for 'text' variant of 'event' exclusive-container*/0);
      else {
        // distinguish from unicode
        put(Memory, Current_routine->alloc, /*tag for 'keycode' variant of 'event' exclusive-container*/1);
      }
      Current_routine->alloc += size_of_event();
    }
    // End Event Handlers
    else {
      // keyboard input
      assert(curr.name == "type");
      trace(9999, "mem") << "storing 'type' event starting at " << Current_routine->alloc << end();
      const string& contents = curr.ingredients.at(0).name;
      const char* raw_contents = contents.c_str();
      int num_keyboard_events = unicode_length(contents);
      int curr = 0;
      for (int i = 0; i < num_keyboard_events; ++i) {
        trace(9999, "mem") << "storing 'text' tag at " << Current_routine->alloc << end();
        put(Memory, Current_routine->alloc, /*tag for 'text' variant of 'event' exclusive-container*/0);
        uint32_t curr_character;
        assert(curr < SIZE(contents));
        tb_utf8_char_to_unicode(&curr_character, &raw_contents[curr]);
        trace(9999, "mem") << "storing character " << curr_character << " at " << Current_routine->alloc+1 << end();
        put(Memory, Current_routine->alloc+/*skip exclusive container tag*/1, curr_character);
        curr += tb_utf8_char_length(raw_contents[curr]);
        Current_routine->alloc += size_of_event();
      }
    }
  }
  assert(Current_routine->alloc == event_data_address+size);
  // wrap the array of events in a console object
  ensure_space(size_of_console());
  put(Memory, CONSOLE, Current_routine->alloc);
  trace(9999, "mem") << "storing console in " << Current_routine->alloc << end();
  Current_routine->alloc += size_of_console();
  int console_address = get_or_insert(Memory, CONSOLE);
  trace(9999, "mem") << "storing console data in " << console_address+2 << end();
  put(Memory, console_address+/*skip refcount*/1+/*offset of 'data' in container 'events'*/1, event_data_address);
  // increment refcount for event data
  put(Memory, event_data_address, 1);
  // increment refcount for console
  put(Memory, console_address, 1);
  break;
}

:(before "End Globals")
map<string, int> Key;
:(before "End One-time Setup")
initialize_key_names();
:(code)
void initialize_key_names() {
  Key["F1"] = TB_KEY_F1;
  Key["F2"] = TB_KEY_F2;
  Key["F3"] = TB_KEY_F3;
  Key["F4"] = TB_KEY_F4;
  Key["F5"] = TB_KEY_F5;
  Key["F6"] = TB_KEY_F6;
  Key["F7"] = TB_KEY_F7;
  Key["F8"] = TB_KEY_F8;
  Key["F9"] = TB_KEY_F9;
  Key["F10"] = TB_KEY_F10;
  Key["F11"] = TB_KEY_F11;
  Key["F12"] = TB_KEY_F12;
  Key["insert"] = TB_KEY_INSERT;
  Key["delete"] = TB_KEY_DELETE;
  Key["home"] = TB_KEY_HOME;
  Key["end"] = TB_KEY_END;
  Key["page-up"] = TB_KEY_PGUP;
  Key["page-down"] = TB_KEY_PGDN;
  Key["up-arrow"] = TB_KEY_ARROW_UP;
  Key["down-arrow"] = TB_KEY_ARROW_DOWN;
  Key["left-arrow"] = TB_KEY_ARROW_LEFT;
  Key["right-arrow"] = TB_KEY_ARROW_RIGHT;
  Key["ctrl-a"] = TB_KEY_CTRL_A;
  Key["ctrl-b"] = TB_KEY_CTRL_B;
  Key["ctrl-c"] = TB_KEY_CTRL_C;
  Key["ctrl-d"] = TB_KEY_CTRL_D;
  Key["ctrl-e"] = TB_KEY_CTRL_E;
  Key["ctrl-f"] = TB_KEY_CTRL_F;
  Key["ctrl-g"] = TB_KEY_CTRL_G;
  Key["backspace"] = TB_KEY_BACKSPACE;
  Key["ctrl-h"] = TB_KEY_CTRL_H;
  Key["tab"] = TB_KEY_TAB;
  Key["ctrl-i"] = TB_KEY_CTRL_I;
  Key["ctrl-j"] = TB_KEY_CTRL_J;
  Key["enter"] = TB_KEY_NEWLINE;  // ignore CR/LF distinction; there is only 'enter'
  Key["ctrl-k"] = TB_KEY_CTRL_K;
  Key["ctrl-l"] = TB_KEY_CTRL_L;
  Key["ctrl-m"] = TB_KEY_CTRL_M;
  Key["ctrl-n"] = TB_KEY_CTRL_N;
  Key["ctrl-o"] = TB_KEY_CTRL_O;
  Key["ctrl-p"] = TB_KEY_CTRL_P;
  Key["ctrl-q"] = TB_KEY_CTRL_Q;
  Key["ctrl-r"] = TB_KEY_CTRL_R;
  Key["ctrl-s"] = TB_KEY_CTRL_S;
  Key["ctrl-t"] = TB_KEY_CTRL_T;
  Key["ctrl-u"] = TB_KEY_CTRL_U;
  Key["ctrl-v"] = TB_KEY_CTRL_V;
  Key["ctrl-w"] = TB_KEY_CTRL_W;
  Key["ctrl-x"] = TB_KEY_CTRL_X;
  Key["ctrl-y"] = TB_KEY_CTRL_Y;
  Key["ctrl-z"] = TB_KEY_CTRL_Z;
  Key["escape"] = TB_KEY_ESC;
}

:(scenario events_in_scenario)
scenario events-in-scenario [
  assume-console [
    type [abc]
    left-click 0, 1
    press up-arrow
    type [d]
  ]
  run [
    # 3 keyboard events; each event occupies 4 locations
    1:event <- read-event console:address:console
    5:event <- read-event console:address:console
    9:event <- read-event console:address:console
    # mouse click
    13:event <- read-event console:address:console
    # non-character keycode
    17:event <- read-event console:address:console
    # final keyboard event
    21:event <- read-event console:address:console
  ]
  memory-should-contain [
    1 <- 0  # 'text'
    2 <- 97  # 'a'
    3 <- 0  # unused
    4 <- 0  # unused
    5 <- 0  # 'text'
    6 <- 98  # 'b'
    7 <- 0  # unused
    8 <- 0  # unused
    9 <- 0  # 'text'
    10 <- 99  # 'c'
    11 <- 0  # unused
    12 <- 0  # unused
    13 <- 2  # 'mouse'
    14 <- 65513  # mouse click
    15 <- 0  # row
    16 <- 1  # column
    17 <- 1  # 'keycode'
    18 <- 65517  # up arrow
    19 <- 0  # unused
    20 <- 0  # unused
    21 <- 0  # 'text'
    22 <- 100  # 'd'
    23 <- 0  # unused
    24 <- 0  # unused
    25 <- 0
  ]
]

//: Deal with special keys and unmatched brackets by allowing each test to
//: independently choose the unicode symbol to denote them.
:(before "End Primitive Recipe Declarations")
REPLACE_IN_CONSOLE,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "replace-in-console", REPLACE_IN_CONSOLE);
:(before "End Primitive Recipe Checks")
case REPLACE_IN_CONSOLE: {
  break;
}
:(before "End Primitive Recipe Implementations")
case REPLACE_IN_CONSOLE: {
  assert(scalar(ingredients.at(0)));
  if (!get_or_insert(Memory, CONSOLE)) {
    raise << "console not initialized\n" << end();
    break;
  }
  int console_address = get_or_insert(Memory, CONSOLE);
  int console_data = get_or_insert(Memory, console_address+1);
  int size = get_or_insert(Memory, console_data);  // array size
  for (int i = 0, curr = console_data+1; i < size; ++i, curr+=size_of_event()) {
    if (get_or_insert(Memory, curr) != /*text*/0) continue;
    if (get_or_insert(Memory, curr+1) != ingredients.at(0).at(0)) continue;
    for (int n = 0; n < size_of_event(); ++n)
      put(Memory, curr+n, ingredients.at(1).at(n));
  }
  break;
}

:(code)
int count_events(const recipe& r) {
  int result = 0;
  for (int i = 0; i < SIZE(r.steps); ++i) {
    const instruction& curr = r.steps.at(i);
    if (curr.name == "type")
      result += unicode_length(curr.ingredients.at(0).name);
    else
      result++;
  }
  return result;
}

int size_of_event() {
  // memoize result if already computed
  static int result = 0;
  if (result) return result;
  type_tree* type = new type_tree("event");
  result = size_of(type);
  delete type;
  return result;
}

int size_of_console() {
  // memoize result if already computed
  static int result = 0;
  if (result) return result;
  assert(get(Type_ordinal, "console"));
  type_tree* type = new type_tree("console");
  result = size_of(type)+/*refcount*/1;
  delete type;
  return result;
}