Blob


1 .\" Copyright (c) 2021 Omar Polo <op@omarpolo.com>
2 .\"
3 .\" Permission to use, copy, modify, and distribute this software for any
4 .\" purpose with or without fee is hereby granted, provided that the above
5 .\" copyright notice and this permission notice appear in all copies.
6 .\"
7 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 .Dd $Mdocdate: March 28 2021$
15 .Dt TELESCOPE 1
16 .Os
17 .Sh NAME
18 .Nm telescope
19 .Nd Gemini client
20 .Sh SYNOPSIS
21 .Nm
22 .Bk -words
23 .Op Fl hn
24 .Op Fl c Pa config
25 .Op Ar URL
26 .Ek
27 .Sh DESCRIPTION
28 .Nm
29 is an interactive browser for the Gemini protocol.
30 It is able to process text/gemini and more in general every text/* file.
31 .Nm
32 also features tabs, bookmarks and out-of-band TOFU verification.
33 .Pp
34 The arguments are as follows:
35 .Bl -tag -width tenletters
36 .It Fl h
37 Display version and usage.
38 .It Fl n
39 Configtest mode.
40 Only check the configuration file for validity.
41 .It Fl c Pa config
42 Specify an alternative configuration file.
43 By default
44 .Pa $HOME/.telescope/config
45 is loaded.
46 .El
47 .Sh TOFU
48 .Nm
49 aims to use the "Trust, but Verify (where appropriate)" approach.
50 The idea is to define three level of verification for a certificate:
51 .Bl -tag -width 12m
52 .It untrusted
53 the server fingerprint does NOT match the stored value
54 .It trusted
55 the server fingerprint matches the store one
56 .It verified
57 the fingerprint matches and has been verified out-of-band
58 .El
59 .Pp
60 Most of the time the
61 .Dq trusted
62 level is enough, but where is appropriate users should be able to
63 verify out-of-band the certificate.
64 .Pp
65 At the moment, there is no built-in support for an out-of-band
66 verification though.
67 .Pp
68 Known certificates are store in
69 .Pa ~/.telescope/known_hosts
70 with a format similar to the
71 .Xr ssh 1 Ns '
72 .Pa known_hosts
73 file.
74 Each line is a record and it's made up by three fields, separated by a
75 single space, according to the following format:
76 .Dq HOST HASH TRUSTED
77 where:
78 .Bl -tag -width 12m
79 .It HOST
80 the hostname, optionally followed by a colon (":") and a port number.
81 .It HASH
82 is the hash of the certificate, as outputted by
83 .Xr tls_peer_cert_hash 3 .
84 .It TRUSTED
85 a single digit.
86 0 means trusted, 1 verified.
87 .El
88 .Sh DEFAULT KEY BINDINGS
89 The default key bindings are very similar to GNU Emacs, but care has
90 been taken to include also bindings familiar for
91 .Xr vi 1
92 and
93 .Dq CUA
94 users.
95 In the following examples, C-x means Control-x, M-x means Meta-x,
96 where the Meta key may be either a special key on the keyboard or the
97 ALT key; otherwise ESC followed by the key X works as well, and C-M-x
98 means to press the key X together with both Control and Meta.
99 .Pp
100 Keys are usually a single character, like
101 .Sq p
102 or
103 .Sq n ,
104 but some special keys are accepted as well.
105 .Pp
106 .Bl -tag -width 16m -offset indent -compact
107 .It <up>
108 Up arrow
109 .It <down>
110 Down arrow
111 .It <left>
112 Left arrow
113 .It <right>
114 Right arrow
115 .It <prior>
116 Previous page/Page up
117 .It <next>
118 Next page/Page down
119 .It <home>
120 Home
121 .It <end>
122 End
123 .It <f0> thru <f63>
124 Function keys
125 .It del or backspace
126 Backspace
127 .It esc
128 Escape
129 .It space or spc
130 Space
131 .It enter or ret
132 Enter
133 .It tab
134 Tab
135 .It backtab
136 Depends on the configuration of the terminal emulator.
137 Usually is shift tab though.
138 .El
139 .Ss GNU Emacs-like keys
140 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
141 .It C-p
142 previous-line
143 .It C-n
144 next-line
145 .It C-f
146 forward-char
147 .It C-b
148 backward-char
149 .It M-{
150 backward-paragraph
151 .It M-}
152 forward-paragraph
153 .It C-a
154 move-beginning-of-line
155 .It C-e
156 move-end-of-line
157 .It M-v, M-space
158 scroll-up
159 .It C-v, space
160 scroll-down
161 .It M-<
162 beginning-of-buffer
163 .It M->
164 end-of-buffer
165 .It C-x C-c
166 kill-telescope
167 .It C-g
168 clear-minibuf
169 .It M-x
170 execute-extended-command
171 .It >
172 load-url
173 .It C-x C-f
174 load-url
175 .It C-x M-f
176 load-current-url
177 .It C-x t 0
178 tab-close
179 .It C-x t 1
180 tab-close-other
181 .It C-x t 2
182 tab-new
183 .It C-x t o
184 tab-next
185 .It C-x t O
186 tab-previous
187 .It C-x t m
188 tab-move
189 .It C-x t M
190 tab-move-to
191 .It C-M-b
192 previous-page
193 .It C-M-f
194 next-page
195 .It <f7> a
196 bookmark-page
197 .It <f7> <f7>
198 list-bookmarks
199 .El
200 .Ss Xr vi 1 Ns -like keys
201 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
202 .It k
203 previous-line
204 .It j
205 next-line
206 .It l
207 forward-char
208 .It h
209 backward-char
210 .It {
211 backward-paragraph
212 .It }
213 forward-paragraph
214 .It ^
215 move-beginning-of-line
216 .It $
217 move-end-of-line
218 .It K
219 scroll-line-up
220 .It J
221 scroll-line-down
222 .It g g
223 beginning-of-buffer
224 .It G
225 end-of-buffer
226 .It g D
227 tab-close
228 .It g N
229 tab-new
230 .It g t
231 tab-next
232 .It g T
233 tab-previous
234 .It g M-t
235 tab-move
236 .It g M-T
237 tab-move-to
238 .It H
239 previous-page
240 .It L
241 next-page
242 .It q
243 kill-telescope
244 .It ESC
245 clear-minibuf
246 .It :
247 execute-extended-command
248 .El
249 .Ss CUA-like keys
250 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
251 .It <up>
252 previous-line
253 .It <down>
254 next-line
255 .It <right>
256 forward-char
257 .It <left>
258 backward-char
259 .It <prior>
260 scroll-up
261 .It <next>
262 scroll-down
263 .It M-<left>
264 previous-page
265 .It M-<right>
266 next-page
267 .El
268 .Ss Neither Emacs nor vi specific
269 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
270 .It <f1>
271 toggle-help
272 .It enter
273 push-button
274 .It M-enter
275 push-button-new-tab
276 .It M-tab
277 previous-button
278 .It backtab
279 previous-button
280 .It tab
281 next-button
282 .El
283 .Ss Minibuffer-specific keys
284 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
285 .It enter
286 mini-complete-and-exit
287 .It C-g
288 mini-abort
289 .It ESC
290 mini-abort
291 .It C-d
292 mini-delete-char
293 .It del
294 mini-delete-backward-char
295 .It backspace
296 mini-delete-backward-char
297 .It C-h
298 mini-delete-backward-char
299 .It C-b
300 backward-char
301 .It C-f
302 forward-char
303 .It <left>
304 backward-char
305 .It <right>
306 forward-char
307 .It C-e
308 move-end-of-line
309 .It C-a
310 move-beginning-of-line
311 .It <end>
312 move-end-of-line
313 .It <home>
314 move-beginning-of-line
315 .It C-k
316 mini-kill-line
317 .It M-p
318 mini-previous-history-element
319 .It M-n
320 mini-next-history-element
321 .It <up>
322 mini-previous-history-element
323 .It <down>
324 mini-next-history-element
325 .El
326 .Sh INTERACTIVE COMMANDS
327 Follows the documentation for the interactive commands.
328 These commands can be bound to a key or executed with
329 .Ic execute-extended-command .
330 .Ss Movement commands
331 .Bl -tag -width execute-extended-command -compact
332 .It Ic backward-char
333 Move point one character backward.
334 .It Ic backward-paragraph
335 Move point one paragraph backward.
336 .It Ic beginning-of-buffer
337 Move point to the beginning of the buffer.
338 .It Ic end-of-buffer
339 Move point to the end of the buffer.
340 .It Ic forward-char
341 Move point one character forward.
342 .It Ic forward-paragraph
343 Move point one paragraph forward.
344 .It Ic move-beginning-of-line
345 Move point at the beginning of the current (visual) line.
346 .It Ic move-end-of-line
347 Move point at the end of the current (visual) line.
348 .It Ic next-button
349 Move point to the next link.
350 .It Ic next-line
351 Move point to the next (visual) line, in the same column if possible.
352 .It Ic previous-button
353 Move point to the previous link.
354 .It Ic previous-line
355 Move point to the previous (visual) line.
356 .El
357 .Ss Bookmark-related commands
358 .Bl -tag -width execute-extended-command -compact
359 .It Ic bookmark-page
360 Add a link to the bookmark file.
361 It preloads the minibuffer with the current URL.
362 .It Ic list-bookmarks
363 Load the bookmarks page.
364 .El
365 .Ss Tab-related commands
366 .Bl -tag -width execute-extended-command -compact
367 .It Ic tab-close
368 Close the current tab.
369 .It Ic tab-close-other
370 Close all tabs but the current one.
371 .It Ic tab-move
372 Move the current tab after the next one, wrapping around if
373 needed.
374 .It Ic tab-move-to
375 Move the current tab before the previous one, wrapping around if needed.
376 .It Ic tab-new
377 Open a new tab.
378 .It Ic tab-next
379 Focus next tab, wrapping around eventually.
380 .It Ic tab-previous
381 Focus the previous tab, wrapping around eventually.
382 .El
383 .Ss Misc commands
384 .Bl -tag -width execute-extended-command -compact
385 .It Ic clear-minibuf
386 Clears the echo area.
387 .It Ic execute-extended-command
388 Prompts for a command name using the minibuffer.
389 .It Ic kill-telescope
390 Quit
391 .Nm .
392 .It Ic load-current-url
393 Prompts for an URL, the minibuffer is preloaded with the current
394 one.
395 .It Ic load-url
396 Prompts for an URL.
397 .It Ic next-page
398 Load the next item in the history list.
399 .It Ic olivetti-mode
400 Toggle olivetti mode (i.e. horizontal centering of the lines of the
401 window.)
402 .It Ic previous-page
403 Load the previous item in the history list.
404 .It Ic push-button
405 Follow the link on the current line.
406 .It Ic push-button-new-tab
407 Follow the link on the current line on a new tab.
408 .It Ic redraw
409 Redraw the screen, useful if some background program messed up the
410 display.
411 .It Ic scroll-down
412 Scroll down by one visual page.
413 .It Ic scroll-line-down
414 Scroll down by one line.
415 .It Ic scroll-line-up
416 Scroll up by one line.
417 .It Ic scroll-up
418 Scroll up by one visual page.
419 .It Ic toggle-help
420 Toggle side window with help about available keys and their associated
421 interactive command.
422 .El
423 .Ss Minibuffer commands
424 .Bl -tag -width execute-extended-command -compact
425 .It Ic mini-abort
426 Abort the current minibuffer action.
427 .It Ic mini-complete-and-exit
428 Complete the current minibuffer action.
429 .It Ic mini-delete-backward-char
430 Delete the character before the point.
431 .It Ic mini-delete-char
432 Delete the character after the point.
433 .It Ic mini-kill-line
434 Delete from the point until the end of the line.
435 .It Ic mini-next-history-element
436 Load the previous history element.
437 .It Ic mini-previous-history-element
438 Load the next history element.
439 .El
440 .Ss Aliases
441 The following aliases are available during
442 .Ic execute-extended-command :
443 .Bl -tag -width 16m -compact
444 .It Ic tabn
445 .Ic tab-next
446 .It Ic tabnew
447 .Ic tab-new
448 .It Ic tabp
449 .Ic tab-previous
450 .It Ic q No and Ic wq
451 .Ic kill-telescope
452 .El
453 .Sh CONFIGURATION FILE
454 During the startup,
455 .Nm
456 reads the configuration file at
457 .Pa ~/.telescope/config
458 or the one given with the
459 .Fl c
460 flag.
461 .Pp
462 The format of the configuration file is fairly flexible.
463 The current line can be extended over multiple ones using a
464 backslash
465 .Pq Sq \e .
466 Comments can be put anywhere in the file using a hash mark
467 .Pq Sq # ,
468 and extend to the end of the current line, but backslashes can't be
469 used to extend comments over multiple lines.
470 .Pp
471 The following constructs are available:
472 .Bl -tag -width Ds
473 .It Ic set Ar opt No = Ar val
474 Set the option
475 .Ar opt
476 to the value
477 .Ar val .
478 Valid options are:
479 .Pp
480 .Bl -tag -width twelveletters -compact
481 .It enable-colors
482 .Pq integer
483 If not zero, enable colours.
484 By default is 1 if
485 .Ev NO_COLORS
486 is not set, 0 otherwise.
487 .It fill-column
488 .Pq integer
489 If greater than zero, lines of text will be formatted in a way that
490 don't exceed the given number of columns.
491 By default is 80.
492 .It new-tab-url
493 .Pq string
494 URL for the new tab page.
495 By default is
496 .Dq about:new .
497 .It olivetti-mode
498 .Pq integer
499 Enable
500 .Ic olivetti-mode
501 if non zero.
502 By default is 1.
503 .El
504 .It Ic proxy Ar proto Ic via Ar url
505 Use
506 .Ar url
507 as proxy for all URLs with
508 protocol
509 .Ar proto .
510 .Ar url
511 must be a Gemini URI without path, query and fragment component.
512 .It Ic style Ar name Ar option
513 Change the styling of the element identified by
514 .Ar name .
515 Multiple options may be specified within curly braces.
516 Valid style identifiers are:
517 .Bl -tag -width 14m -compact -offset Ds
518 .It line.text
519 for text lines
520 .It line.link
521 for link lines
522 .It line.title1..3
523 for headings
524 .It line.item
525 for item lines
526 .It line.quote
527 for quotes
528 .It line.pre.start
529 for the heading of a preformatted block
530 .It line.pre
531 for the content of a preformatted block
532 .It line.pre.end
533 for the closing line of a preformatted block
534 .El
535 .Pp
536 Valid options are:
537 .Bl -tag -width Ds
538 .It Ic attr Ar prefix Oo Ar line Oo Ar trail Oc Oc
539 Sets the text attributes.
540 If only one value is given,
541 .Ar line
542 and
543 .Ar trail
544 default to that; if two values are given then
545 .Ar trail
546 defaults to
547 .Ar prefix .
548 Each attribute is a comma-separated list of keywords:
549 .Bl -tag -width underline -compact -offset Ds
550 .It Ic normal
551 no attributes.
552 .It Ic standout
553 best highlighting mode for the terminal.
554 .It Ic underline
555 underlines the text.
556 .It Ic reverse
557 reverses background/foreground colors.
558 .It Ic blink
559 makes the text blinking.
560 .It Ic dim
561 half bright.
562 .It Ic bold
563 extra bright or bold.
564 .El
565 .It Ic bg Ar prefix Oo Ar line Oo Ar trail Oc Oc
566 Sets the background color.
567 Follows the same behaviour as
568 .Ic attr
569 regarding the optional parameters.
570 Supported colors are: default, black, red, green, yellow, blue,
571 magenta, cyan and white
572 .It Ic fg Ar prefix Oo Ar line Oo Ar trail Oc Oc
573 Sets the foreground color.
574 It behaves just like
575 .Ic bg .
576 .It Ic prefix Ar prfx Op Ar cont
577 Sets the prefix for the given line to
578 .Ar prfx
579 and
580 .Ar cont
581 as the prefix for the continuation lines
582 .Pq i.e. when a long line gets wrapped.
583 If
584 .Ar cont
585 is not given its value will be the same of
586 .Ar prfx .
587 .El
588 .El
589 .Sh FILES
590 .Bl -tag -width Ds -compact
591 .It Pa ~/.telescope/bookmarks.gmi
592 Holds the bookmarks.
593 .It Pa ~/.telescope/config
594 Default configuration file.
595 .It Pa ~/.telescope/known_hosts
596 Contains a list of host keys for all the hosts the user has visited.
597 See the TOFU section for more info.
598 .It Pa ~/.telescope/session
599 Contains the list of opened tabs in the last session, one per line.
600 Gets written on
601 .Ic kill-telescope
602 and loaded on startup.
603 .El
604 .Sh EXAMPLES
605 The following is my config file:
606 .Bd -literal -offset indent
607 # ignore the NO_COLOR environment variable
608 set enable-colors = 1
610 style line.item {
611 prefix " • " " "
614 style line.link {
615 prefix "→ " " "
616 fg blue
617 attr normal underline
620 style line.quote {
621 prefix " ┃ "
623 .Ed
624 .Pp
625 It's possible to browse
626 .Dq the small web
627 .Pq i.e. simple websites
628 using programs like the duckling-proxy by defining a proxy in
629 .Pa ~/.telescope/config :
630 .Bd -literal -offset indent
631 proxy http via "gemini://localhost:1965"
632 proxy https via "gemini://localhost:1965"
633 .Ed
634 .Pp
635 To load
636 .Nm
637 without any configuration use
638 .Bd -literal -offset indent
639 telescope -c /dev/null
640 .Ed
641 .Sh AUTHORS
642 .An -nosplit
643 The
644 .Nm
645 program was written by
646 .An Omar Polo Aq Mt op@omarpolo.com .