diff --git a/AGENTS.md b/AGENTS.md index c775f35..c20469d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,13 +37,14 @@ clicking an item copies it back to the clipboard. light mode keeps the system window colour. `Theme.background` is also handed to the `NSPanel` so the strip under the transparent titlebar matches, and the row colour stays slightly lighter than black so cards remain visible. -- `Sources/Prompt/PanelView.swift` — the panel UI. Header (section switcher, - search, add photos, close), item list, composer. Composer `# Name` creates/ +- `Sources/Prompt/PanelView.swift` — the panel UI. Header (workspace switcher, + search, add photos), item list, composer. There is no in-header close button: + the window's own close button hides the panel. Composer `# Name` creates/ switches sections. Click = select (Shift+click for a range); the selection - bar offers Copy (single item), Copy as List and Copy as Lines; right-click = - context menu acting on the whole selection (Copy, Copy as List, Copy as - Lines, Done, Edit, Open, Merge, Move To, Delete). Esc clears the selection - before it hides the panel. Drop target for images/files. + bar offers Copy (single item), Copy as List, Copy as Lines and Delete; + right-click = context menu acting on the whole selection (Copy, Copy as List, + Copy as Lines, Done, Edit, Open, Merge, Move To, Delete). Esc clears the + selection before it hides the panel. Drop target for images/files. - `Sources/Prompt/PanelController.swift` — owns the floating `NSPanel` (`.nonactivatingPanel`, `.floating`, right-edge docked, frame autosaved as `PromptPanel`), the Cmd+V image-paste monitor, and `EditWindowController` diff --git a/README.md b/README.md index 54cbfc3..77e0357 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ A native macOS app for keeping prompts and photos, in the spirit of to your work. Select what you need and send it back to your clipboard. - **Click to select** — clicking a card selects it (Shift+click for a range), - and the selection bar copies a single item as-is, or the whole selection as a - numbered list or as plain newline-separated lines. + and the selection bar copies a single item as-is, the whole selection as a + numbered list or as plain newline-separated lines, or deletes it. - **Text or photo** — copying sends text back as text and a photo back as an image. - **Capture from anywhere** — select text in any app and tap **Left Shift twice**. diff --git a/Sources/Prompt/PanelView.swift b/Sources/Prompt/PanelView.swift index 2265c08..37618f3 100644 --- a/Sources/Prompt/PanelView.swift +++ b/Sources/Prompt/PanelView.swift @@ -83,9 +83,6 @@ struct PanelView: View { .buttonStyle(.plain).foregroundStyle(.secondary).help("Search (Cmd+F)") Button { addPhotos() } label: { Image(systemName: "photo.on.rectangle.angled") } .buttonStyle(.plain).foregroundStyle(.secondary).help("Add photos") - Button { PanelController.shared.hide() } label: { Image(systemName: "xmark") } - .buttonStyle(.plain).foregroundStyle(.secondary) - .help("Hide the panel (Cmd+W) — Prompt keeps running so Shift-Shift capture still works. Quit from the menu bar icon or Cmd+Q.") } .padding(.horizontal, 12) .padding(.vertical, 10) @@ -576,6 +573,12 @@ struct PanelView: View { .font(.caption) .buttonStyle(.plain) .foregroundStyle(Color.accentColor) + Button { deleteSelection() } label: { + Image(systemName: "trash") + } + .buttonStyle(.plain) + .foregroundStyle(.red) + .help("Delete selected") Button { clearSelection() } label: { Image(systemName: "xmark.circle.fill") } @@ -588,6 +591,12 @@ struct PanelView: View { .background(Color.accentColor.opacity(0.12)) } + private func deleteSelection() { + guard !selection.isEmpty else { return } + store.delete(ids: selection) + clearSelection() + } + private func copySelection(asList: Bool) { guard !selection.isEmpty else { return } if asList {