Firstly, thanks for taking the time to contribute to sxwm! Your interest
in improving the project is truly appreciated.
There is an included clangd formatting file, but it won’t do everything for you.
Please follow the rules below to keep the codebase consistent and clean.
- Use tabs for indentation — never spaces.
- All blocks of C code must be wrapped in curly braces
{}. - Each statement must be on its own line.
- Always add a space between keywords and the opening parenthesis.
Example:
if (x) {
y();
}
else {
z();
}- Use this format for comments to maintain consistency:
/* this is a comment */- For temporary notes, use:
/* TODO: something to fix */
/* FIXME: known issue */Functions should look like this:
void function_x(void)
{
}
void function_y(int y)
{
}- Use
snake_casefor all variable and function names.
Examples:
int some_variable = 2;
float other_variable = 5;
void do_something(void);If you create a header file, use header guards:
#ifndef HEADER_NAME_H
#define HEADER_NAME_H
// content
#endif /* HEADER_NAME_H */- Keep lines under 100 characters when possible to improve terminal readability.
- No trailing whitespace.
- One blank line between function definitions.
- Avoid unnecessary vertical spacing.
Organize includes like this:
- Corresponding header (if any)
- Standard library headers
- Other project headers
makemust succeed with no warnings on your system.- Don’t commit build artifacts (e.g.,
.o,sxwm) or backup files (e.g.,*~). - Test your changes, especially on multi-monitor setups using Xephyr.
- Don’t create new
.cor.hfiles unless absolutely necessary. - Keep most changes within
sxwm.cto maintain cohesion.
- Open a pull request with a clear description of what and why.
- Keep one purpose per commit — don’t mix unrelated changes.
- If fixing a bug, describe how to reproduce it.
- If adding a feature, ensure it fits with
sxwm’s minimalist philosophy. - Open separate PRs for unrelated changes.
- Use imperative mood:
Add foo, notAdded foo. - Keep the summary under 50 characters.
- Add a detailed body if needed.
Example:
Fix crash when window is closed
Previously, sxwm would segfault if a client closed itself.
This patch adds a check for null pointers before accessing window data.
-
Use the provided
.clang-formatfile where applicable. -
You may optionally run:
cppcheckclang-tidy
-
Avoid committing debug code like stray
printf()orfprintf(stderr, ...).
A sample .editorconfig file is provided (or you can request one).
It ensures editors match the project’s formatting conventions.
Update all relevant documentation if applicable:
sxwm.1README.mddefault_sxwmrcCHANGELOG.md
- For large changes, open an issue for discussion first.
- Do not change code for personal style unless it improves clarity or solves a specific problem.
Please ensure the following before opening a PR:
- Code builds without warnings
- Changes are fully tested
- PR includes a clear explanation
- Configuration reload works (if relevant)
- Be respectful and open to feedback.
- Feel free to ask questions about any review comments.
- Reviews are collaborative and meant to improve the code, not criticize you personally.
Happy hacking!