diff options
-rwxr-xr-x | bollux | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/bollux b/bollux index 2325624..b6fb2a5 100755 --- a/bollux +++ b/bollux | |||
@@ -141,10 +141,16 @@ set_title() { | |||
141 | printf '\e]2;%s - bollux\007' "$*" | 141 | printf '\e]2;%s - bollux\007' "$*" |
142 | } | 142 | } |
143 | 143 | ||
144 | prompt() { | 144 | prompt() { # prompt [-u] PROMPT [READ_ARGS...] |
145 | read_cmd=(read -e -r) | ||
146 | if [[ "$1" == "-u" ]]; then | ||
147 | read_cmd+=(-i "$BOLLUX_URL") | ||
148 | shift | ||
149 | fi | ||
145 | prompt="$1" | 150 | prompt="$1" |
146 | shift | 151 | shift |
147 | read </dev/tty -e -r -p "$prompt> " "$@" | 152 | read_cmd+=(-p "$prompt> ") |
153 | "${read_cmd[@]}" </dev/tty "$@" | ||
148 | } | 154 | } |
149 | 155 | ||
150 | blastoff() { # load a url | 156 | blastoff() { # load a url |
@@ -406,9 +412,7 @@ display() { | |||
406 | text/*) | 412 | text/*) |
407 | set_title "$BOLLUX_URL" | 413 | set_title "$BOLLUX_URL" |
408 | less_cmd=(less -R) | 414 | less_cmd=(less -R) |
409 | { | 415 | mklesskey "$BOLLUX_LESSKEY" && less_cmd+=(-k "$BOLLUX_LESSKEY") |
410 | [[ -r "$BOLLUX_LESSKEY" ]] || mklesskey "$BOLLUX_LESSKEY" | ||
411 | } && less_cmd+=(-k "$BOLLUX_LESSKEY") | ||
412 | less_cmd+=( | 416 | less_cmd+=( |
413 | -Pm'bollux$' | 417 | -Pm'bollux$' |
414 | -PM'o\:open, g\:goto, [\:back, ]\:forward, r\:refresh$' | 418 | -PM'o\:open, g\:goto, [\:back, ]\:forward, r\:refresh$' |
@@ -447,8 +451,9 @@ mklesskey() { | |||
447 | [ quit 2 # 50 back | 451 | [ quit 2 # 50 back |
448 | ] quit 3 # 51 forward | 452 | ] quit 3 # 51 forward |
449 | r quit 4 # 52 re-request / download | 453 | r quit 4 # 52 re-request / download |
454 | G quit 5 # 53 goto a url (pre-filled) | ||
450 | # other keybinds | 455 | # other keybinds |
451 | \40 forw-screen-force | 456 | \\40 forw-screen-force |
452 | END | 457 | END |
453 | } | 458 | } |
454 | 459 | ||
@@ -482,7 +487,7 @@ typeset_gemini() { | |||
482 | 487 | ||
483 | while IFS= read -r; do | 488 | while IFS= read -r; do |
484 | case "$REPLY" in | 489 | case "$REPLY" in |
485 | '```'*) | 490 | '```' | '```'*) |
486 | if $pre; then | 491 | if $pre; then |
487 | pre=false | 492 | pre=false |
488 | else | 493 | else |
@@ -627,6 +632,10 @@ handle_keypress() { | |||
627 | 52) # r - re-request the current resource | 632 | 52) # r - re-request the current resource |
628 | run blastoff "$BOLLUX_URL" | 633 | run blastoff "$BOLLUX_URL" |
629 | ;; | 634 | ;; |
635 | 53) # G - goto a url (pre-filled with current) | ||
636 | prompt -u GO URL | ||
637 | run blastoff -u "$URL" | ||
638 | ;; | ||
630 | *) # 53-57 -- still available for binding | 639 | *) # 53-57 -- still available for binding |
631 | ;; | 640 | ;; |
632 | esac | 641 | esac |