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