diff options
-rwxr-xr-x | bollux | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/bollux b/bollux index 4864e48..e84c8b4 100755 --- a/bollux +++ b/bollux | |||
@@ -128,6 +128,15 @@ bollux_config() { | |||
128 | : "${C_PRE:=0}" # preformatted text formatting | 128 | : "${C_PRE:=0}" # preformatted text formatting |
129 | } | 129 | } |
130 | 130 | ||
131 | bollux_quit() { | ||
132 | log x "Thanks for flying $PRGN" | ||
133 | exit | ||
134 | } | ||
135 | |||
136 | set_title() { | ||
137 | printf '\e]2;%s - bollux\007' "$*" | ||
138 | } | ||
139 | |||
131 | prompt() { | 140 | prompt() { |
132 | prompt="$1" | 141 | prompt="$1" |
133 | shift | 142 | shift |
@@ -357,7 +366,7 @@ display() { | |||
357 | IFS=$'\n' read -d "" -ra hdr <<<"${1//;/$'\n'}" | 366 | IFS=$'\n' read -d "" -ra hdr <<<"${1//;/$'\n'}" |
358 | 367 | ||
359 | mime="$(trim "${hdr[0],,}")" | 368 | mime="$(trim "${hdr[0],,}")" |
360 | for ((i=1;i<="${#hdr[@]}";i++)); do | 369 | for ((i = 1; i <= "${#hdr[@]}"; i++)); do |
361 | h="$(trim "${hdr[$i]}")" | 370 | h="$(trim "${hdr[$i]}")" |
362 | log d "'$h'" | 371 | log d "'$h'" |
363 | case "$h" in | 372 | case "$h" in |
@@ -374,6 +383,7 @@ display() { | |||
374 | 383 | ||
375 | case "$mime" in | 384 | case "$mime" in |
376 | text/*) | 385 | text/*) |
386 | set_title "$BOLLUX_URL" | ||
377 | less_cmd=(less -R) | 387 | less_cmd=(less -R) |
378 | { | 388 | { |
379 | [[ -r "$BOLLUX_LESSKEY" ]] || mklesskey "$BOLLUX_LESSKEY" | 389 | [[ -r "$BOLLUX_LESSKEY" ]] || mklesskey "$BOLLUX_LESSKEY" |
@@ -392,7 +402,7 @@ display() { | |||
392 | iconv -f "${charset^^}" -t "UTF-8" - | | 402 | iconv -f "${charset^^}" -t "UTF-8" - | |
393 | tee "$BOLLUX_PAGESRC" | | 403 | tee "$BOLLUX_PAGESRC" | |
394 | run "typeset_$submime" | | 404 | run "typeset_$submime" | |
395 | run "${less_cmd[@]}" | 405 | run "${less_cmd[@]}" && bollux_quit |
396 | } || run handle_keypress "$?" | 406 | } || run handle_keypress "$?" |
397 | else | 407 | else |
398 | log "cat" | 408 | log "cat" |
@@ -400,7 +410,7 @@ display() { | |||
400 | normalize_crlf | | 410 | normalize_crlf | |
401 | iconv -f "${charset^^}" -t "UTF-8" - | | 411 | iconv -f "${charset^^}" -t "UTF-8" - | |
402 | tee "$BOLLUX_PAGESRC" | | 412 | tee "$BOLLUX_PAGESRC" | |
403 | run "${less_cmd[@]}" | 413 | run "${less_cmd[@]}" && bollux_quit |
404 | } || run handle_keypress "$?" | 414 | } || run handle_keypress "$?" |
405 | fi | 415 | fi |
406 | ;; | 416 | ;; |
@@ -596,6 +606,9 @@ handle_keypress() { | |||
596 | select_url() { | 606 | select_url() { |
597 | run mapfile -t < <(extract_links <"$1") | 607 | run mapfile -t < <(extract_links <"$1") |
598 | select u in "${MAPFILE[@]}"; do | 608 | select u in "${MAPFILE[@]}"; do |
609 | case "$REPLY" in | ||
610 | q) bollux_quit ;; | ||
611 | esac | ||
599 | run blastoff "$(gawk '{print $1}' <<<"$u")" && break | 612 | run blastoff "$(gawk '{print $1}' <<<"$u")" && break |
600 | done </dev/tty | 613 | done </dev/tty |
601 | } | 614 | } |