23 Nov 21
I have finally created my own dwm patch! In short, it provides the customisable keybinding Alt + x to center the focused floating window.
I would assume that it is unnecessary for most users, unless they tend to use floating windows now and again. I had searched occasionally for such a patch on the list of dwm patches, but all patches related to centering did not actually center windows.
I decided to take this task into my own hands, and was able to get it working within the morning! After a bit of testing against the stock 6.2 release of dwm (which is frankly all the testing that is required really), I tested it against the amalgamation of patches I have applied on my dwm build.
Satisfied with the stability of the function, I submitted the patch to the suckless website, which was a painless process.
The patch itself is laughably simple. I implemented a keybinding to a new function called
movecenter which simply centers the focused window using some basic math.