Fix tags crash with preview hidden; Ctrl+B toggles the sidebar

This commit is contained in:
sarah committed 2026-09-24 23:23:07 +02:00
1 parent 4c8d272719
commit 3cb1f416fb
5 files changed
+45 -7

No files matched your search

+14
View File
@@ -101,6 +101,19 @@ def _BuildWindow(Config, StartPath: Path, **BrowserHooks) -> tuple[ft.Row, Brows
SidebarView = None
return Layout
def OnToggleSidebar() -> None:
# Ctrl+B. Hides the existing sidebar instead of rebuilding it, so its
# Devices panel keeps its udisks2 connection instead of opening a new one.
Config.ShowSidebar = not Config.ShowSidebar
Config.Save()
if SidebarView is None:
OnSidebarSettingsChanged() # it didn't exist yet (started hidden)
return
SidebarView.visible = Config.ShowSidebar
SidebarView.update()
if Config.ShowSidebar:
SidebarView.UpdateSelection(BrowserView.CurrentPath)
def OnSidebarSettingsChanged() -> None:
# Sidebar's presence/side/width and its sections aren't owned by
# Browser, so rebuilding it lives here rather than needing a restart.
@@ -115,6 +128,7 @@ def _BuildWindow(Config, StartPath: Path, **BrowserHooks) -> tuple[ft.Row, Brows
OnPathChanged=OnPathChanged,
OnBookmarksChanged=OnBookmarksChanged,
OnSidebarSettingsChanged=OnSidebarSettingsChanged,
OnToggleSidebar=OnToggleSidebar,
**BrowserHooks,
)
OuterRow.controls = BuildOuterLayout()