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