Toast when the clipboard is copied to or read #33

Closed
opened 2026-10-20 19:09:08 -05:00 by jeff · 0 comments
Owner

A Toast (see GLOSSARY.md) over a pane when something is copied to or read from the clipboard or the Primary selection, so that a program's Clipboard access that needed no Confirmation is no longer silent.

When a toast is shown

  • The user copies, by the copy binding (Window.copy(.standard)). Copy-on-select into the primary selection is not toasted: it happens on every mouse release.
  • A program writes the clipboard or the primary selection without being asked (clipboard.write = "allow", or "yes for pane").
  • A program reads the clipboard or the primary selection without being asked (clipboard.read = "allow", or "yes for pane").
  • Never for an access the user has just answered in a Confirmation, and never for a paste.

What it says

Translated through l10n (Fluent), with the program and counts as arguments so plurals come out right.

  • Who: the pane's Foreground program, else its Program (always so on Windows), else "The program" (serial, message). The user's own copy names nobody.
  • What and where: copied / read / cleared, and "clipboard" or "primary selection" — never "selection" bare.
  • How much: for text, "N lines" when there is more than one, otherwise "N characters" (graphemes). For any other Clipboard type, the type and its size in bytes.
  • Examples: "Copied 42 characters", "ssh copied 3 lines to the clipboard", "nvim read the primary selection", "tmux copied image/png, 18 KB to the clipboard".
  • An empty write: "Cleared the clipboard".
  • A failed write: "Could not copy to the clipboard", shown even when toasts are off.
  • No preview of the contents.

Where and how

  • Per pane, not per window (unlike Ghostty's adw.Toast), so that it shows which pane did it. A pane not shown does not show its toast.
  • Bottom center of the pane, one line, drawn like the size overlay (buildSizeOverlay): the pane's own colors. It is skipped when it does not fit.
  • Drawn after the content and before the Confirmation, which covers it where they overlap.
  • One per pane: a new toast replaces the one shown and restarts its timer.
  • Takes no pointer input; clicks go to the pane.
  • Times out like the size overlay: a toast_until deadline joined into nextDeadline and update.

Config

  • clipboard.toast = always | programs | never, default always. programs drops the user's own copies. It is in the scoped "clipboard" category, so it follows the pane and its foreground program.
  • window.toast_ms = 3000.

Prior art

Ghostty's app-notifications = clipboard-copy (src/apprt/gtk/class/window.zig surfaceClipboardWrite): per window, 3 s, standard clipboard only, and it does not name who wrote.

A **Toast** (see `GLOSSARY.md`) over a pane when something is copied to or read from the clipboard or the **Primary selection**, so that a program's **Clipboard access** that needed no **Confirmation** is no longer silent. ## When a toast is shown - The user copies, by the copy binding (`Window.copy(.standard)`). Copy-on-select into the primary selection is not toasted: it happens on every mouse release. - A program writes the clipboard or the primary selection without being asked (`clipboard.write = "allow"`, or "yes for pane"). - A program reads the clipboard or the primary selection without being asked (`clipboard.read = "allow"`, or "yes for pane"). - Never for an access the user has just answered in a Confirmation, and never for a paste. ## What it says Translated through `l10n` (Fluent), with the program and counts as arguments so plurals come out right. - **Who**: the pane's **Foreground program**, else its **Program** (always so on Windows), else "The program" (serial, message). The user's own copy names nobody. - **What and where**: copied / read / cleared, and "clipboard" or "primary selection" — never "selection" bare. - **How much**: for text, "N lines" when there is more than one, otherwise "N characters" (graphemes). For any other **Clipboard type**, the type and its size in bytes. - Examples: "Copied 42 characters", "ssh copied 3 lines to the clipboard", "nvim read the primary selection", "tmux copied image/png, 18 KB to the clipboard". - An empty write: "Cleared the clipboard". - A failed write: "Could not copy to the clipboard", shown even when toasts are off. - No preview of the contents. ## Where and how - Per pane, not per window (unlike Ghostty's `adw.Toast`), so that it shows which pane did it. A pane not shown does not show its toast. - Bottom center of the pane, one line, drawn like the size overlay (`buildSizeOverlay`): the pane's own colors. It is skipped when it does not fit. - Drawn after the content and before the Confirmation, which covers it where they overlap. - One per pane: a new toast replaces the one shown and restarts its timer. - Takes no pointer input; clicks go to the pane. - Times out like the size overlay: a `toast_until` deadline joined into `nextDeadline` and `update`. ## Config - `clipboard.toast = always | programs | never`, default `always`. `programs` drops the user's own copies. It is in the scoped "clipboard" category, so it follows the pane and its foreground program. - `window.toast_ms = 3000`. ## Prior art Ghostty's `app-notifications = clipboard-copy` (`src/apprt/gtk/class/window.zig` `surfaceClipboardWrite`): per window, 3 s, standard clipboard only, and it does not name who wrote.
jeff closed this issue 2026-10-20 20:13:23 -05:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jeff/harrier#33
No description provided.