mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 18:51:41 +02:00
Add resize_window configuration action
This patch adds the `resize_window` configuration action, which has the
following arguments:
1. Quality of resize amongst `wider`, `narrower`, `taller`, and
`shorter` (mandatory).
2. Increment in number of cells (optional, default: 1).
This makes it possible to configure keys as such:
map ctrl+shift+left resize_window narrower
map ctrl+shift+right resize_window wider
map ctrl+shift+up resize_window taller
map ctrl+shift+down resize_window shorter
and have a behaviour which is somewhat close to Terminator's.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
This commit is contained in:
@@ -199,6 +199,24 @@ class Tab: # {{{
|
||||
return
|
||||
return 'Could not resize'
|
||||
|
||||
def resize_window(self, quality, increment):
|
||||
if increment < 1:
|
||||
raise ValueError(increment)
|
||||
if quality == 'taller':
|
||||
is_horizontal = False
|
||||
elif quality == 'shorter':
|
||||
is_horizontal = False
|
||||
increment *= -1
|
||||
elif quality == 'wider':
|
||||
is_horizontal = True
|
||||
elif quality == 'narrower':
|
||||
is_horizontal = True
|
||||
increment *= -1
|
||||
else:
|
||||
raise ValueError(quality)
|
||||
self.resize_window_by(self.windows[self.active_window_idx].id,
|
||||
increment, is_horizontal)
|
||||
|
||||
def reset_window_sizes(self):
|
||||
if self.current_layout.remove_all_biases():
|
||||
self.relayout()
|
||||
|
||||
Reference in New Issue
Block a user