Skip to content

Commit 693c136

Browse files
committed
🐛 fix: • Improve viewer robustness and icon discovery
- Keep existing integrated-viewer app IDs stable to preserve cookies - Add safer migration for viewer storage and legacy profile cleanup - Improve favicon selection with manifest, SVG, and larger icon priority - Increase Google favicon fallback size - Fix auto-hidden headerbar reveal threshold blocking page clicks - Enable additional WebKit media settings for embedded playback - Prefer external browsers for DRM/media webapps such as YouTube Music - Stabilize env-var tests in the launcher shim - Bump app version to 4.0.1 and add AppStream release notes
1 parent 681f6d8 commit 693c136

18 files changed

Lines changed: 514 additions & 76 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ members = [
88
]
99

1010
[workspace.package]
11-
version = "4.0.0"
11+
version = "4.0.1"
1212
edition = "2021"
1313
license = "GPL-3.0-or-later"
1414
repository = "https://github.com/biglinux/biglinux-webapps"

biglinux-webapps/usr/share/metainfo/br.com.biglinux.webapps.metainfo.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,11 @@
462462
<control>touch</control>
463463
</supports>
464464
<releases>
465+
<release version="4.0.1" date="2026-05-16">
466+
<description>
467+
<p>Fixes Wayland desktop IDs and icon mapping for browser-backed webapps, preserves integrated-viewer profiles across ID migrations, improves favicon quality selection, and refines auto-hidden headerbar and media playback behavior.</p>
468+
</description>
469+
</release>
465470
<release version="4.0.0" date="2026-04-23">
466471
<description>
467472
<p>First stable release of the Rust rewrite. Replaces the previous Python/GTK3 stack with a native Rust/GTK4/libadwaita build.</p>
@@ -643,4 +648,4 @@
643648
</description>
644649
</release>
645650
</releases>
646-
</component>
651+
</component>

crates/webapps-core/src/desktop/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use crate::models::{AppMode, WebApp};
22

3-
use super::paths::desktop_file_id;
3+
use super::paths::viewer_app_id;
44
use super::sanitize::{sanitize_desktop_field, sanitize_desktop_value};
55
use super::wm_class::derive_wm_class;
66

77
pub fn generate_desktop_entry(webapp: &WebApp) -> String {
8-
let app_id = desktop_file_id(&webapp.app_url);
8+
let app_id = viewer_app_id(webapp);
99
let exec = build_exec_command(webapp, &app_id);
1010
let wm_class = sanitize_desktop_field(&derive_wm_class(webapp));
1111

crates/webapps-core/src/desktop/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub use builder::generate_desktop_entry;
88
pub use icon::{persist_icon, webapp_icons_dir};
99
pub use paths::{
1010
desktop_file_id, desktop_file_path, install_desktop_entry, legacy_host_desktop_file_id,
11-
remove_desktop_entry, remove_desktop_file, viewer_desktop_filename,
11+
remove_desktop_entry, remove_desktop_file, viewer_app_id, viewer_desktop_filename,
1212
};
1313
pub use wm_class::{canonical_browser_desktop_filename, chromium_browser_app_id};
1414

@@ -71,6 +71,13 @@ mod tests {
7171
);
7272
}
7373

