pkkid / x11pygrid

Quickly move windows around the an X11 desktop
GNU General Public License v2.0
324 stars 41 forks source link

Add noclamp* variants of left/right/top/bottom commands #28

Closed jonsim closed 2 years ago

jonsim commented 4 years ago

The intention behind these new commands is to permit use of grid cells in the center of the workarea. The default left/right/top/bottom commands all clamp the left/right/top/bottom edge of the window to the edge of the workarea, prohibiting use of cells in the center.

For example, given a 3x3 grid, it is not possible with the default commands to move a window to the center cell (1,1). With larger displays and larger grids this becomes more problematic. This patch adds noclamp* variants of the commands which do not clamp to the respective workarea edge.

By relaxing this positioning restriction, it greatly increases the number of potential positions for a window. To reduce this (and thus the number of times the command must be invoked to reach any given position) the new commands will only resize the window to the closest grid-bounded size in the axis they are not moving in. For example: the noclampleft command will not resize the window vertically, except if necessary to align it to the grid - in which case it will resize it as little as possible. This permits intuitive combinations of noclamptop/bottom and noclampleft/right to be issued to move a window to any desired grid position.

No default key bindings have been added for the new commands. The README has been amended to clearly describe all the available commands.

pkkid commented 2 years ago

Sorry it took me a while to see this. Thank you!