From a9a9f1ac006556231afc18d343e60c31c0d96642 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 3 Aug 2022 22:45:38 +0530 Subject: [PATCH] Add a mappable action to toggle the mirrored setting for the tall and fat layouts Fixes #5344 --- docs/changelog.rst | 3 +++ docs/layouts.rst | 5 ++++- kitty/layout/tall.py | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index a4f97110c..5015efc30 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -60,6 +60,9 @@ Detailed list of changes - macOS: Fix a regression that caused switching keyboard input using Eisu and Kana keys not working (:iss:`5232`) +- Add a mappable action to toggle the mirrored setting for the tall and fat + layouts (:pull:`5344`) + - Wayland: Reduce flicker at startup by not using render frames immediately after a resize (:iss:`5235`) - Linux: Update cursor position after all key presses not just pre-edit text diff --git a/docs/layouts.rst b/docs/layouts.rst index 6a284f2cf..39ce368db 100644 --- a/docs/layouts.rst +++ b/docs/layouts.rst @@ -68,10 +68,13 @@ for the options is:: └──────────────┴───────────────┘ In addition, you can map keys to increase or decrease the number of full-height -windows, for example:: +windows, or toggle the mirrored setting, for example:: map ctrl+[ layout_action decrease_num_full_size_windows map ctrl+] layout_action increase_num_full_size_windows + map ctrl+/ layout_action mirror toggle + map ctrl+y layout_action mirror true + map ctrl+n layout_action mirror false The Fat Layout diff --git a/kitty/layout/tall.py b/kitty/layout/tall.py index f4a53031c..c92eb0293 100644 --- a/kitty/layout/tall.py +++ b/kitty/layout/tall.py @@ -203,6 +203,18 @@ class Tall(Layout): if self.layout_opts.full_size > 1: self.layout_opts.full_size -= 1 return True + if action_name == 'mirror': + action = (args or ('toggle',))[0] + ok = False + if action == 'toggle': + self.layout_opts.mirrored = not self.layout_opts.mirrored + ok = True + else: + new_val = to_bool(action) + if new_val != self.layout_opts.mirrored: + self.layout_opts.mirrored = new_val + ok = True + return ok return None def minimal_borders(self, all_windows: WindowList) -> Generator[BorderLine, None, None]: