]> git.lizzy.rs Git - bspwm.git/blob - HACKING.md
New optional EXIT_STATUS argument for 'quit'
[bspwm.git] / HACKING.md
1 ## Requirements
2
3 You must be comfortable with [C][1], [XCB][2] and [Git][3].
4
5 ## Coding Style
6
7 I follow the [Linux Coding Style][4] with the following exceptions:
8 - One *Tab* equals 4 spaces.
9 - Always use `typedef ...` for structures.
10
11 ## Browsing the Code
12
13 The first files you might want to look at are `types.h`, `bspwm.c` and `events.c`.
14
15 If you use `vim`:
16 - Hitting *K* will lead you to the manual page of the function under the cursor (works with most `xcb_*` functions), sometimes you'll have to explicitly specify the section of the manual you're interested in with *3K* (e.g.: `open`).
17 - Install `ctags` and run `ctags *.{c,h}` in the directory holding the source. Then, hitting *Ctrl-]* will lead you to the definition of the function/variable/structure under the cursor (to go back: *Ctrl-T*).
18 - You can run `make` from `vim` with `:make` and then navigate to the next and the previous error with `:cn` and `:cp`.
19
20 ## Debugging
21
22 To produce debug executables, issue:
23 ```
24 make clean && make debug && make install
25 ```
26
27 If you use `systemd`, X might be started on the same virtual terminal as `bspwm` and you won't see its output, hence use something like `startx -- vt08` to start X (you can switch to the virtual terminal number *n* with *Ctrl-Alt-Fn*).
28
29 The debug messages are generated by the `PRINTF` and `PUTS` macros: feel free to use them.
30
31 If you want to use [`gdb`][5], switch to a free virtual terminal, e.g. *Ctrl-Alt-F2* and issue:
32
33 ```
34 gdb bspwm $(pgrep -x bspwm)
35 continue
36 ```
37
38 Then, go back to the virtual terminal holding X. If `bspwm` crashes, go back to the virtual terminal where you launched `gbd`: you might find clues there.
39
40 [1]: http://cm.bell-labs.com/cm/cs/cbook/
41 [2]: http://www.x.org/releases/X11R7.5/doc/libxcb/tutorial/
42 [3]: http://git-scm.com/documentation
43 [4]: http://www.kernel.org/doc/Documentation/CodingStyle
44 [5]: http://sourceware.org/gdb/current/onlinedocs/gdb/