Skip to content
Open
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
4 changes: 4 additions & 0 deletions crates/ui/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,7 @@ pub struct UiSettings {
/// Most recently displayed sources first; bounded by the shuffle cooldown.
pub wallpaper_history: Vec<PathBuf>,
pub wallpaper_theme_colors: bool,
pub wallpaper_in_session: bool,
pub wallpaper_color: Option<zeron_theme::Color>,
/// Non-destructive treatment composited inside the artwork's fade mask.
pub new_thread_background_effect: NewThreadBackgroundEffect,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1744,6 +1746,7 @@ impl UiSettings {
wallpaper_source,
wallpaper_history,
wallpaper_theme_colors,
wallpaper_in_session,
wallpaper_color,
new_thread_background_effect,
reduce_motion,
Expand Down Expand Up @@ -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,
Expand Down
32 changes: 32 additions & 0 deletions crates/ui/src/settings/appearance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 5 additions & 3 deletions crates/ui/src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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(
Expand All @@ -11103,7 +11105,7 @@ impl Shell {
self.viewport_height,
width,
bounds,
dock_frame.dissolve(),
dissolve,
artwork_frame.mix * opacity,
))
.into_any_element()
Expand Down
Loading