diff --git a/crates/ui/src/settings.rs b/crates/ui/src/settings.rs index 643ac40dc7..fc7ec5c1a1 100644 --- a/crates/ui/src/settings.rs +++ b/crates/ui/src/settings.rs @@ -997,6 +997,7 @@ pub struct UiSettings { /// Most recently displayed sources first; bounded by the shuffle cooldown. pub wallpaper_history: Vec, pub wallpaper_theme_colors: bool, + pub wallpaper_in_session: bool, pub wallpaper_color: Option, /// Non-destructive treatment composited inside the artwork's fade mask. pub new_thread_background_effect: NewThreadBackgroundEffect, @@ -1100,6 +1101,7 @@ impl Default for UiSettings { wallpaper_source: None, wallpaper_history: Vec::new(), wallpaper_theme_colors: false, + wallpaper_in_session: false, wallpaper_color: None, new_thread_background_effect: NewThreadBackgroundEffect::None, reduce_motion: crate::motion::ReduceMotion::System, @@ -1744,6 +1746,7 @@ impl UiSettings { wallpaper_source, wallpaper_history, wallpaper_theme_colors, + wallpaper_in_session, wallpaper_color, new_thread_background_effect, reduce_motion, @@ -2833,6 +2836,7 @@ mod tests { wallpaper_source: Some("/tmp/wallpapers/background.png".into()), wallpaper_history: vec!["/tmp/wallpapers/background.png".into()], wallpaper_theme_colors: false, + wallpaper_in_session: false, wallpaper_color: None, new_thread_background_effect: NewThreadBackgroundEffect::Ascii, reduce_motion: crate::motion::ReduceMotion::On, diff --git a/crates/ui/src/settings/appearance.rs b/crates/ui/src/settings/appearance.rs index 967cb173b2..1d50bc709a 100644 --- a/crates/ui/src/settings/appearance.rs +++ b/crates/ui/src/settings/appearance.rs @@ -3734,6 +3734,38 @@ impl Render for AppearancePage { ) .into_any_element(), ); + let keep_wallpaper = wallpaper_settings.wallpaper_in_session; + settings_rows.push( + widgets::card_row(&theme, false) + .child( + div() + .flex_1() + .min_w_0() + .child(widgets::row_title(&theme, "Show wallpaper in sessions")) + .child(widgets::meta_line( + &theme, + vec![div().child("Keep the wallpaper visible during conversations.").into_any_element()], + )), + ) + .child( + widgets::toggle_switch(&theme, keep_wallpaper, "wallpaper-in-session") + .id("wallpaper-in-session-toggle") + .tab_index(0) + .role(gpui::Role::Switch) + .aria_label("Show wallpaper in sessions") + .focus_visible(|s| s.border_2().border_color(theme.accent)) + .cursor_pointer() + .aria_toggled(if keep_wallpaper { gpui::Toggled::True } else { gpui::Toggled::False }) + .on_click(cx.listener(move |_, _, _, cx| { + crate::settings::update(crate::settings::SavePolicy::Immediate, cx, |settings| { + settings.wallpaper_in_session = !keep_wallpaper; + }); + cx.refresh_windows(); + cx.notify(); + })), + ) + .into_any_element(), + ); if background_available { use crate::settings::NewThreadBackgroundEffect; let effect_control = widgets::select( diff --git a/crates/ui/src/shell.rs b/crates/ui/src/shell.rs index 07ca494117..9e873f9616 100644 --- a/crates/ui/src/shell.rs +++ b/crates/ui/src/shell.rs @@ -11078,13 +11078,15 @@ impl Shell { ), ))); let term_h = self.terminal_geometry.get().height; - let new_thread_background_layer = (!has_selection || dock_frame.active).then(|| { + let keep_wallpaper = ui_settings.wallpaper_in_session; + let new_thread_background_layer = (!has_selection || dock_frame.active || keep_wallpaper).then(|| { if artwork_frame.active { window.request_animation_frame(); } let width = (self.viewport_width - self.sidebar_now()).max(0.0); let bounds = self.composer.read(cx).surface_bounds(); let opacity = new_thread_background_opacity(theme.is_frost()); + let dissolve = if keep_wallpaper { 0.0 } else { dock_frame.dissolve() }; div() .absolute() .inset_0() @@ -11094,7 +11096,7 @@ impl Shell { self.viewport_height, width, bounds.clone(), - dock_frame.dissolve(), + dissolve, (1.0 - artwork_frame.mix) * opacity, )) .child(new_thread_background( @@ -11103,7 +11105,7 @@ impl Shell { self.viewport_height, width, bounds, - dock_frame.dissolve(), + dissolve, artwork_frame.mix * opacity, )) .into_any_element()