Synopsis

(import jwno/auto-layout)

This module contains code that can change window layouts automatically for the user:

Name Description
auto-layout/bsp Splits and arranges frames in the good old BSP (binary space partitioning) fasion.
auto-layout/close-empty-frame Checks for empty frames and closes them, when a window is removed.
auto-layout/rows Splits and arranges frames into horizontal or vertical rows.
auto-layout/zoom-in Calls the :zoom-in command, when a frame is activated.

auto-layout/bsp

To enable it:

(def bsp-layout (auto-layout/bsp jwno/context))
(:enable bsp-layout)

Then, when a new window appears, bsp-layout will automatically create a new frame by splitting the active frame, and put the window in that new frame.

To disable it:

(:disable bsp-layout)

And if you want to re-arrange all managed windows on a monitor immediately:

(:refresh bsp-layout)

This works even when the BSP layout is disabled.

auto-layout/close-empty-frame

To enable it:

(def auto-close-empty-frame (auto-layout/close-empty-frame jwno/context))
(:enable auto-close-empty-frame)

Then, when a managed window is removed, auto-close-empty-frame will check whether that window's parent frame is empty, and automatically close the frame in that case.

To disable it:

(:disable auto-close-empty-frame)

auto-layout/rows

To enable it:

(def rows-layout (auto-layout/rows jwno/context))
(put rows-layout :direction :horizontal)  # or :vertical, defaults to :horizontal
(:enable rows-layout)

When a new window appears, rows-layout will automatically insert a new frame on the right-most or bottom-most side (depending on the :direction setting) of the active monitor, and put the window in that new frame.

To disable it:

(:disable rows-layout)

And if you want to re-arrange all managed windows on a monitor immediately:

(:refresh rows-layout)

This works even when the rows layout is disabled.

auto-layout/zoom-in

To enable it:

(def auto-zoom-in (auto-layout/zoom-in jwno/context))
(put auto-zoom-in :ratio 0.7)  # or any other value that's < 1, defaults to 0.7
(:enable auto-zoom-in)

When a frame is activated, auto-zoom-in will automatically call the :zoom-in command.

To disable it:

(:disable auto-zoom-in)