Steering a running viewer#
A viewer started with --socket NAME answers other programs on a Unix socket, gloss-NAME.sock in the temporary folder (or at the path given). gloss --remote NAME FILE opens the file in that viewer, whatever it is doing: help, a search, a picker or the file browser gets out of the way. With --reload the viewer loads its file again, with --quit it ends, and with nothing it prints the file it shows; --json gives the viewer’s whole answer. The socket is the user’s alone, and the viewer treats what arrives as paths to probe, as it does a drop. On Unix, SIGUSR1 reloads too. An editor or terminal multiplexer keeps one gloss pane and points it at each file in turn.
| Option | Argument | Default | Description |
|---|---|---|---|
--socket | string | answer other programs on a Unix socket called NAME, $TMPDIR/gloss-NAME.sock, or at a path: gloss –remote NAME then opens files in this viewer, whatever it is doing | |
--remote | string | send the files to the viewer started with –socket NAME, which shows them, and exit; with none, print the file it shows (–json for details) | |
--reload | with –remote, have the viewer load the file on its screen again | ||
--quit | with –remote, end the viewer |
Examples#
# A viewer that takes requests, in one pane
gloss --socket preview README.md
# Show another file in it, from another pane or a script
gloss --remote preview notes.pdf --page 3
# Reload after a build rewrote the file
gloss --remote preview --reload
pkill -USR1 gloss
# Which file is it showing? Then close it
gloss --remote preview
gloss --remote preview --quit