diff --git a/docs/changelog.rst b/docs/changelog.rst index 0da69c8c3..0ff477677 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -12,6 +12,9 @@ To update |kitty|, :doc:`follow the instructions `. - Tall and Fat layouts: Add a ``mirrored`` option to put the full size window on the opposite edge of the screen (:iss:`2654`) +- Tall and Fat layouts: Add mappable actions to increase or decrease the number + of full size windows (:iss:`2688`) + - Add an option :opt:`confirm_os_window_close` to ask for confirmation when closing an OS window with multiple kitty windows. diff --git a/docs/layouts.rst b/docs/layouts.rst index 893e708cf..29a219d33 100644 --- a/docs/layouts.rst +++ b/docs/layouts.rst @@ -67,6 +67,13 @@ for the options is shown below:: │ │ │ └──────────────┴───────────────┘ +In addition, you can map keys to increase or decrease the number of full size +windows, for example:: + + map ctrl+[ layout_action decrease_num_full_size_windows + map ctrl+] layout_action increase_num_full_size_windows + + The Fat Layout ---------------- diff --git a/kitty/layout/tall.py b/kitty/layout/tall.py index 7acb385f1..a3cea8c6b 100644 --- a/kitty/layout/tall.py +++ b/kitty/layout/tall.py @@ -3,7 +3,7 @@ # License: GPLv3 Copyright: 2020, Kovid Goyal from itertools import islice, repeat -from typing import Dict, Generator, List, Tuple +from typing import Dict, Generator, List, Optional, Sequence, Tuple from kitty.conf.utils import to_bool from kitty.typing import EdgeLiteral, WindowType @@ -209,6 +209,15 @@ class Tall(Layout): else: yield self.only_between_border + def layout_action(self, action_name: str, args: Sequence[str], all_windows: WindowList) -> Optional[bool]: + if action_name == 'increase_num_full_size_windows': + self.layout_opts.full_size += 1 + return True + if action_name == 'decrease_num_full_size_windows': + if self.layout_opts.full_size > 1: + self.layout_opts.full_size -= 1 + return True + class Fat(Tall):