74+
#[test]
75+
fn viewer_app_id_uses_persisted_desktop_filename() {
76+
let mut w = app("https://cloud.talesam.org/apps/notes", AppMode::App);
77+
w.app_file = "biglinux-webapp-cloudtalesamorg.desktop".to_string();
78+
assert_eq!(viewer_app_id(&w), "cloudtalesamorg");
79+
}
80+
7481
#[test]
7582
fn desktop_file_id_invalid_url_falls_back() {
7683
assert_eq!(desktop_file_id("not-a-url"), "webapp");

crates/webapps-core/src/desktop/paths.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ pub fn viewer_desktop_filename(url: &str) -> String {
4545
format!("biglinux-webapp-{}.desktop", desktop_file_id(url))
4646
}
4747

48+
pub fn viewer_app_id(webapp: &WebApp) -> String {
49+
webapp
50+
.desktop_file_name()
51+
.and_then(|file_name| {
52+
file_name
53+
.as_str()
54+
.strip_prefix("biglinux-webapp-")
55+
.and_then(|name| name.strip_suffix(".desktop"))
56+
.map(sanitize_id_part)
57+
})
58+
.filter(|id| !id.is_empty())
59+
.unwrap_or_else(|| desktop_file_id(&webapp.app_url))
60+
}
61+
4862
fn sanitize_id_part(value: &str) -> String {
4963
let mut result = String::with_capacity(value.len());
5064
let mut previous_was_separator = false;

crates/webapps-core/src/desktop/wm_class.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
use crate::models::{AppMode, WebApp};
22

3-
use super::paths::desktop_file_id;
3+
use super::paths::viewer_app_id;
44

55
pub(super) fn derive_wm_class(webapp: &WebApp) -> String {
66
match webapp.app_mode {
77
AppMode::App => {
88
// Must match the GTK application_id set by the viewer
9-
// (`br.com.biglinux.webapp.{desktop_file_id}`), so Wayland compositors
9+
// (`br.com.biglinux.webapp.{viewer_app_id}`), so Wayland compositors
1010
// can associate the window with this desktop entry — otherwise the
1111
// taskbar falls back to displaying the raw app_id and a generic icon.
12-
format!(
13-
"br.com.biglinux.webapp.{}",
14-
desktop_file_id(&webapp.app_url)
15-
)
12+
format!("br.com.biglinux.webapp.{}", viewer_app_id(webapp))
1613
}
1714
// Chromium-family browsers (Brave/Chrome/Edge/Vivaldi/Chromium) ignore
1815
// `--class` when picking the xdg-shell `app_id` on Wayland — they

crates/webapps-exec/src/wayland.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ fn release_lock(fd: i32, path: &str) {
131131
#[cfg(test)]
132132
mod tests {
133133
use super::*;
134+
use std::sync::Mutex;
135+
136+
static ENV_GUARD: Mutex<()> = Mutex::new(());
134137

135138
#[test]
136139
fn original_desktop_name_strips_big_webapp_suffix() {
@@ -156,20 +159,28 @@ mod tests {
156159

157160
#[test]
158161
fn swap_settle_falls_back_to_default_when_env_missing() {
159-
// Use a serial guard via a unique env name so other tests don't interfere.
162+
let _guard = ENV_GUARD
163+
.lock()
164+
.unwrap_or_else(|poisoned| poisoned.into_inner());
160165
std::env::remove_var(ENV_SWAP_SETTLE_MS);
161166
assert_eq!(swap_settle(), Duration::from_millis(DEFAULT_SWAP_SETTLE_MS));
162167
}
163168

164169
#[test]
165170
fn swap_settle_honours_env_override() {
171+
let _guard = ENV_GUARD
172+
.lock()
173+
.unwrap_or_else(|poisoned| poisoned.into_inner());
166174
std::env::set_var(ENV_SWAP_SETTLE_MS, "1234");
167175
assert_eq!(swap_settle(), Duration::from_millis(1234));
168176
std::env::remove_var(ENV_SWAP_SETTLE_MS);
169177
}
170178

171179
#[test]
172180
fn swap_settle_ignores_non_numeric_env() {
181+
let _guard = ENV_GUARD
182+
.lock()
183+
.unwrap_or_else(|poisoned| poisoned.into_inner());
173184
std::env::set_var(ENV_SWAP_SETTLE_MS, "not-a-number");
174185
assert_eq!(swap_settle(), Duration::from_millis(DEFAULT_SWAP_SETTLE_MS));
175186
std::env::remove_var(ENV_SWAP_SETTLE_MS);

0 commit comments

Comments
 (0)