jigsawwm.tiler package
Submodules
jigsawwm.tiler.layouts module
The layout module operates in Relative Coordinate, to that end, it defines 2 basic types:
FloatRect is a tuple with 4 elements (left/top/right/bottom) to describe a rectangle in ratio form (0.0~1.0)
Layout is a generator which generates FloatRects for given total number of windows
- mono(n: int) Iterator[Tuple[float, float, float, float]][source]
The mono Layout
+-----------+ | | | | | | | 1 | | | | | | | +-----------+
- Parameters:
n – total number of windows
- Return type:
Iterator[FloatRect]
- dwindle(n: int) Iterator[Tuple[float, float, float, float]][source]
The dwindle Layout
+-----------+-----------+ | | | | | 2 | | | | | 1 +-----+-----+ | | | 4 | | | 3 +--+--+ | | | 5|-.| +-----------+-----+-----+
- Parameters:
n – total number of windows
- Return type:
Iterator[FloatRect]
- widescreen_dwindle(n: int, master_ratio: float = 0.4) Iterator[Tuple[float, float, float, float]][source]
A wide-screen friendly dwindle Layout
+-----------+-----------+-----------+ | | | | | | | 3 | | | | | | 1 | 2 +-----+-----+ | | | | 5 | | | | 4 +--+--+ | | | | 6|-.| +-----------+-----------+-----+-----+
- Parameters:
n – total number of windows
- Return type:
Iterator[FloatRect]
- plug_rect(source: Tuple[float, float, float, float], target: Tuple[Union[int, float], Union[int, float], Union[int, float], Union[int, float]]) Tuple[Union[int, float], Union[int, float], Union[int, float], Union[int, float]][source]
Plug the source rect into the target rect and compute the new dimensions, you may plug a Relative Rect into a Physical Rect, but not the other way around.
- Parameters:
source – the FloatRect to be moved
target – the container, either a FloatRect or Rect(physical pixels)
- Returns:
Rect or FloatRect depends on the type of the target
- Return type:
NumberRect
jigsawwm.tiler.tilers module
The tiler module is responsible for converting Layout to Physical Coordinates for arbitrary number of windows.
Rect is a tuple with 4 elements (left/top/right/bottom) to describe a rectangle in pixels (integer)
Tiler is a generator which generates Rects with specified Layout for given monitor work area and total number of windows
LayoutTiler is similar to Tiler except the Layout was predefined
- direct_tiler(layout: Callable[[int], Iterator[Tuple[float, float, float, float]]], work_area: Tuple[int, int, int, int], total_windows: int) Iterator[Tuple[int, int, int, int]][source]
The default Tiler which maps specified Layout to physical work area directly
- Parameters:
layout – a Layout generator
work_area – the monitor work area (taskbar excluded)
total_windows – total number of windows
- Return type:
Iterator[Rect]
- obs_tiler(layout: Callable[[int], Iterator[Tuple[float, float, float, float]]], work_area: Tuple[int, int, int, int], total_windows: int, obs_width: int = 1920, obs_height: int = 1080) Iterator[Tuple[int, int, int, int]][source]
Useful for OBS screen recording, it would put the 1st and 2nd window to the left and bottom, while all the other windows go to the top right corne with specified layout as the area to be recorded.
+-----------+-----------+-----------+ | | | | | | | 4 | | | 3 | | | 1 | +-----+-----+ | obs | | 5 | 6 | | |-----------------------| | | 2. script reader | +-----------+-----------------------+
- Parameters:
layout – Layout for the top right corne (area to be recorded)
work_area – the monitor work area (taskbar excluded)
total_windows – total number of windows
obs_width – width for the top right corne (area to be recorded) in pixels
obs_height – height for the top right corne (area to be recorded) in pixels
- Return type:
Iterator[Rect]
- mono_layout_tiler(*args, **kwargs) Iterator[Tuple[int, int, int, int]][source]
The dwindle layout tiler
- dwindle_layout_tiler(*args, **kwargs) Iterator[Tuple[int, int, int, int]][source]
The dwindle layout tiler