Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.
TypeScript ai-photo-editorcomfyui-alternativegenerative-fillimage-editingimage-generationinpaintinglinuxlocal-aimacosmcpmcp-servernano-banana-alternativeofflinephoto-editorprivacyqwen-imageqwen-image-2-1stable-diffusion-cppvulkanwindows
feat(ui): keyboard shortcuts panel (? key or the ? button)
Gabriele Lozuponeb81af2c6a48c
diff --git a/src/App.tsx b/src/App.tsxindex 4e2059e..b9272d6 100644--- a/src/App.tsx+++ b/src/App.tsx@@ -1,5 +1,5 @@import { getCurrentWebview } from "@tauri-apps/api/webview";-import { ArrowDownToLine, EyeOff, PanelLeft, Redo2, Settings, SquarePen, Undo2, X } from "lucide-react";+import { ArrowDownToLine, CircleHelp, EyeOff, PanelLeft, Redo2, Settings, SquarePen, Undo2, X } from "lucide-react";import { useEffect, useRef, useState } from "react";import { api, configure } from "./lib/api";import { native } from "./lib/native";@@ -18,6 +18,7 @@ import { Tour } from "./components/Tour";import { IconButton } from "./components/ui";import { shortcut } from "./lib/platform";import { PromptTips } from "./components/PromptTips";+import { Shortcuts } from "./components/Shortcuts";import { WhatsNew, whatsNewDue } from "./components/WhatsNew";import { UpscalerCompare } from "./components/Upscalers";import { KokonMark, Welcome } from "./components/Welcome";@@ -283,6 +284,11 @@ export default function App() {return;}if (typing) return;+ if (e.key === "?" && !e.ctrlKey && !e.metaKey && !e.altKey && !document.querySelector(".viewer")) {+ e.preventDefault();+ setState({ overlay: "shortcuts" });+ return;+ }// Undo / Redo between versions (the brush editor has its own while it is open).if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z") {e.preventDefault();@@ -347,6 +353,9 @@ export default function App() {<UpdatePill />{!needsSetup && <PrivateToggle />}<StatusIndicator />+ <IconButton title="Shortcuts (?)" onClick={() => setState({ overlay: "shortcuts" })}>+ <CircleHelp size={18} />+ </IconButton><IconButton title="Settings" onClick={() => setState({ overlay: "settings" })}><Settings size={18} /></IconButton>@@ -365,6 +374,7 @@ export default function App() {{overlay === "welcome" && <Welcome />}{overlay === "whats-new" && <WhatsNew />}{overlay === "prompt-tips" && <PromptTips />}+ {overlay === "shortcuts" && <Shortcuts />}{compareUpscalers && <UpscalerCompare />}<Tour /><Toasts />diff --git a/src/components/Shortcuts.tsx b/src/components/Shortcuts.tsxnew file mode 100644index 0000000..6cb3fe4--- /dev/null+++ b/src/components/Shortcuts.tsx@@ -0,0 +1,99 @@+// Keyboard and mouse shortcuts, opened with "?".++import { Keyboard, X } from "lucide-react";+import { Fragment, useEffect } from "react";+import { isMac } from "../lib/platform";+import { setState } from "../lib/store";++const MOD = isMac ? "⌘" : "Ctrl";++/** Each row: what it does, then the alternatives (each a list of keys pressed together). */+const SECTIONS: { title: string; rows: [string, string[][]][] }[] = [+ {+ title: "Everywhere",+ rows: [+ ["Generate (Enter in the prompt box)", [["Enter"], [MOD, "Enter"]]],+ ["New line in the prompt", [["Shift", "Enter"]]],+ ["Bring back the last prompt (empty box)", [["↑"]]],+ ["Paste an image", [[MOD, "V"]]],+ ["Previous / next version", [["←"], ["→"]]],+ ["Undo / redo a version", [[MOD, "Z"], [MOD, "Shift", "Z"]]],+ ["Rename a project (in the list)", [["F2"]]],+ ["Show these shortcuts", [["?"]]],+ ],+ },+ {+ title: "Viewing",+ rows: [+ ["Full screen", [["F"]]],+ ["Browse in full screen", [["←"], ["→"]]],+ ["See the original (hold)", [["B"]]],+ ["Close", [["Esc"]]],+ ],+ },+ {+ title: "Zoom (full screen and painting)",+ rows: [+ ["Zoom", [["Scroll"], ["+"], ["−"]]],+ ["Fit / 100 %", [["0"], ["1"]]],+ ["Move around", [["Drag"]]],+ ],+ },+ {+ title: "Painting an area",+ rows: [+ ["Brush / eraser / move", [["B"], ["E"], ["H"]]],+ ["Smaller / larger brush", [["["], ["]"]]],+ ["Use the other tool", [["Right-click"]]],+ ["Move around", [["Space", "Drag"], ["Middle-drag"]]],+ ["Undo / redo a stroke", [[MOD, "Z"], [MOD, "Shift", "Z"]]],+ ["Cancel", [["Esc"]]],+ ],+ },+];++export function Shortcuts() {+ const close = () => setState({ overlay: null });+ useEffect(() => {+ const onKey = (e: KeyboardEvent) => (e.key === "Escape" || e.key === "?") && close();+ window.addEventListener("keydown", onKey);+ return () => window.removeEventListener("keydown", onKey);+ }, []);++ return (+ <div className="modal-scrim" onMouseDown={(e) => e.target === e.currentTarget && close()}>+ <div className="tips shortcuts" role="dialog" aria-label="Keyboard shortcuts">+ <div className="tips-head">+ <Keyboard size={20} />+ <h1>Shortcuts</h1>+ <span className="spacer" />+ <button className="icon-btn" onClick={close} aria-label="Close">+ <X size={18} />+ </button>+ </div>+ <div className="tips-body shortcuts-body">+ {SECTIONS.map((s) => (+ <section className="tips-rule" key={s.title}>+ <h2>{s.title}</h2>+ {s.rows.map(([what, alts]) => (+ <div className="shortcut-row" key={what}>+ <span>{what}</span>+ <span className="keys">+ {alts.map((keys, i) => (+ <Fragment key={i}>+ {i > 0 && <span className="muted">or</span>}+ {keys.map((k) => (+ <kbd key={k}>{k}</kbd>+ ))}+ </Fragment>+ ))}+ </span>+ </div>+ ))}+ </section>+ ))}+ </div>+ </div>+ </div>+ );+}diff --git a/src/lib/store.ts b/src/lib/store.tsindex b69be71..b1ba176 100644--- a/src/lib/store.ts+++ b/src/lib/store.ts@@ -10,7 +10,7 @@ import { api, ApiError, setPrivateInputs, subscribe } from "./api";import { buildRequest, emptyComposer, needsPrompt, newKey, persistentAdvanced, refFromGen, refFromInput, timelineLinks, undoTarget, versionLabels, type CompareMode, type Composer, type Ref } from "./logic";import type { AppErrorBody, GenerationRecord, GenerationRequest, InputRecord, JobView, ServerState, StatusResponse } from "./types";-export type Overlay = null | "gallery" | "settings" | "inpaint" | "expand" | "welcome" | "whats-new" | "prompt-tips";+export type Overlay = null | "gallery" | "settings" | "inpaint" | "expand" | "welcome" | "whats-new" | "prompt-tips" | "shortcuts";export interface SessionItem {key: string;diff --git a/src/styles.css b/src/styles.cssindex 4cad223..8156b82 100644--- a/src/styles.css+++ b/src/styles.css@@ -587,6 +587,13 @@ button.link:hover { color: var(--text); }.tips-tabs button { flex: none; padding: 0 14px; }.tips-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; margin: 0 -6px; padding: 0 6px; }.tips-rule { background: var(--surface); border-radius: 16px; padding: 14px 16px; }+/* keyboard shortcuts panel ("?") */+.shortcuts { width: min(760px, 94vw); }+.shortcuts-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-content: start; }+.shortcuts-body h2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }+.shortcut-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13px; color: var(--text-2); }+.shortcut-row .keys { display: flex; align-items: center; gap: 4px; flex: none; font-size: 12px; }+kbd { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; display: inline-grid; place-items: center; font: inherit; font-size: 11.5px; color: var(--text); background: var(--bg); box-shadow: inset 0 -1px 0 var(--border), 0 0 0 1px var(--border); }.tips-rule h2 { font-size: 15px; margin: 0; display: flex; gap: 8px; align-items: baseline; }.tips-num { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }.tips-why { margin: 4px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.45; }