kitty @ ls: Also report layout options

This commit is contained in:
Kovid Goyal 2021-10-21 13:44:06 +05:30
parent 6546c1da9b
commit 4fd76b09d9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 13 additions and 0 deletions

View File

@ -28,6 +28,9 @@ class LayoutOpts:
def __init__(self, data: Dict[str, str]):
pass
def serialized(self) -> Dict[str, Any]:
return {}
class LayoutData(NamedTuple):
content_pos: int = 0

View File

@ -388,6 +388,9 @@ class SplitsLayoutOpts(LayoutOpts):
def __init__(self, data: Dict[str, str]):
self.default_axis_is_horizontal = data.get('split_axis', 'horizontal') == 'horizontal'
def serialized(self) -> Dict[str, Any]:
return {'default_axis_is_horizontal': self.default_axis_is_horizontal}
class Splits(Layout):
name = 'splits'

View File

@ -72,6 +72,9 @@ class TallLayoutOpts(LayoutOpts):
self.bias = tuple(repeat(b / fs, fs)) + (1.0 - b,)
self.mirrored = to_bool(data.get('mirrored', 'false'))
def serialized(self) -> Dict[str, Any]:
return {'full_size': self.full_size, 'bias': self.bias, 'mirrored': self.mirrored}
class Tall(Layout):

View File

@ -38,6 +38,7 @@ class TabDict(TypedDict):
title: str
layout: str
layout_state: Dict[str, Any]
layout_opts: Dict[str, Any]
windows: List[WindowDict]
active_window_history: List[int]
@ -169,6 +170,8 @@ class Tab: # {{{
'window_list': self.windows.serialize_state(),
'current_layout': self._current_layout_name,
'last_used_layout': self._last_used_layout,
'layout_opts': self.current_layout.layout_opts,
'layout_state': self.current_layout.layout_state,
'name': self.name,
}
@ -813,6 +816,7 @@ class TabManager: # {{{
'title': tab.name or tab.title,
'layout': str(tab.current_layout.name),
'layout_state': tab.current_layout.layout_state(),
'layout_opts': tab.current_layout.layout_opts.serialized(),
'windows': list(tab.list_windows(active_window, self_window)),
'active_window_history': list(tab.windows.active_window_history),
}