From 2093c54f1867960202788d1793c7b6dcfd19fbbb Mon Sep 17 00:00:00 2001 From: sedax90 <5001801+sedax90@users.noreply.github.com> Date: Sun, 8 Nov 2026 13:23:06 +0100 Subject: [PATCH 1/3] feat(linux-workspace): keep the sidebar toggle in the header while the sidebar shows --- .../app/src/ui/workspace/tests/shell.rs | 8 +++++-- .../app/src/ui/workspace/workspace_shell.rs | 22 ------------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/linux/crates/app/src/ui/workspace/tests/shell.rs b/linux/crates/app/src/ui/workspace/tests/shell.rs index b264b074a4..032db9d375 100644 --- a/linux/crates/app/src/ui/workspace/tests/shell.rs +++ b/linux/crates/app/src/ui/workspace/tests/shell.rs @@ -173,8 +173,10 @@ fn show_tabs_opens_and_closes_the_overview_while_a_tab_is_open() { assert!(enabled("switch-recent-tab")); } +/// The toggle is always in the header, beside a sidebar in view too, as +/// the macOS window's is, so the sidebar collapses from it. #[gtk4::test] -fn sidebar_toggle_visible_only_when_collapsed_or_hidden() { +fn the_sidebar_toggle_is_always_in_the_header() { let test = TestWindow::connected("SidebarToggle"); let workspace = test.workspace(); let shell = shell_of(&workspace); @@ -182,10 +184,12 @@ fn sidebar_toggle_visible_only_when_collapsed_or_hidden() { let (split, toggle) = (imp.split_view.get(), imp.sidebar_toggle.get()); split.set_collapsed(false); split.set_show_sidebar(true); - assert!(!toggle.is_visible(), "shown beside a sidebar in view"); + assert!(toggle.is_visible(), "missing beside a sidebar in view"); + assert!(toggle.is_active(), "it does not show the sidebar is in view"); split.set_show_sidebar(false); assert!(toggle.is_visible(), "hidden with the sidebar hidden"); + assert!(!toggle.is_active()); split.set_show_sidebar(true); split.set_collapsed(true); diff --git a/linux/crates/app/src/ui/workspace/workspace_shell.rs b/linux/crates/app/src/ui/workspace/workspace_shell.rs index 25eb2ae449..e0e37cd61a 100644 --- a/linux/crates/app/src/ui/workspace/workspace_shell.rs +++ b/linux/crates/app/src/ui/workspace/workspace_shell.rs @@ -110,7 +110,6 @@ impl WorkspaceShell { &imp.split_view.get(), "show-sidebar", )); - follow_sidebar(&imp.split_view, &imp.sidebar_toggle); window.add_action(&assistant_action(&shell)); imp.walk_hooks.replace(Some(shell.hook_recent_walk(window))); @@ -778,27 +777,6 @@ fn with_safe_mode(menu: &gio::MenuModel) -> gio::Menu { whole } -/// The toggle shows only while the sidebar is out of view: collapsed -/// into an overlay, or hidden. Beside a shown sidebar it would only hide -/// the list the user is looking at. -fn follow_sidebar(split_view: &adw::OverlaySplitView, toggle: >k::ToggleButton) -> gtk::ExpressionWatch { - let collapsed = gtk::PropertyExpression::new( - adw::OverlaySplitView::static_type(), - None::<>k::Expression>, - "collapsed", - ); - let shown = gtk::PropertyExpression::new( - adw::OverlaySplitView::static_type(), - None::<>k::Expression>, - "show-sidebar", - ); - let visible = gtk::ClosureExpression::new::( - [collapsed, shown], - glib::closure!(|_: Option, collapsed: bool, shown: bool| collapsed || !shown), - ); - visible.bind(toggle, "visible", Some(split_view)) -} - #[cfg(test)] mod tests { use super::*; From 0766b034839f5f19a75fd92859a605f481765e97 Mon Sep 17 00:00:00 2001 From: sedax90 <5001801+sedax90@users.noreply.github.com> Date: Sun, 8 Nov 2026 13:24:08 +0100 Subject: [PATCH 2/3] docs(linux-workspace): add the changelog entry --- linux/changelog.d/4117.added.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 linux/changelog.d/4117.added.md diff --git a/linux/changelog.d/4117.added.md b/linux/changelog.d/4117.added.md new file mode 100644 index 0000000000..d42214e84c --- /dev/null +++ b/linux/changelog.d/4117.added.md @@ -0,0 +1 @@ +The sidebar toggle stays in the header while the sidebar shows, so it collapses from there. From 8080db43efc68efb3f9ca1ca9c9fc8e63c8924ea Mon Sep 17 00:00:00 2001 From: Ngo Quoc Dat Date: Sun, 8 Nov 2026 23:30:35 +0700 Subject: [PATCH 3/3] test(linux-workspace): cover sidebar toggle state and activation --- .../app/src/ui/workspace/tests/shell.rs | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/linux/crates/app/src/ui/workspace/tests/shell.rs b/linux/crates/app/src/ui/workspace/tests/shell.rs index 032db9d375..40eb4cb9ca 100644 --- a/linux/crates/app/src/ui/workspace/tests/shell.rs +++ b/linux/crates/app/src/ui/workspace/tests/shell.rs @@ -173,8 +173,6 @@ fn show_tabs_opens_and_closes_the_overview_while_a_tab_is_open() { assert!(enabled("switch-recent-tab")); } -/// The toggle is always in the header, beside a sidebar in view too, as -/// the macOS window's is, so the sidebar collapses from it. #[gtk4::test] fn the_sidebar_toggle_is_always_in_the_header() { let test = TestWindow::connected("SidebarToggle"); @@ -182,19 +180,30 @@ fn the_sidebar_toggle_is_always_in_the_header() { let shell = shell_of(&workspace); let imp = shell.imp(); let (split, toggle) = (imp.split_view.get(), imp.sidebar_toggle.get()); - split.set_collapsed(false); - split.set_show_sidebar(true); - assert!(toggle.is_visible(), "missing beside a sidebar in view"); - assert!(toggle.is_active(), "it does not show the sidebar is in view"); - - split.set_show_sidebar(false); - assert!(toggle.is_visible(), "hidden with the sidebar hidden"); - assert!(!toggle.is_active()); - - split.set_show_sidebar(true); - split.set_collapsed(true); - assert!(toggle.is_visible(), "hidden with the sidebar collapsed"); + crate::test_support::assert_labelled(&toggle).expect("the sidebar toggle is named"); + assert_eq!(toggle.tooltip_text().as_deref(), Some("Show Sidebar")); assert_eq!(toggle.action_name().as_deref(), Some("win.show-sidebar")); + + for collapsed in [false, true] { + split.set_collapsed(collapsed); + split.set_show_sidebar(true); + assert!(toggle.is_visible()); + assert!(toggle.is_active()); + + toggle.emit_clicked(); + assert!(!split.shows_sidebar()); + assert!(!toggle.is_active()); + assert!(toggle.is_visible()); + + toggle.emit_clicked(); + assert!(split.shows_sidebar()); + assert!(toggle.is_active()); + + WidgetExt::activate_action(&test.window, "win.show-sidebar", None).expect("win.show-sidebar"); + assert!(!split.shows_sidebar()); + assert!(!toggle.is_active()); + assert!(toggle.is_visible()); + } } #[gtk4::test]