forge
Explore
Log in

Don't you dare go Hollow

Ctrl+K finds every settings row (opens its section, section shown as hint) and sets font size, language, voice mode and close-to-tray directly

Browse files at this commit

cf2498f2f9c0c2f5d5f2ad18973135fa762c1921Ahmet Kaan GümüşParent: 699221c
  • feat
    • Ctrl+K finds every settings row (opens its section, section shown as hint) and sets font size, language, voice mode and close-to-tray directly
Show full message
✨ feat: Ctrl+K finds every settings row (opens its section, section shown as hint) and sets font size, language, voice mode and close-to-tray directly
crates/client/lang/en/jump.txtmodified+2 -0
@@ -17,3 +17,5 @@ new_community = New community
1717 expand_sidebar = Expand sidebar
1818 collapse_sidebar = Collapse sidebar
1919 log_out = Log out
20+on = on
21+off = off
crates/client/lang/tr/jump.txtmodified+2 -0
@@ -17,3 +17,5 @@ new_community = Yeni topluluk
1717 expand_sidebar = Kenar çubuğunu genişlet
1818 collapse_sidebar = Kenar çubuğunu daralt
1919 log_out = Çıkış yap
20+on = açık
21+off = kapalı
crates/client/src/gui/jump.rsmodified+61 -2
@@ -1,4 +1,5 @@
1-use crate::lang::{Label as _, w};
1+use crate::lang::{Label as _, Lang, w};
2+use crate::settings::{Activation, FontSize};
23 use common::model::{Community, CommunityKind, Id, Presence, User};
34 use gpui_kit::{
45 Context, Div, Entity, FontWeight, InteractiveElement, KeyDownEvent, ParentElement,
@@ -17,7 +18,8 @@ use super::{
1718 community_icon, community_name,
1819 parts::{Ink, Text, band, words},
1920 presence_avatar,
20- settings_page::{SETTINGS_IDS, settings_titles},
21+ settings_page::{SETTINGS_IDS, setting_rows, settings_titles},
22+ voice_settings::modes,
2123 style::{Theme, Tokens, my_hue, radius, size, space, stroke, text},
2224 widget::bare_input,
2325 };
@@ -31,9 +33,14 @@ pub(super) enum Place {
3133 Notes,
3234 Friends,
3335 Settings(usize),
36+ Setting(usize),
3437 Builder(BuilderTab),
3538 NewCommunity,
3639 Theme(Theme),
40+ FontSize(FontSize),
41+ Language(Lang),
42+ VoiceMode(Activation),
43+ CloseToTray,
3744 Presence(Presence),
3845 Sidebar,
3946 Mute,
@@ -90,9 +97,14 @@ impl Place {
9097 Place::Notes => "notes".into(),
9198 Place::Friends => "friends".into(),
9299 Place::Settings(index) => format!("settings:{}", SETTINGS_IDS[index]),
100+ Place::Setting(index) => format!("setting:{index}"),
93101 Place::Builder(tab) => format!("builder:{}", tab.id()),
94102 Place::NewCommunity => "new_community".into(),
95103 Place::Theme(theme) => format!("theme:{}", theme.as_str()),
104+ Place::FontSize(size) => format!("font_size:{}", size.as_str()),
105+ Place::Language(lang) => format!("language:{}", lang.as_str()),
106+ Place::VoiceMode(mode) => format!("voice_mode:{}", mode.as_str()),
107+ Place::CloseToTray => "close_to_tray".into(),
96108 Place::Presence(presence) => format!("presence:{}", presence.as_str()),
97109 Place::Sidebar => "sidebar".into(),
98110 Place::Mute => "mute".into(),
@@ -184,6 +196,19 @@ impl Yumush {
184196 .hinted(w().jump.hint_settings)
185197 }),
186198 )
199+ .chain(
200+ setting_rows()
201+ .into_iter()
202+ .enumerate()
203+ .map(|(index, (section, label))| {
204+ Row::new(
205+ Place::Setting(index),
206+ label.to_string(),
207+ Glyph::Icon(IconName::Settings2),
208+ )
209+ .hinted(settings_titles()[section])
210+ }),
211+ )
187212 .chain(
188213 BuilderTab::ALL
189214 .into_iter()
@@ -274,6 +299,32 @@ impl Yumush {
274299 )
275300 .hinted(w().jump.hint_theme)
276301 }))
302+ .chain(FontSize::ALL.into_iter().map(|size| {
303+ Row::new(Place::FontSize(size), size.label(), Glyph::Icon(IconName::Type))
304+ .hinted(w().settings_page.font_size)
305+ }))
306+ .chain(Lang::ALL.into_iter().map(|lang| {
307+ Row::new(
308+ Place::Language(lang),
309+ lang.words().common.language,
310+ Glyph::Icon(IconName::MessageSquare),
311+ )
312+ .hinted(w().settings_page.language)
313+ }))
314+ .chain(modes().into_iter().map(|(mode, label)| {
315+ Row::new(Place::VoiceMode(mode), label, Glyph::Icon(IconName::Mic))
316+ .hinted(w().voice_settings.mode)
317+ }))
318+ .chain([Row::new(
319+ Place::CloseToTray,
320+ w().settings_page.close_to_tray,
321+ Glyph::Icon(IconName::Minimize),
322+ )
323+ .hinted(if self.settings.close_to_tray {
324+ w().jump.on
325+ } else {
326+ w().jump.off
327+ })])
277328 .chain(Presence::ALL.into_iter().map(|presence| {
278329 Row::new(
279330 Place::Presence(presence),
@@ -361,12 +412,20 @@ impl Yumush {
361412 self.show_view(View::Settings, window, cx);
362413 self.chat.section = index;
363414 }
415+ Place::Setting(index) => {
416+ self.show_view(View::Settings, window, cx);
417+ self.chat.section = setting_rows()[index].0;
418+ }
364419 Place::Builder(tab) => {
365420 self.show_view(View::Builder, window, cx);
366421 self.select_builder_tab(tab, window, cx);
367422 }
368423 Place::NewCommunity => self.new_community(window, cx),
369424 Place::Theme(theme) => self.set_theme(theme, cx),
425+ Place::FontSize(size) => self.set_font_size(size, cx),
426+ Place::Language(lang) => self.set_language(lang, cx),
427+ Place::VoiceMode(mode) => self.set_voice_mode(mode, cx),
428+ Place::CloseToTray => self.toggle_close_to_tray(cx),
370429 Place::Presence(presence) => self.set_presence(presence, window, cx),
371430 Place::Sidebar => self.toggle_sidebar(),
372431 Place::Mute => self.toggle_mute(window, cx),
crates/client/src/gui/settings_page.rsmodified+36 -6
@@ -36,6 +36,36 @@ pub(super) fn settings_titles() -> [&'static str; 4] {
3636 [w.profile, w.voice, w.camera_share, w.appearance]
3737 }
3838
39+pub(super) fn setting_rows() -> [(usize, &'static str); 23] {
40+ let s = &w().settings_page;
41+ let v = &w().voice_settings;
42+ [
43+ (0, s.name),
44+ (0, s.status),
45+ (0, s.presence),
46+ (0, s.change_picture),
47+ (0, s.delete_account),
48+ (1, v.input_device),
49+ (1, v.output_device),
50+ (1, v.input_volume),
51+ (1, v.output_volume),
52+ (1, v.mode),
53+ (1, v.hear_yourself),
54+ (1, v.play_sound),
55+ (1, v.sensitivity),
56+ (1, v.key),
57+ (2, s.camera),
58+ (2, s.screen_share),
59+ (2, s.codec),
60+ (2, s.share_audio),
61+ (3, s.theme),
62+ (3, s.font_size),
63+ (3, s.language),
64+ (3, s.close_to_tray),
65+ (3, s.your_hue),
66+ ]
67+}
68+
3969 impl Yumush {
4070 pub(super) fn settings_page(
4171 &self,
@@ -169,12 +199,7 @@ impl Yumush {
169199 palette.tokens,
170200 {
171201 let entity = entity.clone();
172- move |_, cx| {
173- entity.update(cx, |yumush, cx| {
174- yumush.settings.close_to_tray = !yumush.settings.close_to_tray;
175- yumush.commit_settings(cx);
176- })
177- }
202+ move |_, cx| entity.update(cx, |yumush, cx| yumush.toggle_close_to_tray(cx))
178203 },
179204 ),
180205 ),
@@ -346,6 +371,11 @@ impl Yumush {
346371 cx.refresh_windows();
347372 }
348373
374+ pub(super) fn toggle_close_to_tray(&mut self, cx: &mut Context<Self>) {
375+ self.settings.close_to_tray = !self.settings.close_to_tray;
376+ self.commit_settings(cx);
377+ }
378+
349379 pub(super) fn commit_settings(&mut self, cx: &mut Context<Self>) {
350380 settings::save(&self.settings);
351381 self.network.set_voice_settings(&self.settings.voice);
crates/client/src/gui/voice_settings.rsmodified+1 -1
@@ -28,7 +28,7 @@ use crate::{
2828 };
2929
3030 const LEVEL_INTERVAL: Duration = Duration::from_millis(50);
31-fn modes() -> [(Activation, &'static str); 2] {
31+pub(super) fn modes() -> [(Activation, &'static str); 2] {
3232 [
3333 (Activation::VoiceActivity, w().voice_settings.voice_activity),
3434 (Activation::PushToTalk, w().voice_settings.push_to_talk),