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 C-c {
172 dec-fill-column
173 .It C-c }
174 inc-fill-column
175 .It C-c p
176 previous-heading
177 .It C-c n
178 next-heading
179 .It >
180 load-url
181 .It C-x C-f
182 load-url
183 .It C-x M-f
184 load-current-url
185 .It C-x t 0
186 tab-close
187 .It C-x t 1
188 tab-close-other
189 .It C-x t 2
190 tab-new
191 .It C-x t o
192 tab-next
193 .It C-x t O
194 tab-previous
195 .It C-x t m
196 tab-move
197 .It C-x t M
198 tab-move-to
199 .It B, C-M-b
200 previous-page
201 .It F, C-M-f
202 next-page
203 .It <f7> a
204 bookmark-page
205 .It <f7> <f7>
206 list-bookmarks
207 .El
208 .Ss Xr vi 1 Ns -like keys
209 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
210 .It k
211 previous-line
212 .It j
213 next-line
214 .It l
215 forward-char
216 .It h
217 backward-char
218 .It {
219 backward-paragraph
220 .It }
221 forward-paragraph
222 .It ^
223 move-beginning-of-line
224 .It $
225 move-end-of-line
226 .It K
227 scroll-line-up
228 .It J
229 scroll-line-down
230 .It g g
231 beginning-of-buffer
232 .It G
233 end-of-buffer
234 .It g D
235 tab-close
236 .It g N
237 tab-new
238 .It g t
239 tab-next
240 .It g T
241 tab-previous
242 .It g M-t
243 tab-move
244 .It g M-T
245 tab-move-to
246 .It H
247 previous-page
248 .It L
249 next-page
250 .It q
251 kill-telescope
252 .It ESC
253 clear-minibuf
254 .It :
255 execute-extended-command
256 .El
257 .Ss CUA-like keys
258 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
259 .It <up>
260 previous-line
261 .It <down>
262 next-line
263 .It <right>
264 forward-char
265 .It <left>
266 backward-char
267 .It <prior>
268 scroll-up
269 .It <next>
270 scroll-down
271 .It C-w
272 tab-close
273 .It C-t
274 tab-new
275 .It M-<prior>
276 tab-previous
277 .It M-<next>
278 tab-next
279 .It M-<left>
280 previous-page
281 .It M-<right>
282 next-page
283 .El
284 .Ss Neither Emacs nor vi specific
285 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
286 .It <f1>
287 toggle-help
288 .It enter
289 push-button
290 .It M-enter
291 push-button-new-tab
292 .It M-tab
293 previous-button
294 .It backtab
295 previous-button
296 .It tab
297 next-button
298 .El
299 .Ss Minibuffer-specific keys
300 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
301 .It enter
302 mini-complete-and-exit
303 .It C-g
304 mini-abort
305 .It ESC
306 mini-abort
307 .It C-d
308 mini-delete-char
309 .It del
310 mini-delete-backward-char
311 .It backspace
312 mini-delete-backward-char
313 .It C-h
314 mini-delete-backward-char
315 .It C-b
316 backward-char
317 .It C-f
318 forward-char
319 .It <left>
320 backward-char
321 .It <right>
322 forward-char
323 .It C-e
324 move-end-of-line
325 .It C-a
326 move-beginning-of-line
327 .It <end>
328 move-end-of-line
329 .It <home>
330 move-beginning-of-line
331 .It C-k
332 mini-kill-line
333 .It M-p
334 mini-previous-history-element
335 .It M-n
336 mini-next-history-element
337 .It <up>
338 mini-previous-history-element
339 .It <down>
340 mini-next-history-element
341 .It C-p
342 previous-completion
343 .It C-n
344 next-completion
345 .It tab
346 insert-current-candidate
347 .El
348 .Sh INTERACTIVE COMMANDS
349 Follows the documentation for the interactive commands.
350 These commands can be bound to a key or executed with
351 .Ic execute-extended-command .
352 .Ss Movement commands
353 .Bl -tag -width execute-extended-command -compact
354 .It Ic backward-char
355 Move point one character backward.
356 .It Ic backward-paragraph
357 Move point one paragraph backward.
358 .It Ic beginning-of-buffer
359 Move point to the beginning of the buffer.
360 .It Ic end-of-buffer
361 Move point to the end of the buffer.
362 .It Ic forward-char
363 Move point one character forward.
364 .It Ic forward-paragraph
365 Move point one paragraph forward.
366 .It Ic insert-current-candidate
367 Copy the current selection text as minibuffer input.
368 .It Ic move-beginning-of-line
369 Move point at the beginning of the current (visual) line.
370 .It Ic move-end-of-line
371 Move point at the end of the current (visual) line.
372 .It Ic next-button
373 Move point to the next link.
374 .It Ic next-completion
375 Select the next completion.
376 .It Ic next-heading
377 Move point to the next heading.
378 .It Ic next-line
379 Move point to the next (visual) line, in the same column if possible.
380 .It Ic previous-button
381 Move point to the previous link.
382 .It Ic previous-completion
383 Select the previous completion.
384 .It Ic previous-heading
385 Move point to the previous heading.
386 .It Ic previous-line
387 Move point to the previous (visual) line.
388 .El
389 .Ss Bookmark-related commands
390 .Bl -tag -width execute-extended-command -compact
391 .It Ic bookmark-page
392 Add a link to the bookmark file.
393 It preloads the minibuffer with the current URL.
394 .It Ic list-bookmarks
395 Load the bookmarks page.
396 .El
397 .Ss Tab-related commands
398 .Bl -tag -width execute-extended-command -compact
399 .It Ic tab-close
400 Close the current tab.
401 .It Ic tab-close-other
402 Close all tabs but the current one.
403 .It Ic tab-move
404 Move the current tab after the next one, wrapping around if
405 needed.
406 .It Ic tab-move-to
407 Move the current tab before the previous one, wrapping around if needed.
408 .It Ic tab-new
409 Open a new tab.
410 .It Ic tab-next
411 Focus next tab, wrapping around eventually.
412 .It Ic tab-previous
413 Focus the previous tab, wrapping around eventually.
414 .El
415 .Ss Misc commands
416 .Bl -tag -width execute-extended-command -compact
417 .It Ic clear-minibuf
418 Clears the echo area.
419 .It Ic dec-fill-column
420 Decrements fill-column by two.
421 .It Ic execute-extended-command
422 Prompts for a command name using the minibuffer.
423 .It Ic kill-telescope
424 Quit
425 .Nm .
426 .It Ic inc-fill-column
427 Increments fill-column by two.
428 .It Ic load-current-url
429 Prompts for an URL, the minibuffer is preloaded with the current
430 one.
431 .It Ic load-url
432 Prompts for an URL.
433 .It Ic next-page
434 Load the next item in the history list.
435 .It Ic olivetti-mode
436 Toggle olivetti mode (i.e. horizontal centering of the lines of the
437 window.)
438 .It Ic previous-page
439 Load the previous item in the history list.
440 .It Ic push-button
441 Follow the link on the current line, or toggle the visibility of the
442 following preformatted block if called when the cursor is on the
443 heading of the block.
444 .It Ic push-button-new-tab
445 Follow the link on the current line on a new tab.
446 .It Ic redraw
447 Redraw the screen, useful if some background program messed up the
448 display.
449 .It Ic scroll-down
450 Scroll down by one visual page.
451 .It Ic scroll-line-down
452 Scroll down by one line.
453 .It Ic scroll-line-up
454 Scroll up by one line.
455 .It Ic scroll-up
456 Scroll up by one visual page.
457 .It Ic toggle-help
458 Toggle side window with help about available keys and their associated
459 interactive command.
460 .El
461 .Ss Minibuffer commands
462 .Bl -tag -width execute-extended-command -compact
463 .It Ic mini-abort
464 Abort the current minibuffer action.
465 .It Ic mini-complete-and-exit
466 Complete the current minibuffer action.
467 .It Ic mini-delete-backward-char
468 Delete the character before the point.
469 .It Ic mini-delete-char
470 Delete the character after the point.
471 .It Ic mini-kill-line
472 Delete from the point until the end of the line.
473 .It Ic mini-next-history-element
474 Load the previous history element.
475 .It Ic mini-previous-history-element
476 Load the next history element.
477 .El
478 .Ss Aliases
479 The following aliases are available during
480 .Ic execute-extended-command :
481 .Bl -tag -width 16m -compact
482 .It Ic tabn
483 .Ic tab-next
484 .It Ic tabnew
485 .Ic tab-new
486 .It Ic tabp
487 .Ic tab-previous
488 .It Ic q No and Ic wq
489 .Ic kill-telescope
490 .El
491 .Sh CONFIGURATION FILE
492 During the startup,
493 .Nm
494 reads the configuration file at
495 .Pa ~/.telescope/config
496 or the one given with the
497 .Fl c
498 flag.
499 .Pp
500 The format of the configuration file is fairly flexible.
501 The current line can be extended over multiple ones using a
502 backslash
503 .Pq Sq \e .
504 Comments can be put anywhere in the file using a hash mark
505 .Pq Sq # ,
506 and extend to the end of the current line, but backslashes can't be
507 used to extend comments over multiple lines.
508 .Pp
509 The following constructs are available:
510 .Bl -tag -width Ds
511 .It Ic bind Ar map Ar key Ar cmd
512 Bind
513 .Ar key
514 to the function
515 .Ar cmd
516 in the keymap
517 .Ar map .
518 Valid values for map are
519 .Dq global-map
520 .Pq i.e. when the user is viewing a page
521 and
522 .Dq minibuffer-map
523 .Pq i.e. when the minibuffer has the focus.
524 .Ar key
525 follows the same syntax described in
526 .Sx DEFAULT KEY BINDINGS
527 and all the possible functions are listed in
528 .Sx INTERACTIVE COMMANDS .
529 .It Ic proxy Ar proto Ic via Ar url
530 Use
531 .Ar url
532 as proxy for all URLs with
533 protocol
534 .Ar proto .
535 .Ar url
536 must be a Gemini URI without path, query and fragment component.
537 .It Ic set Ar opt No = Ar val
538 Set the option
539 .Ar opt
540 to the value
541 .Ar val .
542 Valid options are:
543 .Pp
544 .Bl -tag -width twelveletters -compact
545 .It enable-colors
546 .Pq integer
547 If not zero, enable colours.
548 By default is 1 if
549 .Ev NO_COLORS
550 is not set, 0 otherwise.
551 .It fill-column
552 .Pq integer
553 If greater than zero, lines of text will be formatted in a way that
554 don't exceed the given number of columns.
555 By default is 80.
556 .It hide-pre-blocks
557 .Pq integer
558 If nonzero, hide by default the body of the preformatted blocks.
559 By default is zero.
560 .Ic push-button
561 can be used to toggle the visibility per-block.
562 .It hide-pre-context
563 .Pq integer
564 If nonzero, hide the start and end line of the preformatted blocks.
565 If both hide-pre-context and hide-pre-blocks are nonzero, preformatted
566 blocks are irremediably hidden.
567 By default is zero.
568 .It new-tab-url
569 .Pq string
570 URL for the new tab page.
571 By default is
572 .Dq about:new .
573 .It olivetti-mode
574 .Pq integer
575 Enable
576 .Ic olivetti-mode
577 if non zero.
578 By default is 1.
579 .El
580 .It Ic style Ar name Ar option
581 Change the styling of the element identified by
582 .Ar name .
583 Multiple options may be specified within curly braces.
584 Valid style identifiers are:
585 .Bl -tag -width 16m -compact -offset Ds
586 .It line
587 for the area outside the lines in the body of the page.
588 .It line.text
589 for text lines.
590 .It line.link
591 for link lines.
592 .It line.title1..3
593 for headingse
594 .It line.item
595 for item lines.
596 .It line.quote
597 for quotes.
598 .It line.pre.start
599 for the heading of a preformatted block.
600 .It line.pre
601 for the content of a preformatted block.
602 .It line.pre.end
603 for the closing line of a preformatted block.
604 .It minibuffer
605 for the minibuffer
606 .Dq i.e. the last line of the window
607 .It modeline
608 for the modeline
609 .Dq i.e. the info line right above the minibuffer
610 .It tabline
611 for the tabline.
612 .It tabline.tab
613 for the non-focused tabs.
614 .It tabline.current
615 for the focused tab.
616 .El
617 .Pp
618 Valid options are:
619 .Bl -tag -width Ds
620 .It Ic attr Ar prefix Oo Ar line Oo Ar trail Oc Oc
621 Sets the text attributes.
622 If only one value is given,
623 .Ar line
624 and
625 .Ar trail
626 default to that; if two values are given then
627 .Ar trail
628 defaults to
629 .Ar prefix .
630 Each attribute is a comma-separated list of keywords:
631 .Bl -tag -width underline -compact -offset Ds
632 .It Ic normal
633 no attributes.
634 .It Ic standout
635 best highlighting mode for the terminal.
636 .It Ic underline
637 underlines the text.
638 .It Ic reverse
639 reverses background/foreground colors.
640 .It Ic blink
641 makes the text blinking.
642 .It Ic dim
643 half bright.
644 .It Ic bold
645 extra bright or bold.
646 .El
647 .Pp
648 Only the styles under the
649 .Dq line.
650 prefix accept up to three attributes.
651 The other will only use the first one given.
652 .It Ic bg Ar prefix Oo Ar line Oo Ar trail Oc Oc
653 Sets the background color.
654 Follows the same behaviour as
655 .Ic attr
656 regarding the optional parameters.
657 The colour is one of black, red, green, yellow, blue,
658 magenta, cyan and white; colour0 to colour255
659 .Pq or color0 to color255
660 from the 256-colour set;
661 default for the default colour.
662 .It Ic fg Ar prefix Oo Ar line Oo Ar trail Oc Oc
663 Sets the foreground color.
664 It behaves just like
665 .Ic bg .
666 .It Ic prefix Ar prfx Op Ar cont
667 Sets the prefix for the current line type to
668 .Ar prfx
669 and
670 .Ar cont
671 as the prefix for the continuation lines
672 .Pq i.e. when a long line gets wrapped.
673 If
674 .Ar cont
675 is not given its value will be the same of
676 .Ar prfx .
677 .El
678 .El
679 .Sh FILES
680 .Bl -tag -width Ds -compact
681 .It Pa ~/.telescope/bookmarks.gmi
682 Holds the bookmarks.
683 .It Pa ~/.telescope/config
684 Default configuration file.
685 .It Pa ~/.telescope/known_hosts
686 Contains a list of host keys for all the hosts the user has visited.
687 See the TOFU section for more info.
688 .It Pa ~/.telescope/session
689 Contains the list of opened tabs in the last session, one per line.
690 Gets written on
691 .Ic kill-telescope
692 and loaded on startup.
693 .El
694 .Sh EXAMPLES
695 The following is my config file:
696 .Bd -literal -offset indent
697 # enable colors regardless of $NO_COLOR
698 set enable-colors = 1
700 style line.item {
701 prefix " • " " "
704 style line.link {
705 prefix "→ " " "
708 style line.quote {
709 prefix " ┃ "
711 .Ed
712 .Pp
713 It's possible to browse
714 .Dq the small web
715 .Pq i.e. simple websites
716 by using programs like the duckling-proxy by defining a proxy in
717 .Pa ~/.telescope/config :
718 .Bd -literal -offset indent
719 proxy http via "gemini://localhost:1965"
720 proxy https via "gemini://localhost:1965"
721 .Ed
722 .Pp
723 To load
724 .Nm
725 without any configuration use
726 .Bd -literal -offset indent
727 telescope -c /dev/null
728 .Ed
729 .Sh AUTHORS
730 .An -nosplit
731 The
732 .Nm
733 program was written by
734 .An Omar Polo Aq Mt op@omarpolo.com .