-
Notifications
You must be signed in to change notification settings - Fork 1
[PR] Added pane wide-mode #9
Description
Hi,
in addition to my previous horizontal/vertical FR I wrote a small patch called Wide-Mode.
Sometimes you need just space to overview everything. This is where Wide-Mode comes in.
Just press meta+w (ALT+W) to activate the wide-mode and the active pane becomes wide. Press TAB and the other pane becomes wide.
Press meta+w again to disable the wide-mode
I did not create a PR because this is just some lines of code. I would be glad if you could include it in one of the next releases.
`--- main.py 2023-08-24 12:57:12.000000000 +0200
+++ __main__patched.py 2023-11-03 19:38:09.910855804 +0100
@@ -234,6 +234,8 @@
self.suspend = set()
self.pending_jobs = []
self.focused_quickviewer = False
-
self.widemode = False -
self.wide = False self.bookmarks = Bookmarks(CONFIG_DIR / 'bookmarks') if 'h' not in self.bookmarks:
@@ -279,6 +281,32 @@
sys.exit(1)
-
def toggle_wide(self): -
focus_position = self.screen.center.focus_position -
center = [x[0] for x in self.screen.center.contents] -
if self.widemode: -
if self.screen.vertical: -
if self.wide: -
self.screen.center = urwid.Pile([ ('weight', 1, center[0]), ('weight', 4, center[1]) ]) -
else: -
self.screen.center = urwid.Pile([ ('weight', 4, center[0]), ('weight', 1, center[1]) ]) -
self.wide = not self.wide -
else: -
if self.wide: -
self.screen.center = urwid.Columns([ ('weight', 1, center[0]), ('weight', 4, center[1]) ]) -
else: -
self.screen.center = urwid.Columns([ ('weight', 4, center[0]), ('weight', 1, center[1]) ]) -
self.wide = not self.wide -
else: -
self.weight = False -
if self.screen.vertical: -
self.screen.center = urwid.Pile([ ('weight',1 , center[0]), ('weight', 1, center[1]) ]) -
else: -
self.screen.center = urwid.Columns([ ('weight', 1, center[0]), ('weight', 1, center[1]) ]) -
self.screen.center.focus_position = focus_position -
self.screen.pile.contents[self.screen.main_area] = (self.screen.center, self.screen.pile.options()) -
self.update_focus() -
def keypress(self, key): if self.screen.in_error: self.screen.close_dialog()
@@ -359,10 +387,12 @@
elif key == 'tab':
if self.screen.pile.focus_position == 0:
self.screen.center.focus_position = (self.screen.center.focus_position + 1) % len(self.screen.center.contents)
-
self.toggle_wide() self.update_focus() elif key == 'shift tab': if self.screen.pile.focus_position == 0: self.screen.center.focus_position = (self.screen.center.focus_position - 1) % len(self.screen.center.contents) -
self.toggle_wide() self.update_focus() elif key in ('f', '/'): self.screen.command_bar.filter()
@@ -456,6 +486,9 @@
self.screen.center.focus_position = focus_position
self.screen.pile.contents[self.screen.main_area] = (self.screen.center, self.screen.pile.options())
self.update_focus()
-
elif key == 'meta w': -
self.widemode = not self.widemode -
self.toggle_wide() elif key == 'f7': self.screen.command_bar.mkdir(self.screen.center.focus.cwd) elif key == 'c':
`