updates plak menu item

This commit is contained in:
2026-10-28 16:18:03 +01:00
parent 92b90c0e13
commit 9bdda896af
13 changed files with 339 additions and 8 deletions
+12
View File
@@ -156,6 +156,8 @@ Right-clicking inside the code area, with or without a selection, shows a contex
With a selection, a separator and **Read aloud selection** follow Copy reference. It reads the selected text with the system voice; in a Markdown file the selection is read as prose, the markup left out. The rendered Markdown preview has no Read aloud selection; its selection is not Helder's (use Read aloud on the file).
With a selection, a separator and **Plak** follow Read aloud selection. It sends the selected text to Plak, the user's scratchpad app; see [Plak](#plak). The preview has no Plak.
On a marked line of the live file (any marked line, blank lines and the space after the text included), a separator and a last item follow: **Show diff**, which opens the Diff centred on that line. A new file, Preview and the Diff's own menu have no Show diff.
### File-state behavior in the views
@@ -197,6 +199,16 @@ The bottom pane of the fourth column.
- It behaves as a normal terminal for that shell.
- It is one terminal only. There are no additional terminals in this version.
### Right-click in a terminal
Right-clicking in the agent pane or the terminal pane shows a menu without a header line. With a selection it holds **Copy**, **Paste**, a separator, **Read aloud selection**, a separator and **Plak**; the agent pane adds a separator and **Wait what?**. Without a selection it holds only **Paste**.
**Read aloud selection** reads the selected text with the system voice, as prose with the Markdown markup left out. A selection with no prose left, such as one code block, is read as it is. Blank text reads nothing and shows the toast "Nothing to read".
### Plak
**Plak** (code and terminal menus, only with a selection) sends the selected text, trimmed, to Plak, the user's macOS scratchpad app. The text lands at the end of the Plak page as a new block; Plak opens (it starts if needed), scrolls to the block and takes the focus. Blank text sends nothing and shows the toast "Nothing to send". Text up to about 100 KB goes in the URL; longer text goes through the clipboard, and Helder restores the user's clipboard one second later. The URL contract is in [plak.md](plak.md).
---
## 8. Status bar
+20 -2
View File
@@ -26,7 +26,7 @@ Helder draws its own right-click menu, in the same dark style everywhere. This p
3. **Separator**: a thin line between groups of items.
4. **Destructive item**: Discard and Delete read in amber-deep, so they stand out.
Each item has a small icon. Add-type items (Stage, New file, New folder) have a teal icon. Copy file name, Unstage and Show in Finder have an amber icon. Read aloud has a speaker icon.
Each item has a small icon. Add-type items (Stage, New file, New folder) have a teal icon. Copy file name, Unstage and Show in Finder have an amber icon. Read aloud has a speaker icon. Plak has a note icon with a plus.
## Features
@@ -223,6 +223,8 @@ With a selection:
| # Copy reference |
|----------------------------------------|
| )) Read aloud selection |
|----------------------------------------|
| >> Plak |
+----------------------------------------+
```
@@ -239,8 +241,9 @@ On a marked (teal) line of a changed file:
- **Pass on selection** passes the reference and the selected code. See [Pass on to Agent](pass-on-to-agent.md).
- **Read aloud selection** reads the selected text aloud. In a Markdown file the markup is left out. Stop it with **Stop** in the [title bar](title-bar.md#read-aloud).
- **Plak** sends the selected text to [Plak](#plak). On a marked line it comes before Show diff.
- **Show diff** opens the full-screen [Diff](file-view-diff.md) of the file, centred on the line you right-clicked. Every marked line counts, a blank one and the space after the text included. A new file, where every line is marked, has no Show diff. A left click on a marked line only places the caret.
- The same menu shows on the rendered [Markdown preview](file-view-markdown.md) and on an image. There it refers to the file's first line, for example `README.md:1`, and has no Read aloud selection. To hear a previewed file, right-click it in the Explorer and choose **Read aloud**.
- The same menu shows on the rendered [Markdown preview](file-view-markdown.md) and on an image. There it refers to the file's first line, for example `README.md:1`, and has no Read aloud selection and no Plak. To hear a previewed file, right-click it in the Explorer and choose **Read aloud**.
- `Cmd+Right` with code selected opens the Pass on prompt straight away, without the menu.
### Diff
@@ -269,6 +272,10 @@ With text selected in the pane:
| # Copy |
| # Paste |
|----------------------------------------|
| )) Read aloud selection |
|----------------------------------------|
| >> Plak |
|----------------------------------------|
| ? Wait what? |
+----------------------------------------+
```
@@ -285,8 +292,19 @@ Without a selection:
- **Copy** (only with a selection): copies the selected terminal text.
- **Paste**: types the clipboard text into that pane, as a normal paste would. With an empty clipboard nothing happens.
- **Read aloud selection** (only with a selection): reads the selected text with the system voice. Markdown markup is left out. With nothing left to read, a [notification](notifications.md) says `Nothing to read`. Stop it with **Stop** in the [title bar](title-bar.md#read-aloud).
- **Plak** (only with a selection): sends the selected text to [Plak](#plak).
- **Wait what?** (Claude Code pane, only with a selection): inserts ``/wait-what `selected text` `` into the [Claude Code](claude-code.md) input, not sent. Spaces and blank lines around the selection are trimmed. A [notification](notifications.md) says `Passed to agent`.
### Plak
**Plak** sends the selected text to Plak, the scratchpad app for macOS. Plak must be installed.
- The text, with spaces and blank lines around it trimmed, goes to the end of the Plak page as a new block.
- Plak opens (it starts if it is not running), scrolls to the new block and takes the focus.
- A blank selection sends nothing. A [notification](notifications.md) says `Nothing to send`.
- A very long selection (more than about 100 KB) goes through the clipboard. Helder puts your own clipboard back one second later.
## Keyboard
| Keys | Action |
+1
View File
@@ -4,3 +4,4 @@
- [Architecture](architecture.md): layers, folder map, commands, file ownership, gotchas.
- [Design tokens](design/README.md): the visual source of truth (colours, type, geometry, screens).
- [Behaviour spec](behaviour.md): every panel and interaction.
- [Plak URL scheme](plak.md): the `plak://` contract that the right-click Plak item relies on.
+63
View File
@@ -0,0 +1,63 @@
# Plak URL scheme
Plak is the user's scratchpad app for macOS. Other apps add text to it through two `plak://` URLs. This page is the contract that Helder relies on.
## `plak://append?text=<text>`
Adds the text at the end of the Plak page, as a new block with its own created date.
- Percent-encode the text as a URL query value: space `%20`, newline `%0A`, `&` `%26`, `+` `%2B`, `#` `%23`.
- Never encode a space as `+`. Plak keeps a `+` literal, so the block would show `+` signs.
- Plak detects the content type as for a paste. PHP, JSON, XML and CSV become a code block or a table. All other text becomes plain text.
## `plak://paste`
Adds the current contents of the macOS general pasteboard, text or images.
- Use it for images and for text over about 100 KB, where a long URL can fail to open.
- Put the content on the pasteboard first, then open the URL.
- Save the user's clipboard before, and restore it one second after.
## What Plak does
- Plak starts if it is not running. It shows its window, scrolled to the new content, and takes the focus.
- An empty or missing `text` adds nothing, but Plak still shows.
- Every other `plak://` URL does nothing.
- There is no callback and no error result. The sender cannot know if the add worked.
## Opening the URL
```sh
open "plak://append?text=Hello%20from%20my%20app"
```
```swift
var components = URLComponents()
components.scheme = "plak"
components.host = "append"
components.queryItems = [URLQueryItem(name: "text", value: text)]
// URLQueryItem leaves "+" as it is; encode it yourself.
components.percentEncodedQuery = components.percentEncodedQuery?
.replacingOccurrences(of: "+", with: "%2B")
if let url = components.url { NSWorkspace.shared.open(url) }
```
```applescript
open location "plak://append?text=Hello%20from%20my%20app"
```
```js
shell.openExternal("plak://append?text=" + encodeURIComponent(text))
```
```python
subprocess.run(["open", "plak://append?text=" + urllib.parse.quote(text, safe="")])
```
## In Helder
- The **Plak** item in the right-click menu of the code and of both terminal panes uses this scheme. See [behaviour.md](behaviour.md#plak) and the [right-click guide](guide/right-click-menu.md#plak).
- URL building and the 100 KB choice: `Plak` in `Sources/HelderCore/Files/Plak.swift`. The limit counts UTF-8 bytes.
- Opening the URL and the clipboard save and restore: `SystemActing.sendToPlak` in `Sources/HelderUI/Shell/SystemActions.swift`.
Later, Plak will replace Helder's own notes (`.notes.txt`, `Cmd+N`; see [Notes](guide/notes.md)).