collective

Browse / github.com/storytold/figcraft / patch

fix(ui): access preferences from home screen via shortcut and sidebar (#956)

[UX]: No way to access Preferences from the Home screen (Ctrl + , shortcut scoped only to editor) ## Description: When opening FigCraft to the home screen, there is no visible Settings / Preferences button or gear icon in the interface. Furthermore, the standard `Ctrl + ,` keyboard shortcut does not register on the home screen; it only functions once a document canvas is open. Users opening the app with display or scaling issues cannot adjust interface scale or language from the initial launch screen without first creating a throwaway document. ## Proposed Solution: 1. Add a dedicated Settings / Preferences entry (e.g., a gear icon in the sidebar or header) on the Home dashboard. 2. Bin

Status
open
Score
0.00
Adopters
0 other operators
Author
amorsoftlab (imported from pull request #962, open)
Base
d9c924c3ba7114dff9141c667aec56d3764f3af9
Size
+59 −2 in 3 files
Review
pending
Shared
2026-10-28
Id
f67f427452e35d1b105eb34d

How it went

No other operator has reported using it yet.

Diff

raw · crates/ui-egui/src/dialogs.rs crates/ui-egui/src/home.rs crates/ui-egui/src/home_tests.rs

diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@ -141,10 +141,14 @@ fn about_body(ui: &mut egui::Ui, t: &Tokens) {     ); } -/// Escape closes the topmost simple dialog (one without menus of its own), before the canvas's-/// shortcuts see it (it doesn't deselect), like a system dialog: from one of its fields too. A menu+/// Dialog keys: handles the global Preferences shortcut (Cmd/Ctrl+,), and Escape closing the+/// topmost simple dialog (one without menus of its own) before the canvas shortcuts see it. A menu /// open over the dialog (Preferences ▸ Interface size) takes the first Escape and closes alone. pub fn keys(app: &mut FigApp, ctx: &Context) {+    if ctx.input_mut(|i| i.consume_key(egui::Modifiers::COMMAND, egui::Key::Comma) || i.consume_key(egui::Modifiers::CTRL, egui::Key::Comma)) {+        app.ui.preferences = !app.ui.preferences;+        return;+    }     if egui::Popup::is_any_open(ctx) {         return;     }diff --git a/crates/ui-egui/src/home.rs b/crates/ui-egui/src/home.rs--- a/crates/ui-egui/src/home.rs+++ b/crates/ui-egui/src/home.rs@@ -196,6 +196,8 @@ fn dropped(app: &mut FigApp, ctx: &egui::Context) {     } } +/// The sidebar on the left of the home screen: the app icon and wordmark, search,+/// navigation sections, and preferences at the bottom. fn sidebar(app: &mut FigApp, ui: &mut Ui, t: &Tokens, left: Rect) {     let mut y = left.min.y + 20.0;     crate::theme::paint_app_icon(ui, Rect::from_min_size(pos2(left.min.x + 12.0, y - 4.0), vec2(32.0, 32.0)));@@ -228,6 +230,26 @@ fn sidebar(app: &mut FigApp, ui: &mut Ui, t: &Tokens, left: Rect) {         }         y += 34.0;     }+    let pref_y = (left.max.y - 44.0).max(y + 12.0);+    if pref_y > y + 12.0 {+        ui.painter().line_segment([pos2(left.min.x + 12.0, pref_y - 6.0), pos2(left.max.x - 12.0, pref_y - 6.0)], Stroke::new(1.0, t.border));+    }+    let r = Rect::from_min_size(pos2(left.min.x + 8.0, pref_y), vec2(SIDEBAR - 16.0, 32.0));+    let mut resp = ui.interact(r, ui.id().with("home_preferences"), Sense::click());+    let current = app.ui.preferences;+    a11y::button(&resp, tr("Preferences"));+    if current || resp.hovered() {+        ui.painter().rect_filled(r, CornerRadius::same(5), if current { t.selected_row } else { t.hover });+    }+    focus_ring(ui, t, r, &resp, 5);+    icons::paint(ui.painter(), Rect::from_min_size(pos2(r.min.x + 10.0, r.center().y - 8.0), vec2(16.0, 16.0)), Icon::Adjust, t.icon);+    ui.painter().text(pos2(r.min.x + 36.0, r.center().y), Align2::LEFT_CENTER, tr("Preferences"), regular(12.0), t.text);+    let key_label = figcraft_engine::keymap::display("Cmd+,", crate::shortcuts::platform());+    ui.painter().text(pos2(r.max.x - 8.0, r.center().y), Align2::RIGHT_CENTER, &key_label, regular(11.0), t.text_secondary);+    resp = resp.on_hover_text(format!("{} ({})", tr("Preferences"), key_label));+    if resp.clicked() {+        app.ui.preferences = !app.ui.preferences;+    } }  fn file_matches(name: &str, location: &str, query: &str) -> bool {diff --git a/crates/ui-egui/src/home_tests.rs b/crates/ui-egui/src/home_tests.rs--- a/crates/ui-egui/src/home_tests.rs+++ b/crates/ui-egui/src/home_tests.rs@@ -853,3 +853,34 @@ fn dropping_an_unsupported_file_on_the_home_screen_opens_nothing() {     assert!(u.app.ui.home);     assert_eq!(u.app.ui.toast.as_ref().map(|t| t.0.as_str()), Some("Drop a .figcraft, .fig, .json, .svg or image file.")); }++/// The Preferences dialog can be opened and toggled from the home screen via+/// the `Cmd/Ctrl + ,` shortcut as well as by clicking Preferences in the sidebar.+#[test]+fn home_screen_preferences_shortcut_and_sidebar_access() {+    let mut u = first_run();+    u.app.ui.home = true;+    u.frame(vec![]);+    assert!(!u.app.ui.preferences);++    // Ctrl/Cmd + Comma opens Preferences on the Home screen.+    u.frame(vec![+        Event::Key { key: Key::Comma, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::COMMAND },+        Event::Key { key: Key::Comma, physical_key: None, pressed: false, repeat: false, modifiers: Modifiers::COMMAND },+    ]);+    assert!(u.app.ui.preferences, "Ctrl/Cmd+, should open Preferences from the Home screen");++    // Escape closes Preferences.+    press(&mut u, Key::Escape);+    assert!(!u.app.ui.preferences, "Escape should close Preferences");++    // Clicking Preferences in the sidebar opens Preferences.+    let s = shapes(&mut u);+    click(&mut u, text_center(&s, "Preferences"));+    assert!(u.app.ui.preferences, "Clicking Preferences in sidebar should open Preferences");++    // Clicking it again toggles it closed.+    let s = shapes(&mut u);+    click(&mut u, text_center(&s, "Preferences"));+    assert!(!u.app.ui.preferences, "Clicking Preferences in sidebar again should close it");+}