Move the header controls to the left

Put the hamburger menu first, then the identity switcher, then the vault's
lock button, all packed into the start box. Nothing packs into the end box
anymore, so the right side of the bar is empty and the Apps/Activity title
stays centred.
This commit is contained in:
raucao committed 2026-11-25 16:35:38 +04:00
1 parent f52933c442
commit 64b36b1ccb
2 files changed
+22 -21

No files matched your search

+3 -3
View File
@@ -542,9 +542,9 @@ UI lives in `data/resources/ui/*.blp` (Blueprint) and is compiled to `.ui` by
the acceptance test now activates `app.preferences` twice over D-Bus for it.
12. `GtkHeaderBar`'s `pack_start` **appends** to the start box (left to right in
call order), but `pack_end` **prepends** to the end box — so the *first*
`pack_end` ends up rightmost. The main window is laid out
`[identity switcher] … [lock][menu]` accordingly, and the hamburger is
deliberately the last `pack_end` so it stays rightmost.
`pack_end` ends up rightmost. The main window puts every control on the left
with `pack_start`, laid out `[menu][identity switcher][lock] …` in call
order. Remember the prepend if a control is ever moved back to `pack_end`.
## Blueprint / Meson traps
+19 -18
View File
@@ -225,23 +225,12 @@ fn main_window(
.build();
header_bar.set_title_widget(Some(&switcher));
// The header, in the order the bar lays it out: `pack_start` appends to the
// start box left to right, while each `pack_end` *prepends* to the end box —
// so the first `pack_end` ends up rightmost. That gives
// [switcher] … [lock][menu].
let identity_switcher = IdentitySwitcher::new(Rc::clone(state), windows);
header_bar.pack_start(identity_switcher.button());
// The vault's lock state, next to the menu.
let lock_button = gtk::Button::builder()
.icon_name("changes-allow-symbolic")
.tooltip_text("Unlocked")
.css_classes(["flat"])
.build();
lock_button.set_action_name(Some("app.lock"));
header_bar.pack_end(&lock_button);
// The primary menu. Locking stays on the button above, so it needs no entry.
// The header controls, all on the left: `pack_start` appends to the start
// box left to right, so the order is [menu][switcher][lock] and the title
// widget stays centered. (A `pack_end` would instead *prepend* to the end
// box, so the first one ends up rightmost.)
//
// The primary menu. Locking stays on the lock button, so it needs no entry.
let menu = gio::Menu::new();
menu.append(Some("Connect an app…"), Some("app.connect"));
menu.append(Some("Manage identities…"), Some("app.identities"));
@@ -253,7 +242,19 @@ fn main_window(
.tooltip_text("Main menu")
.css_classes(["flat"])
.build();
header_bar.pack_end(&menu_button);
header_bar.pack_start(&menu_button);
let identity_switcher = IdentitySwitcher::new(Rc::clone(state), windows);
header_bar.pack_start(identity_switcher.button());
// The vault's lock state, directly behind the identity switcher.
let lock_button = gtk::Button::builder()
.icon_name("changes-allow-symbolic")
.tooltip_text("Unlocked")
.css_classes(["flat"])
.build();
lock_button.set_action_name(Some("app.lock"));
header_bar.pack_start(&lock_button);
{
let button = lock_button.clone();