bspwm/HACKING.md

42 lines
1.8 KiB
Markdown
Raw Normal View History

2012-12-19 12:57:02 +01:00
## Requirements
You must be comfortable with [C][1], [XCB][2] and [Git][3].
## Coding Style
I follow the [Linux Coding Style][4] with the following exceptions:
- *tab* = 4 spaces.
- Always use `typedef ...` for structures.
## Browsing the Code
The first files you might want to look at are `types.h`, `bspwm.c` and `events.c`.
If you use `vim`:
- 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`).
- Install `ctags` and run `ctags *.{c,h}` in the directory holding `bspwm`'s source. Then hitting *Ctrl-]* will lead you to the definition of the function/variable/structure under the cursor (to go back: *Ctrl-T*).
- You can run `make` from `vim` with `:make` and then navigate to the next and the previous error with `:cn` and `:cp`.
## Debugging
To get a debug executable use `make debug` instead of `make install`.
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-F<n>*).
The debug messages are generated by the `PRINTF` and `PUTS` macros.
If you want to use [`gdb`][5], switch to a free virtual terminal, e.g. *Ctrl-Alt-F2* and issue:
2012-12-19 14:42:19 +01:00
2012-12-19 12:57:02 +01:00
```
gdb bspwm $(pgrep -x bspwm)
2012-12-19 14:42:19 +01:00
continue
2012-12-19 12:57:02 +01:00
```
2012-12-19 14:42:19 +01:00
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.
2012-12-19 12:57:02 +01:00
[1]: http://cm.bell-labs.com/cm/cs/cbook/
[2]: http://www.x.org/releases/X11R7.5/doc/libxcb/tutorial/
[3]: http://git-scm.com/documentation
[4]: http://www.kernel.org/doc/Documentation/CodingStyle
[5]: http://sourceware.org/gdb/current/onlinedocs/gdb/