Written with C and Windows API and utilizes existing Windows facilities, resulting in very slim code.
Executable and DLL are very small (<20KB total)
Make sure you place the DLL next to the executable, so it can find it.
Video in which I make the PoC of this project: https://youtu.be/cuPirXZ6AWo
After building, run the executable lightwm.exe
which will reside in the release and/or debug folder, depending on what you built.
Upon running, it will immediately tile all the non-minimized windows on your screen. The program will run in the background.
If you want to configure it to run when you login, you can use the Run
utility and type shell:startup
, then create a LightWM shortcut in that folder.
alt+q
- quit LightWMalt+j
- focus on next windowalt+k
- focus on previous windowalt+f
- toggle fullscreen mode (disables tiling and puts the focused window in fullscreen, pressingalt+f
again will enable tiling again and tile all non-minimized windows)alt+1
up untilalt+9
- go to workspace number1
until9
respectively- You can move the current focused window to a different workspace number by adding
shift
to the above command. - You can "force" retile by using
alt+t
, you can use this as a trick to send the current focused window to the left. alt+\
toggles whether the automatic tiling is enabled/disabled. This is useful if you also use programs which don't play well with LightWM automatic tiling
You can build using the "x64 Native Tools Command Prompt for VS 2022" that comes with Microsoft Visual Studio Build Tools:
In the console you can run nmake to build according to the Makefile
nmake
I haven't tried building with a different VS version or building x86, but that may work as well.
One of my main goals with this project is to keep it as minimal as possible, for example I decided against using a dynamic configuration on purpose.
Thus, make sure to keep the contributions as simple as possible.
If you plan on adding a completely new feature, let's discuss it on the issues beforehand.
Also notice that this project does not use any C library functions on purpose, only Windows API. This keeps everything as minimal as possible.
Tabs > Spaces
Functions and variables should be in camelCase
In general comments should be avoided unless they are absolutely necessary
Avoid adding obvious comments on the code like:
// Prints hello on the screen
printf("Hello!\n");
Avoid comments explaining the logic in other words:
// Allocate memory for the string and for the null terminator
malloc(1024 + 1);
Instead something like this is much better:
const int nullTermSize = 1;
malloc(strlen(path) + nullTermSize);
Example of when a comment is necessary and has added value:
// This DLL is loaded into many processes on the computer, therefore we need to keep the logic here as simple as possible to avoid slowing down the system
int*
and not int *
Opening braces {
in the same line as the block definition
if (cond) {
}
and not:
if (cond)
{
}
Space between the block name and the brackets
if (statement)
and not if(statement)
Opening braces {
in a new line after the function definition
void init()
{
}
and not:
void init() {
}