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 hnv
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 xxxxxxxxxxxxx
36 .It Fl h , Fl -help
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 .It Fl v , Fl -version
47 Display version.
48 .El
49 .Sh TOFU
50 .Nm
51 aims to use the "Trust, but Verify (where appropriate)" approach.
52 The idea is to define three level of verification for a certificate:
53 .Bl -tag -width 12m
54 .It untrusted
55 the server fingerprint does NOT match the stored value
56 .It trusted
57 the server fingerprint matches the store one
58 .It verified
59 the fingerprint matches and has been verified out-of-band
60 .El
61 .Pp
62 Most of the time the
63 .Dq trusted
64 level is enough, but where is appropriate users should be able to
65 verify out-of-band the certificate.
66 .Pp
67 At the moment, there is no built-in support for an out-of-band
68 verification though.
69 .Pp
70 Known certificates are store in
71 .Pa ~/.telescope/known_hosts
72 with a format similar to the
73 .Xr ssh 1 Ns '
74 .Pa known_hosts
75 file.
76 Each line is a record and it's made up by three fields, separated by a
77 single space, according to the following format:
78 .Dq HOST HASH TRUSTED
79 where:
80 .Bl -tag -width 12m
81 .It HOST
82 the hostname, optionally followed by a colon (":") and a port number.
83 .It HASH
84 is the hash of the certificate, as outputted by
85 .Xr tls_peer_cert_hash 3 .
86 .It TRUSTED
87 a single digit.
88 0 means trusted, 1 verified.
89 .El
90 .Sh DEFAULT KEY BINDINGS
91 The default key bindings are very similar to GNU Emacs, but care has
92 been taken to include also bindings familiar for
93 .Xr vi 1
94 and
95 .Dq CUA
96 users.
97 In the following examples, C-x means Control-x, M-x means Meta-x,
98 where the Meta key may be either a special key on the keyboard or the
99 ALT key; otherwise ESC followed by the key X works as well, and C-M-x
100 means to press the key X together with both Control and Meta.
101 .Pp
102 Keys are usually a single character, like
103 .Sq p
104 or
105 .Sq n ,
106 but some special keys are accepted as well.
107 .Pp
108 .Bl -tag -width 16m -offset indent -compact
109 .It <up>
110 Up arrow
111 .It <down>
112 Down arrow
113 .It <left>
114 Left arrow
115 .It <right>
116 Right arrow
117 .It <prior>
118 Previous page/Page up
119 .It <next>
120 Next page/Page down
121 .It <home>
122 Home
123 .It <end>
124 End
125 .It <f0> thru <f63>
126 Function keys
127 .It del or backspace
128 Backspace
129 .It esc
130 Escape
131 .It space or spc
132 Space
133 .It enter or ret
134 Enter
135 .It tab
136 Tab
137 .It backtab
138 Depends on the configuration of the terminal emulator.
139 Usually is shift tab though.
140 .El
141 .Ss GNU Emacs-like keys
142 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
143 .It C-p
144 previous-line
145 .It C-n
146 next-line
147 .It C-f
148 forward-char
149 .It C-b
150 backward-char
151 .It M-{
152 backward-paragraph
153 .It M-}
154 forward-paragraph
155 .It C-a
156 move-beginning-of-line
157 .It C-e
158 move-end-of-line
159 .It M-v, M-space
160 scroll-up
161 .It C-v, space
162 scroll-down
163 .It M-<
164 beginning-of-buffer
165 .It M->
166 end-of-buffer
167 .It C-x C-c
168 kill-telescope
169 .It C-g
170 clear-minibuf
171 .It M-x
172 execute-extended-command
173 .It C-c {
174 dec-fill-column
175 .It C-c }
176 inc-fill-column
177 .It C-c p
178 previous-heading
179 .It C-c n
180 next-heading
181 .It >
182 load-url
183 .It <
184 load-current-url
185 .It C-x C-f
186 load-url
187 .It C-x M-f
188 load-current-url
189 .It C-x t 0
190 tab-close
191 .It C-x t 1
192 tab-close-other
193 .It C-x t 2
194 tab-new
195 .It C-x t o
196 tab-next
197 .It C-x t O
198 tab-previous
199 .It C-x t m
200 tab-move
201 .It C-x t M
202 tab-move-to
203 .It B, C-M-b
204 previous-page
205 .It F, C-M-f
206 next-page
207 .It <f7> a
208 bookmark-page
209 .It <f7> <f7>
210 list-bookmarks
211 .El
212 .Ss Xr vi 1 Ns -like keys
213 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
214 .It k
215 previous-line
216 .It j
217 next-line
218 .It l
219 forward-char
220 .It h
221 backward-char
222 .It {
223 backward-paragraph
224 .It }
225 forward-paragraph
226 .It ^
227 move-beginning-of-line
228 .It $
229 move-end-of-line
230 .It K
231 scroll-line-up
232 .It J
233 scroll-line-down
234 .It g g
235 beginning-of-buffer
236 .It G
237 end-of-buffer
238 .It g D
239 tab-close
240 .It g N
241 tab-new
242 .It g t
243 tab-next
244 .It g T
245 tab-previous
246 .It g M-t
247 tab-move
248 .It g M-T
249 tab-move-to
250 .It H
251 previous-page
252 .It L
253 next-page
254 .It q
255 kill-telescope
256 .It ESC
257 clear-minibuf
258 .It :
259 execute-extended-command
260 .El
261 .Ss CUA-like keys
262 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
263 .It <up>
264 previous-line
265 .It <down>
266 next-line
267 .It <right>
268 forward-char
269 .It <left>
270 backward-char
271 .It <prior>
272 scroll-up
273 .It <next>
274 scroll-down
275 .It C-w
276 tab-close
277 .It C-t
278 tab-new
279 .It M-<prior>
280 tab-previous
281 .It M-<next>
282 tab-next
283 .It M-<left>
284 previous-page
285 .It M-<right>
286 next-page
287 .It <f5>
288 reload-page
289 .It r
290 reload-page
291 .El
292 .Ss Neither Emacs nor vi specific
293 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
294 .It <f1>
295 toggle-help
296 .It enter
297 push-button
298 .It M-enter
299 push-button-new-tab
300 .It M-tab
301 previous-button
302 .It backtab
303 previous-button
304 .It tab
305 next-button
306 .It M-t
307 tab-select
308 .It M-l
309 link-select
310 .It M-/
311 swiper
312 .El
313 .Ss Minibuffer-specific keys
314 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
315 .It enter
316 mini-complete-and-exit
317 .It C-g
318 mini-abort
319 .It ESC
320 mini-abort
321 .It C-d
322 mini-delete-char
323 .It del
324 mini-delete-backward-char
325 .It backspace
326 mini-delete-backward-char
327 .It C-h
328 mini-delete-backward-char
329 .It C-b
330 backward-char
331 .It C-f
332 forward-char
333 .It <left>
334 backward-char
335 .It <right>
336 forward-char
337 .It C-e
338 move-end-of-line
339 .It C-a
340 move-beginning-of-line
341 .It <end>
342 move-end-of-line
343 .It <home>
344 move-beginning-of-line
345 .It C-k
346 mini-kill-line
347 .It M-p
348 mini-previous-history-element
349 .It M-n
350 mini-next-history-element
351 .It C-p
352 previous-completion
353 .It C-n
354 next-completion
355 .It <up>
356 previous-completion
357 .It <down>
358 next-completion
359 .It tab
360 insert-current-candidate
361 .El
362 .Sh INTERACTIVE COMMANDS
363 Follows the documentation for the interactive commands.
364 These commands can be bound to a key or executed with
365 .Ic execute-extended-command .
366 .Ss Movement commands
367 .Bl -tag -width execute-extended-command -compact
368 .It Ic backward-char
369 Move point one character backward.
370 .It Ic backward-paragraph
371 Move point one paragraph backward.
372 .It Ic beginning-of-buffer
373 Move point to the beginning of the buffer.
374 .It Ic end-of-buffer
375 Move point to the end of the buffer.
376 .It Ic forward-char
377 Move point one character forward.
378 .It Ic forward-paragraph
379 Move point one paragraph forward.
380 .It Ic insert-current-candidate
381 Copy the current selection text as minibuffer input.
382 .It Ic move-beginning-of-line
383 Move point at the beginning of the current (visual) line.
384 .It Ic move-end-of-line
385 Move point at the end of the current (visual) line.
386 .It Ic next-button
387 Move point to the next link.
388 .It Ic next-completion
389 Select the next completion.
390 .It Ic next-heading
391 Move point to the next heading.
392 .It Ic next-line
393 Move point to the next (visual) line, in the same column if possible.
394 .It Ic previous-button
395 Move point to the previous link.
396 .It Ic previous-completion
397 Select the previous completion.
398 .It Ic previous-heading
399 Move point to the previous heading.
400 .It Ic previous-line
401 Move point to the previous (visual) line.
402 .El
403 .Ss Bookmark-related commands
404 .Bl -tag -width execute-extended-command -compact
405 .It Ic bookmark-page
406 Add a link to the bookmark file.
407 It preloads the minibuffer with the current URL.
408 .It Ic list-bookmarks
409 Load the bookmarks page.
410 .El
411 .Ss Tab-related commands
412 .Bl -tag -width execute-extended-command -compact
413 .It Ic tab-close
414 Close the current tab.
415 .It Ic tab-close-other
416 Close all tabs but the current one.
417 .It Ic tab-move
418 Move the current tab after the next one, wrapping around if
419 needed.
420 .It Ic tab-move-to
421 Move the current tab before the previous one, wrapping around if needed.
422 .It Ic tab-new
423 Open a new tab.
424 .It Ic tab-next
425 Focus next tab, wrapping around eventually.
426 .It Ic tab-previous
427 Focus the previous tab, wrapping around eventually.
428 .It Ic tab-select
429 Switch to a tab using the minibuffer.
430 .El
431 .Ss Misc commands
432 .Bl -tag -width execute-extended-command -compact
433 .It Ic clear-minibuf
434 Clears the echo area.
435 .It Ic dec-fill-column
436 Decrements fill-column by two.
437 .It Ic execute-extended-command
438 Prompts for a command name using the minibuffer.
439 .It Ic kill-telescope
440 Quit
441 .Nm .
442 .It Ic inc-fill-column
443 Increments fill-column by two.
444 .It Ic link-select
445 Select and visit a link using the minibuffer.
446 .It Ic load-current-url
447 Prompts for an URL, the minibuffer is preloaded with the current
448 one.
449 .It Ic load-url
450 Prompts for an URL.
451 .It Ic next-page
452 Load the next item in the history list.
453 .It Ic olivetti-mode
454 Toggle olivetti mode (i.e. horizontal centering of the lines of the
455 window.)
456 .It Ic previous-page
457 Load the previous item in the history list.
458 .It Ic push-button
459 Follow the link on the current line, or toggle the visibility of the
460 following preformatted block if called when the cursor is on the
461 heading of the block.
462 .It Ic push-button-new-tab
463 Follow the link on the current line on a new tab.
464 .It Ic redraw
465 Redraw the screen, useful if some background program messed up the
466 display.
467 .It Ic reload-page
468 Reload the current page.
469 .It Ic scroll-down
470 Scroll down by one visual page.
471 .It Ic scroll-line-down
472 Scroll down by one line.
473 .It Ic scroll-line-up
474 Scroll up by one line.
475 .It Ic scroll-up
476 Scroll up by one visual page.
477 .It Ic swiper
478 Jump to a line using the minibuffer.
479 .It Ic toc
480 Select and jump to a heading of the page using the minibuffer.
481 .It Ic toggle-help
482 Toggle side window with help about available keys and their associated
483 interactive command.
484 .El
485 .Ss Minibuffer commands
486 .Bl -tag -width execute-extended-command -compact
487 .It Ic mini-abort
488 Abort the current minibuffer action.
489 .It Ic mini-complete-and-exit
490 Complete the current minibuffer action.
491 .It Ic mini-delete-backward-char
492 Delete the character before the point.
493 .It Ic mini-delete-char
494 Delete the character after the point.
495 .It Ic mini-kill-line
496 Delete from the point until the end of the line.
497 .It Ic mini-next-history-element
498 Load the previous history element.
499 .It Ic mini-previous-history-element
500 Load the next history element.
501 .El
502 .Ss Aliases
503 The following aliases are available during
504 .Ic execute-extended-command :
505 .Bl -tag -width 16m -compact
506 .It Ic tabn
507 .Ic tab-next
508 .It Ic tabnew
509 .Ic tab-new
510 .It Ic tabp
511 .Ic tab-previous
512 .It Ic q No and Ic wq
513 .Ic kill-telescope
514 .El
515 .Sh CONFIGURATION FILE
516 During the startup,
517 .Nm
518 reads the configuration file at
519 .Pa ~/.telescope/config
520 or the one given with the
521 .Fl c
522 flag.
523 .Pp
524 The format of the configuration file is fairly flexible.
525 The current line can be extended over multiple ones using a
526 backslash
527 .Pq Sq \e .
528 Comments can be put anywhere in the file using a hash mark
529 .Pq Sq # ,
530 and extend to the end of the current line, but backslashes can't be
531 used to extend comments over multiple lines.
532 .Pp
533 The following constructs are available:
534 .Bl -tag -width Ds
535 .It Ic bind Ar map Ar key Ar cmd
536 Bind
537 .Ar key
538 to the function
539 .Ar cmd
540 in the keymap
541 .Ar map .
542 Valid values for map are
543 .Dq global-map
544 .Pq i.e. when the user is viewing a page
545 and
546 .Dq minibuffer-map
547 .Pq i.e. when the minibuffer has the focus.
548 .Ar key
549 follows the same syntax described in
550 .Sx DEFAULT KEY BINDINGS
551 and all the possible functions are listed in
552 .Sx INTERACTIVE COMMANDS .
553 .It Ic proxy Ar proto Ic via Ar url
554 Use
555 .Ar url
556 as proxy for all URLs with
557 protocol
558 .Ar proto .
559 .Ar url
560 must be a Gemini URI without path, query and fragment component.
561 .It Ic set Ar opt No = Ar val
562 Set the option
563 .Ar opt
564 to the value
565 .Ar val .
566 Valid options are:
567 .Pp
568 .Bl -tag -width twelveletters -compact
569 .It enable-colors
570 .Pq integer
571 If not zero, enable colours.
572 By default is 1 if
573 .Ev NO_COLORS
574 is not set, 0 otherwise.
575 .It fill-column
576 .Pq integer
577 If greater than zero, lines of text will be formatted in a way that
578 don't exceed the given number of columns.
579 By default is 80.
580 .It hide-pre-blocks
581 .Pq integer
582 If nonzero, hide by default the body of the preformatted blocks.
583 By default is zero.
584 .Ic push-button
585 can be used to toggle the visibility per-block.
586 .It hide-pre-closing-line
587 .Pq integer
588 If nonzero, hide the closing line of preformatted blocks.
589 .It hide-pre-context
590 .Pq integer
591 If nonzero, hide the start and end line of the preformatted blocks.
592 If both hide-pre-context and hide-pre-blocks are nonzero, preformatted
593 blocks are irremediably hidden.
594 By default is zero.
595 .It new-tab-url
596 .Pq string
597 URL for the new tab page.
598 By default is
599 .Dq about:new .
600 .It olivetti-mode
601 .Pq integer
602 Enable
603 .Ic olivetti-mode
604 if non zero.
605 By default is 1.
606 .El
607 .It Ic style Ar name Ar option
608 Change the styling of the element identified by
609 .Ar name .
610 Multiple options may be specified within curly braces.
611 Valid style identifiers are:
612 .Bl -tag -width 16m -compact -offset Ds
613 .It line
614 for the area outside the lines in the body of the page.
615 .It line.compl
616 for the completion in the minibuffer
617 .It line.compl.current
618 for the current completion
619 .It line.text
620 for text lines.
621 .It line.link
622 for link lines.
623 .It line.title1..3
624 for headings
625 .It line.item
626 for item lines.
627 .It line.quote
628 for quotes.
629 .It line.pre.start
630 for the heading of a preformatted block.
631 .It line.pre
632 for the content of a preformatted block.
633 .It line.pre.end
634 for the closing line of a preformatted block.
635 .It minibuffer
636 for the minibuffer
637 .Dq i.e. the last line of the window
638 .It modeline
639 for the modeline
640 .Dq i.e. the info line right above the minibuffer
641 .It tabline
642 for the tabline.
643 .It tabline.tab
644 for the non-focused tabs.
645 .It tabline.current
646 for the focused tab.
647 .El
648 .Pp
649 Valid options are:
650 .Bl -tag -width Ds
651 .It Ic attr Ar prefix Oo Ar line Oo Ar trail Oc Oc
652 Sets the text attributes.
653 If only one value is given,
654 .Ar line
655 and
656 .Ar trail
657 default to that; if two values are given then
658 .Ar trail
659 defaults to
660 .Ar prefix .
661 Each attribute is a comma-separated list of keywords:
662 .Bl -tag -width underline -compact -offset Ds
663 .It Ic normal
664 no attributes.
665 .It Ic standout
666 best highlighting mode for the terminal.
667 .It Ic underline
668 underlines the text.
669 .It Ic reverse
670 reverses background/foreground colors.
671 .It Ic blink
672 makes the text blinking.
673 .It Ic dim
674 half bright.
675 .It Ic bold
676 extra bright or bold.
677 .El
678 .Pp
679 Only the styles under the
680 .Dq line.
681 prefix accept up to three attributes.
682 The other will only use the first one given.
683 .It Ic bg Ar prefix Oo Ar line Oo Ar trail Oc Oc
684 Sets the background color.
685 Follows the same behaviour as
686 .Ic attr
687 regarding the optional parameters.
688 The colour is one of black, red, green, yellow, blue,
689 magenta, cyan and white; colour0 to colour255
690 .Pq or color0 to color255
691 from the 256-colour set;
692 default for the default colour.
693 .It Ic fg Ar prefix Oo Ar line Oo Ar trail Oc Oc
694 Sets the foreground color.
695 It behaves just like
696 .Ic bg .
697 .It Ic prefix Ar prfx Op Ar cont
698 Sets the prefix for the current line type to
699 .Ar prfx
700 and
701 .Ar cont
702 as the prefix for the continuation lines
703 .Pq i.e. when a long line gets wrapped.
704 If
705 .Ar cont
706 is not given its value will be the same of
707 .Ar prfx .
708 .El
709 .El
710 .Sh FILES
711 .Bl -tag -width Ds -compact
712 .It Pa ~/.telescope/bookmarks.gmi
713 Holds the bookmarks.
714 .It Pa ~/.telescope/config
715 Default configuration file.
716 .It Pa ~/.telescope/known_hosts
717 Contains a list of host keys for all the hosts the user has visited.
718 See the TOFU section for more info.
719 .It Pa ~/.telescope/lock
720 Lock file used to prevent multiple instance of
721 .Nm
722 from running at the same time.
723 .It Pa ~/.telescope/session
724 Contains the list of opened tabs in the last session, one per line.
725 Gets written on
726 .Ic kill-telescope
727 and loaded on startup.
728 .El
729 .Sh EXAMPLES
730 The following is my config file:
731 .Bd -literal -offset indent
732 # enable colors regardless of $NO_COLOR
733 set enable-colors = 1
735 style line.item {
736 prefix " • " " "
739 style line.link {
740 prefix "→ " " "
743 style line.quote {
744 prefix " ┃ "
746 .Ed
747 .Pp
748 It's possible to browse
749 .Dq the small web
750 .Pq i.e. simple websites
751 by using programs like the duckling-proxy by defining a proxy in
752 .Pa ~/.telescope/config :
753 .Bd -literal -offset indent
754 proxy http via "gemini://localhost:1965"
755 proxy https via "gemini://localhost:1965"
756 .Ed
757 .Pp
758 To load
759 .Nm
760 without any configuration use
761 .Bd -literal -offset indent
762 telescope -c /dev/null
763 .Ed
764 .Sh AUTHORS
765 .An -nosplit
766 The
767 .Nm
768 program was written by
769 .An Omar Polo Aq Mt op@omarpolo.com .