RedditPP Mascot

RedditPP

r/suckless • … • u/bakkeby

floatpos patch

I was looking at the [floatrules](https://dwm.suckless.org/patches/floatrules/) patch and was kind of disappointed that it only supports absolute x and y coordinates - which means that if you have a multi-monitor setup then you have to take the leftmost monitor into account when placing windows.

OK, it's fairly straightforward to add monitor boundaries, but I think that it would be more convenient to have some monitor size agnostic rules - e.g. place the window at the bottom right-hand corner, or at 70% of the width of the screen.

So I set out to *roll my own* and it was actually fairly straightforward and quick to accomplish, but then I got the silly idea that I could extend it to support existing windows to move, place and resize windows similarly to the [exresize](https://dwm.suckless.org/patches/exresize/), [moveplace](https://dwm.suckless.org/patches/moveplace/) and [moveresizes](https://dwm.suckless.org/patches/moveresize/) patches.

Having done that I got the idea of positioning floating windows along an artificial grid that depends on the size of the client. For example a 3x3 grid would let a client to be placed top left, left center, bottom left, middle of the screen, etc. whereas a 5x5 grid would give you 25 possible positions. I found this to be a very nice way of moving floating windows around using keybindings (rather than adjusting 25 pixels at a time).

I'm sure there are improvements to be made.

Hope it's useful to someone.

[https://github.com/bakkeby/patches/wiki/floatpos](https://github.com/bakkeby/patches/wiki/floatpos)

— 0