From ce88fa74677d9ec74a66a917bea8d8b6c67c5b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 27 Nov 2026 19:01:19 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20line=20toggles=20replace=20?= =?UTF-8?q?switches;=20sliders=20in=20paper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/gui.rs | 2 ++ crates/client/src/gui/builder.rs | 6 ++---- crates/client/src/gui/settings_page.rs | 18 ++++++++++-------- crates/client/src/gui/share_view.rs | 15 ++++++++------- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/crates/client/src/gui.rs b/crates/client/src/gui.rs index 37a89ed..61e0fa6 100644 --- a/crates/client/src/gui.rs +++ b/crates/client/src/gui.rs @@ -190,6 +190,8 @@ pub fn sync_theme(cx: &mut App) { colors.ring = palette.accent; colors.caret = palette.accent; colors.danger = palette.danger; + colors.slider_bar = palette.text; + colors.slider_thumb = palette.text; theme.tokens = (&theme.colors).into(); theme.radius = px(radius::SM); theme.radius_lg = px(radius::LG); diff --git a/crates/client/src/gui/builder.rs b/crates/client/src/gui/builder.rs index 594a15f..75d362c 100644 --- a/crates/client/src/gui/builder.rs +++ b/crates/client/src/gui/builder.rs @@ -23,7 +23,7 @@ use gpui_kit::{ AnyElement, App, Context, Div, Entity, InteractiveElement, IntoElement, ParentElement, StatefulInteractiveElement, Styled, Window, assets::IconName, - component::{Icon, input::InputState, switch::Switch}, + component::{Icon, input::InputState}, div, prelude::FluentBuilder as _, px, @@ -293,9 +293,7 @@ impl Yumush { .text_color(palette.muted) .child("Ghost") .child( - Switch::new("ghost_switch") - .checked(enabled) - .on_change(move |_, window, cx| toggle(window, cx)), + super::parts::toggle("ghost_switch", enabled, palette.tokens, toggle), ) } diff --git a/crates/client/src/gui/settings_page.rs b/crates/client/src/gui/settings_page.rs index a32ab2e..33e92f4 100644 --- a/crates/client/src/gui/settings_page.rs +++ b/crates/client/src/gui/settings_page.rs @@ -10,7 +10,7 @@ use gpui_kit::{ InteractiveElement, IntoElement, ParentElement, PathPromptOptions, Stateful, StatefulInteractiveElement, Styled, WeakEntity, Window, assets::IconName, - component::{input::InputState, switch::Switch}, + component::input::InputState, div, prelude::FluentBuilder as _, px, transparent_black, @@ -117,18 +117,20 @@ impl Yumush { ), row( "Close to tray", - Switch::new("close_to_tray_switch") - .checked(self.settings.close_to_tray) - .on_change({ + super::parts::toggle( + "close_to_tray_switch", + self.settings.close_to_tray, + palette.tokens, + { let entity = entity.clone(); - move |checked, _, cx| { - let checked = *checked; + move |_, cx| { entity.update(cx, |yumush, cx| { - yumush.settings.close_to_tray = checked; + yumush.settings.close_to_tray = !yumush.settings.close_to_tray; yumush.commit_settings(cx); }) } - }), + }, + ), ), ], ) diff --git a/crates/client/src/gui/share_view.rs b/crates/client/src/gui/share_view.rs index a06749c..f1b302d 100644 --- a/crates/client/src/gui/share_view.rs +++ b/crates/client/src/gui/share_view.rs @@ -23,7 +23,6 @@ use gpui_kit::{ Icon, popover::Popover, slider::{Slider, SliderEvent, SliderState}, - switch::Switch, }, div, prelude::FluentBuilder as _, @@ -950,14 +949,16 @@ fn include_row( row_style(div()).child(name_cell(app, palette)).child( div().flex_shrink_0().child( - Switch::new(format!("share_app_{}", app.key())) - .checked(included) - .on_change(move |checked, _, cx| { - let included = *checked; + super::parts::toggle( + gpui_kit::ElementId::Name(format!("share_app_{}", app.key()).into()), + included, + palette.tokens, + move |_, cx| { entity.update(cx, |yumush, cx| { - yumush.set_share_included(&target, included, cx) + yumush.set_share_included(&target, !included, cx) }); - }), + }, + ), ), ) }