Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [Unreleased]

### Fixed

- **Linux/X11: the WebUI no longer occupies only the lower half of the window**
(issue #83). Tauri 2.11 inserts Linux child webviews into a GTK box with
`expand=true` and ignores their requested bounds, so the 38px tab strip and
content webview split the available height. Linux now gives the strip a fixed
38px allocation and lets only the content webview expand. Other platforms are
unaffected.

## [v0.7.0] — 2026-07-18

An issue-sweep release: nine tracker items land at once — Wayland layout,
Expand Down
1 change: 1 addition & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ libc = "0.2"
# internal threads race Xlib otherwise (intermittent startup abort). dlopen
# wrapper, so Wayland-only systems without libX11 degrade gracefully.
x11-dl = "2"
# Tauri 2.11 builds Linux child webviews into the window's GtkBox and ignores
# their requested bounds. strip.rs sets per-child packing so the 38px strip
# stays fixed while the active content webview expands into the remaining area.
gtk = "0.18"

[target.'cfg(target_os = "macos")'.dependencies]
objc2 = "0.5"
Expand Down
64 changes: 61 additions & 3 deletions src-tauri/src/strip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,48 @@ use tauri::{

pub const STRIP_HEIGHT: f64 = 38.0;

#[cfg(any(test, target_os = "linux"))]
fn linux_child_packing(is_strip: bool) -> (bool, i32) {
if is_strip {
(false, STRIP_HEIGHT as i32)
} else {
(true, -1)
}
}

/// Tauri 2.11's Linux `WindowChild` path calls `build_gtk(default_vbox)`;
/// wry then packs every webview into that GtkBox with expand=true and ignores
/// the requested child bounds. With the strip and content both expanding they
/// split the window vertically — the issue #83 "gap" is an oversized strip.
/// Correct the GTK child packing directly: fixed 38px strip, expanding content.
#[cfg(target_os = "linux")]
fn apply_linux_child_packing(webview: &Webview<Wry>, is_strip: bool) {
if !linux_backend_is_x11() {
return;
}
let (expand, height) = linux_child_packing(is_strip);
if let Err(e) = webview.with_webview(move |native| {
use gtk::prelude::*;

let child = native.inner();
child.set_hexpand(true);
child.set_vexpand(expand);
child.set_size_request(-1, height);

if let Some(parent) = child
.parent()
.and_then(|widget| widget.downcast::<gtk::Box>().ok())
{
parent.set_child_packing(&child, expand, true, 0, gtk::PackType::Start);
parent.queue_resize();
} else {
log::error!("strip: Linux child webview parent is not a GtkBox");
}
}) {
log::error!("strip: failed to schedule Linux GTK child packing: {e}");
}
}

/// Convert a logical child-webview position to the unit the platform's wry
/// backend wants for `add_child` / `set_position`.
///
Expand Down Expand Up @@ -318,12 +360,17 @@ fn build_strip_window(
.inner_size()
.map(|s| s.to_logical::<f64>(scale))
.unwrap_or(LogicalSize::new(1280.0, 830.0));
if let Err(e) = win.add_child(
match win.add_child(
swb,
child_position(0.0, 0.0, scale),
child_size(logical.width, STRIP_HEIGHT, scale),
) {
log::error!("strip: strip webview failed: {e}");
Ok(strip_webview) => {
#[cfg(target_os = "linux")]
apply_linux_child_packing(&strip_webview, true);
drop(strip_webview);
}
Err(e) => log::error!("strip: strip webview failed: {e}"),
}

log::info!("strip: window {label} built, strip webview added");
Expand Down Expand Up @@ -736,6 +783,8 @@ pub(crate) fn add_tab_with(app: &AppHandle, window_label: &str, spec: TabSpec) {
return;
}
};
#[cfg(target_os = "linux")]
apply_linux_child_packing(&webview, false);

// Seed the FRESH jar, then load the real target — cookies are committed
// before the navigation request fires (set_cookie is synchronous on
Expand Down Expand Up @@ -1499,7 +1548,16 @@ pub fn forget_window(app: &AppHandle, window_label: &str) {

#[cfg(test)]
mod tests {
use super::{partition_suffix, x11_from_env};
use super::{linux_child_packing, partition_suffix, x11_from_env, STRIP_HEIGHT};

#[test]
fn linux_gtk_box_reserves_only_the_strip_height() {
// Issue #83: Tauri builds Linux child webviews into a GtkBox. If both
// children keep GTK's default expand=true, they split the window and
// produce the huge blank band. The strip is fixed; content gets rest.
assert_eq!(linux_child_packing(true), (false, STRIP_HEIGHT as i32));
assert_eq!(linux_child_packing(false), (true, -1));
}

#[test]
fn parses_partition_suffix() {
Expand Down