Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Preferences on Cmd+K, Search on Cmd+F (Photoshop's defaults) (#1900)

texjere8b992a6f01f
diff --git a/README.md b/README.md
index 3dd367c35..b61db5470 100644
--- a/README.md
+++ b/README.md
@@ -203,7 +203,7 @@ Every screenshot here is the real app at work on public-domain art, rendered off
</td>
<td width="33%" valign="top">
<h4>🪄 The everyday essentials</h4>
- Auto Tone, Contrast and Color · Equalize · Image and Canvas Size · Crop and Trim · Reveal All · Edit › Fill and Stroke · Copy Merged · Paste in Place · guides, rulers, grid and snapping · Actions record and replay · a command palette (⌘K).
+ Auto Tone, Contrast and Color · Equalize · Image and Canvas Size · Crop and Trim · Reveal All · Edit › Fill and Stroke · Copy Merged · Paste in Place · guides, rulers, grid and snapping · Actions record and replay · a command palette (⌘F).
</td>
</tr>
</table>
diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs
index ecef505a7..fd4674df0 100644
--- a/crates/engine/src/prefs.rs
+++ b/crates/engine/src/prefs.rs
@@ -1588,7 +1588,10 @@ macro_rules! spec {
macro_rules! section {
($id:literal, $label:literal) => {
- CommandSpec { id: $id, label: $label, menu: &["Edit", "Preferences"], shortcut: None, params: r##"{}"##, enabled: always, run: |s, _| preferences_section(s, &json!({"__section": section_of($id)})), journal: false }
+ section!($id, $label, None)
+ };
+ ($id:literal, $label:literal, $shortcut:expr) => {
+ CommandSpec { id: $id, label: $label, menu: &["Edit", "Preferences"], shortcut: $shortcut, params: r##"{}"##, enabled: always, run: |s, _| preferences_section(s, &json!({"__section": section_of($id)})), journal: false }
};
}
@@ -1618,7 +1621,8 @@ pub fn specs() -> Vec<CommandSpec> {
false
),
spec!("prefs.reset", "Reset Preferences", [], None, r##"{"path":"section|section.key"?=everything}"##, prefs_reset, false),
- section!("edit.preferences.general", "General…"),
+ // Photoshop: ⌘K opens Preferences › General (⌘, is Layer › Hide Layers).
+ section!("edit.preferences.general", "General…", Some("Cmd+K")),
section!("edit.preferences.interface", "Interface…"),
section!("edit.preferences.workspace", "Workspace…"),
section!("edit.preferences.tools", "Tools…"),
diff --git a/crates/ui-egui/src/menu_catalog.rs b/crates/ui-egui/src/menu_catalog.rs
index 30a085b44..37032dbb5 100644
--- a/crates/ui-egui/src/menu_catalog.rs
+++ b/crates/ui-egui/src/menu_catalog.rs
@@ -87,7 +87,7 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[
(&["Edit", "Paste Special"], "Paste Outside", None, "edit.pasteSpecial.pasteOutside"),
(&["Edit"], "Clear", None, "edit.clear"),
(&["Edit"], "---", None, "---"),
- (&["Edit"], "Search…", Some("Cmd+K"), "edit.search"),
+ (&["Edit"], "Search…", Some("Cmd+F"), "edit.search"),
(&["Edit"], "---", None, "---"),
(&["Edit"], "Check Spelling…", None, "edit.checkSpelling"),
(&["Edit"], "Find and Replace Text…", None, "edit.findAndReplaceText"),
@@ -147,7 +147,7 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[
(&["Edit"], "Menus…", Some("Cmd+Alt+Shift+M"), "edit.menus"),
(&["Edit"], "Toolbar…", None, "edit.toolbar"),
(&["Edit"], "---", None, "---"),
- (&["Edit", "Preferences"], "Settings…", None, "edit.preferences.general"),
+ (&["Edit", "Preferences"], "Settings…", Some("Cmd+K"), "edit.preferences.general"),
(&["Edit", "Preferences"], "AI Integrations…", None, "edit.preferences.integrations"),
(&["Edit", "Preferences"], "Interface…", None, "edit.preferences.interface"),
(&["Edit", "Preferences"], "Workspace…", None, "edit.preferences.workspace"),
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index 98418b6fc..34b79e4a7 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -67,7 +67,7 @@ pub const UI_COMMANDS: &[(&str, &str, &[&str], Option<&str>)] = &[
("window.theme.studio", "Studio Theme", &["Window", "Theme"], None),
("window.theme.studioLight", "Studio Light Theme", &["Window", "Theme"], None),
("window.theme.classic", "Classic Theme", &["Window", "Theme"], None),
- ("edit.search", "Search…", &["Edit"], Some("Cmd+K")),
+ ("edit.search", "Search…", &["Edit"], Some("Cmd+F")),
("help.discord", "Join the ArtCraft Discord…", &["Help"], None),
("help.website", "PhotoCraft Website", &["Help"], None),
("help.artcraftWebsite", "ArtCraft Website", &["Help"], None),
diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs
index c41d14296..199ac9699 100644
--- a/crates/ui-egui/src/palette.rs
+++ b/crates/ui-egui/src/palette.rs
@@ -1,4 +1,4 @@
-//! ⌘K command palette: fuzzy search over every menu command and tool.
+//! ⌘F command palette: fuzzy search over every menu command and tool.
use egui::{Align2, Color32, CornerRadius, RichText, Sense, Stroke, vec2};
diff --git a/crates/ui-egui/src/shortcut_capture_tests.rs b/crates/ui-egui/src/shortcut_capture_tests.rs
index 994a6e9f5..d02b9e652 100644
--- a/crates/ui-egui/src/shortcut_capture_tests.rs
+++ b/crates/ui-egui/src/shortcut_capture_tests.rs
@@ -47,18 +47,19 @@ fn capture(h: &mut Harness<'_, PhotocraftApp>, button: &str, modifier: Key, held
}
#[test]
-fn ctrl_f_is_recorded_as_ctrl_f_not_the_control_key() {
+fn ctrl_k_is_recorded_as_ctrl_k_not_the_control_key() {
for ppp in [1.0, 2.0] {
let (mut h, id) = dialog(ppp, "edit.search", "search…");
- let current = crate::shortcuts::pretty("Cmd+K");
+ // Search's default is ⌘F (Photoshop); ⌘K is Preferences, so this also reports a conflict.
+ let current = crate::shortcuts::pretty("Cmd+F");
// On Windows and Linux the Ctrl key is the command modifier.
- capture(&mut h, &current, Key::ControlLeft, Modifiers::COMMAND, Key::F);
- assert_eq!(field(&h, id, "overrides")["edit.search"], json!("Cmd+F"), "@{ppp}x");
+ capture(&mut h, &current, Key::ControlLeft, Modifiers::COMMAND, Key::K);
+ assert_eq!(field(&h, id, "overrides")["edit.search"], json!("Cmd+K"), "@{ppp}x");
assert_eq!(field(&h, id, "capture"), json!(false));
let message = field(&h, id, "message");
assert!(!message.as_str().unwrap().contains("ontrol"), "@{ppp}x: {message}");
// The row shows the new shortcut.
- h.get_by_label(&crate::shortcuts::pretty("Cmd+F"));
+ h.get_by_label(&crate::shortcuts::pretty("Cmd+K"));
h.render().ok();
}
}
@@ -73,7 +74,7 @@ fn every_modifier_key_waits_for_the_real_key() {
(Key::ShiftRight, Modifiers::COMMAND | Modifiers::SHIFT),
] {
let (mut h, id) = dialog(1.0, "edit.search", "search…");
- h.get_by_label(&crate::shortcuts::pretty("Cmd+K")).click();
+ h.get_by_label(&crate::shortcuts::pretty("Cmd+F")).click();
h.run_steps(2);
key(&mut h, modifier, true, held);
h.run_steps(2);
@@ -93,13 +94,13 @@ fn every_modifier_key_waits_for_the_real_key() {
fn a_shortcut_in_use_is_reported_and_moved_on_ok() {
// ⌘J is Layer › New › Layer via Copy: giving it to Search warns, and OK moves it.
let (mut h, id) = dialog(1.0, "edit.search", "search…");
- capture(&mut h, &crate::shortcuts::pretty("Cmd+K"), Key::ControlLeft, Modifiers::COMMAND, Key::J);
+ capture(&mut h, &crate::shortcuts::pretty("Cmd+F"), Key::ControlLeft, Modifiers::COMMAND, Key::J);
let message = field(&h, id, "message");
assert!(message.as_str().unwrap().contains("already in use"), "{message}");
crate::dialogs::confirm(h.state_mut(), id).unwrap();
h.run_steps(2);
let app = h.state();
- assert_eq!(app.session.prefs().shortcut("edit.search", Some("Cmd+K")), Some("Cmd+J"));
+ assert_eq!(app.session.prefs().shortcut("edit.search", Some("Cmd+F")), Some("Cmd+J"));
let bound: Vec<String> =
crate::shortcut_dispatch::bindings(app).into_iter().filter(|(_, sc)| *sc == crate::shortcuts::parse("Cmd+J").unwrap()).map(|(id, _)| id).collect();
assert_eq!(bound, ["edit.search"], "one owner for ⌘J");
diff --git a/docs/architecture.md b/docs/architecture.md
index 83c53a049..fc2a48524 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -189,7 +189,7 @@ Each command registers the following:
- `kind`: Instant / Dialog / Interactive (hands control to a tool, e.g. Free Transform).
**Consumers:**
-- The GUI builds the menu bar, the ⌘K palette and the shortcut editor from it.
+- The GUI builds the menu bar, the ⌘F palette and the shortcut editor from it.
- `automation` exposes the registry as MCP tools.
- `photocraft-cli` exposes `photocraft-cli run in.psd --cmd filter.blur.gaussianBlur --params '{"radius":4}' --out out.png`.
- Action recording is simply `Vec<CommandInvocation>`.