snap
A plugin of Lokyr: an image of a terminal's text, in a frame as a macOS window's, of its three buttons and the pane's title, with rounded corners, a shadow and room around it, to copy or to save, as code-snippet tools make of code.
Use
- Snap the Selection (
snap.selection) and Snap the Screen (snap.screen), from the command palette (⇧⌘P) or keys of your own: the image of the text, in your theme's colors and your terminal's font, is copied, saved through the save panel, or both, asactionsays, a notice telling it once done, or why a save failed. - Snap the Command (
snap.output), from the pane's context menu where a command's output is, or from the palette for the last command that ended: the image of the command's block, its prompt, its command line and its output, as your shell marks them, of the shell integration; of an output so long that its prompt left the scrollback, from the oldest row that the pane holds. An image holds 1000 rows at most: a longer block snaps its first 1000, and the notice says so. - Lokyr shows the commands' items in its menus whether or not they apply: of no selection, or of no command that ended at the cell, a notice says why nothing was snapped.
- The window's parts, its background and its size are the config's.
Install
Of Lokyr 1.4 or later, of the plugin API 0.1.6:
sleip add sephiroth74/snap
Config
In Lokyr's config.toml, under [plugins.snap]:
| Key | Values | Default | What it does |
|---|---|---|---|
background | #rrggbb | the theme's background, darker | The color around the window |
transparent-background | true, false | false | No background around the window |
shadow | true, false | true | A shadow under the window |
padding | points, 0 to 256 | 32 | The room around the window |
rounded-corners | true, false | true | The window's corners rounded, or square |
window-controls | true, false | true | The window's three buttons |
title | true, false | true | The pane's title in the window's bar, as its tab shows it |
title-text | a text | the pane's | The window's title, in place of the pane's |
target | container, window | container | The window with what is around it, or the window alone |
min-columns | 1 to 1000 | the selection's | The least columns of a selection's window |
min-rows | 1 to 1000 | the selection's | The least rows of a selection's window |
action | copy, save, both | copy | What the shutter does |
scale | 1, 2, 3 | the display's | The pixels of a point |
Capabilities
terminal-read, for the cells of the selection, of the screen and of a command's rows.history-read, for the commands that your shell marked, whose block Snap the Command takes.process-read, for the pane's title as its tab shows it, of its folder and its program; refused, the title is the program's own, unlesstitle-textgives one.clipboard-write, to copy the image.
A save goes through the save panel, where you choose the file: it needs no capability.
Develop
sleip check checks the plugin, sleip test runs its tests, and
sleip dev links it into Lokyr, which reloads it at each save.
License
MIT, see LICENSE.