Maximize header space and enable tab scrolling

Remove application title from main header bar and wrap tabs in scrollable container. This prevents window resizing when many tabs are open and follows modern GNOME app patterns.
This commit is contained in:
vesp 2025-12-23 12:36:59 +01:00
parent 6031f4319d
commit 98e097a7c1
2 changed files with 14 additions and 6 deletions

View File

@ -4,7 +4,6 @@
<requires lib="Adw" version="1.0"/>
<template class="RosterWindow" parent="AdwApplicationWindow">
<property name="title">Roster</property>
<property name="default-width">1200</property>
<property name="default-height">800</property>
<property name="content">
@ -96,12 +95,20 @@
<!-- Main Header Bar -->
<child>
<object class="AdwHeaderBar">
<!-- Tab bar container on the left (hidden when only 1 tab) -->
<property name="show-title">False</property>
<!-- Tab bar in scrollable container (hidden when only 1 tab) -->
<child type="start">
<object class="GtkBox" id="tab_bar_container">
<property name="orientation">horizontal</property>
<property name="spacing">0</property>
<object class="GtkScrolledWindow" id="tab_bar_scroll">
<property name="hscrollbar-policy">automatic</property>
<property name="vscrollbar-policy">never</property>
<property name="propagate-natural-width">true</property>
<property name="visible">False</property>
<child>
<object class="GtkBox" id="tab_bar_container">
<property name="orientation">horizontal</property>
<property name="spacing">0</property>
</object>
</child>
</object>
</child>

View File

@ -44,6 +44,7 @@ class RosterWindow(Adw.ApplicationWindow):
url_entry = Gtk.Template.Child()
send_button = Gtk.Template.Child()
new_request_button = Gtk.Template.Child()
tab_bar_scroll = Gtk.Template.Child()
tab_bar_container = Gtk.Template.Child()
# Panes
@ -426,7 +427,7 @@ class RosterWindow(Adw.ApplicationWindow):
"""Show/hide tab bar based on number of tabs."""
num_tabs = len(self.tab_manager.tabs)
# Show tab bar only if we have 2 or more tabs
self.tab_bar_container.set_visible(num_tabs >= 2)
self.tab_bar_scroll.set_visible(num_tabs >= 2)
# Update tab bar with buttons
if num_tabs >= 2: