Documentation
¶
Overview ¶
The image on the clipboard of the computer the app runs on, read with the program each system has for it, as a PNG a message attaches
Index ¶
- Constants
- Variables
- func Blocker(sys System, has func(program string) bool) error
- func DataURL(text string) bool
- func Installed(program string) bool
- func Keep(dir string, img Image) (string, error)
- func Preferred(listed string) string
- func Sources(sys System) []string
- func Usable(text string) bool
- type Image
- type Missing
- type Output
- type Runner
- type System
- type Unreachable
Constants ¶
const ( // Largest image a message takes, and the most pixels it may be, as the labels of the prompt take them MaxBytes = 20 << 20 MaxPixels = 100_000_000 // Longest the reading of the clipboard image may take in all Limit = 15 * time.Second // Age past which a kept image, or a page rendered from a PDF, is removed as the next one is kept KeptFor = 7 * 24 * time.Hour )
Variables ¶
var ErrNone = errors.New("The clipboard holds no image.")
The clipboard holds no image
Functions ¶
func Blocker ¶
What keeps this computer from reading a clipboard image: a *Missing program, an *Unreachable desktop, nil when nothing does; has says whether a program is installed. Under WSL the clipboard of Windows is read through powershell.exe, else through the display WSL shows, as Sources tries them
func DataURL ¶
Whether the text is an image as a data URL, as a terminal or a browser pastes one: data:image/<type>;base64,<data>
func Keep ¶
Writes the image into the folder as a file of its own, named for when it was pasted, the files kept there longer than a week removed first; the path of the file
func Preferred ¶
The type of image to take among the lines a clipboard program listed, empty for none
Types ¶
type Image ¶
type Image struct {
PNG []byte
Width, Height int
// Program that read it, as a person knows it
From string
}
The image on the clipboard, as a PNG
func FromDataURL ¶
The image of a data URL as a PNG within the bounds
func Made ¶
The image as a PNG within the bounds: a PNG as it is, any other format the decoders read made PNG, else made PNG by ImageMagick where a runner is given; refused in words when nothing reads it or it is too large, one of too many pixels before it is decoded
type Missing ¶
A program reading clipboard images that this computer lacks, with the package of each package manager that installs it
type Runner ¶
Runs a program to its end within its limit, with nothing on its input, and gives what it printed; an error for one that could not start, ran past its limit or printed too much, exec.ErrNotFound under it for one that is not installed
type System ¶
type System struct {
OS string
// Linux under WSL, whose clipboard is the one of Windows
WSL bool
// A Wayland display, an X11 display is named
Wayland, X11 bool
// The terminal reaches this computer over SSH, so its clipboard is no clipboard of the person's own computer
Remote bool
// This process runs in a container, or in Termux, neither of which holds a desktop clipboard
Contained, Termux bool
}
What the clipboard is read on
type Unreachable ¶
type Unreachable struct {
Why string
}
No desktop clipboard is reachable from this terminal: why, as the end of a sentence
func (*Unreachable) Error ¶
func (u *Unreachable) Error() string