mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 22:28:24 +02:00
Splits layout: Allow setting the bias of the current split using layout_action bias
Fixes #8222
This commit is contained in:
@@ -84,6 +84,12 @@ consumption to do the same tasks.
|
|||||||
Detailed list of changes
|
Detailed list of changes
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
|
0.39.1 [future]
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
- Splits layout: Allow setting the bias of the current split using ``layout_action bias`` (:iss:`8222`)
|
||||||
|
|
||||||
|
|
||||||
0.39.0 [2025-01-16]
|
0.39.0 [2025-01-16]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@@ -179,6 +179,12 @@ define a few extra key bindings in :file:`kitty.conf`::
|
|||||||
map ctrl+up neighboring_window up
|
map ctrl+up neighboring_window up
|
||||||
map ctrl+down neighboring_window down
|
map ctrl+down neighboring_window down
|
||||||
|
|
||||||
|
# Set the bias of the split containing the currently focused window. The
|
||||||
|
# currently focused window will take up the specified percent of its parent
|
||||||
|
# window's size.
|
||||||
|
map ctrl+. layout_action bias 80
|
||||||
|
|
||||||
|
|
||||||
Windows can be resized using :ref:`window_resizing`. You can swap the windows
|
Windows can be resized using :ref:`window_resizing`. You can swap the windows
|
||||||
in a split using the ``rotate`` action with an argument of ``180`` and rotate
|
in a split using the ``rotate`` action with an argument of ``180`` and rotate
|
||||||
and swap with an argument of ``270``.
|
and swap with an argument of ``270``.
|
||||||
|
|||||||
@@ -288,6 +288,10 @@ class Pair:
|
|||||||
geom = window_geometry_from_layouts(xl, yl)
|
geom = window_geometry_from_layouts(xl, yl)
|
||||||
self.apply_window_geometry(self.two, geom, id_window_map, layout_object)
|
self.apply_window_geometry(self.two, geom, id_window_map, layout_object)
|
||||||
|
|
||||||
|
def set_bias(self, window_id: int, bias: int) -> None:
|
||||||
|
b = max(0, min(bias, 100)) / 100
|
||||||
|
self.bias = b if window_id == self.one else (1. - b)
|
||||||
|
|
||||||
def modify_size_of_child(self, which: int, increment: float, is_horizontal: bool, layout_object: 'Splits') -> bool:
|
def modify_size_of_child(self, which: int, increment: float, is_horizontal: bool, layout_object: 'Splits') -> bool:
|
||||||
if is_horizontal == self.horizontal and not self.is_redundant:
|
if is_horizontal == self.horizontal and not self.is_redundant:
|
||||||
if which == 2:
|
if which == 2:
|
||||||
@@ -642,6 +646,15 @@ class Splits(Layout):
|
|||||||
new_root.two = wg.id
|
new_root.two = wg.id
|
||||||
self.pairs_root = new_root
|
self.pairs_root = new_root
|
||||||
return True
|
return True
|
||||||
|
elif action_name == 'bias':
|
||||||
|
args = args or ('50',)
|
||||||
|
bias = int(args[0])
|
||||||
|
wg = all_windows.active_group
|
||||||
|
if wg is not None:
|
||||||
|
pair = self.pairs_root.pair_for_window(wg.id)
|
||||||
|
if pair is not None:
|
||||||
|
pair.set_bias(wg.id, bias)
|
||||||
|
return True
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user