Edit: add Select Only Active Photo (Cmd+Shift+D)

A new library command narrows the selection to the active photo and keeps
that photo active. It is bound to Cmd+Shift+D (Ctrl+Shift+D on Windows and
Linux), listed in the Edit menu and the keyboard shortcut editor, and
disabled while there is no active photo. The binding does not collide with
any existing binding or alias.
This commit is contained in:
eliets2
2026-10-13 15:17:01 +03:00
parent b3d392b499
commit 6f5e1f876e
+6
View File
@@ -58,6 +58,7 @@ pub const UI_COMMANDS: &[UiCommand] = &[
("view.squareGrid", "Square Grid", None, "View"),
// G: Photo Grid ↔ Square Grid (from other views: the photo grid)
("view.gridToggle", "Grid", Some("G"), ""),
("library.selectOnlyActive", "Select Only Active Photo", Some("Cmd+Shift+D"), "Edit"),
("tool.guidedUpright", "Guided Upright", Some("Shift+G"), "Window>Tools"),
("view.detail", "Detail", Some("D"), "View"),
("view.compare", "Compare", Some("Shift+C"), "View"),
@@ -477,6 +478,10 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option<Re
}
"view.appearance" => appearance_command(app, p),
"view.theme" => theme_command(app, p),
"library.selectOnlyActive" => {
let Some(active) = app.session.active() else { return Some(Err("no active photo".into())) };
app.run("library.select", json!({"ids": [active.0], "active": active.0}))
}
"view.gridToggle" => {
app.ui.view = if app.ui.view == ViewMode::PhotoGrid { ViewMode::SquareGrid } else { ViewMode::PhotoGrid };
Ok(Value::Null)
@@ -1847,6 +1852,7 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option<Re
pub fn ui_enabled(app: &LightcraftApp, id: &str) -> bool {
match id {
"library.selectOnlyActive" => app.session.active().is_some(),
"dialog.contactSheet" | "app.contactSheet" => !cfg!(target_arch = "wasm32") && app.session.active().is_some() && app.export.is_none(),
s if s.starts_with("panel.") || s.starts_with("tool.") || s.starts_with("section.") => app.session.active().is_some() || s == "panel.close",
"app.export" | "dialog.export" | "dialog.createPreset" | "dialog.rename" | "dialog.captureTime" | "dialog.copySettings" => {