diff options
author | Case Duckworth | 2020-06-07 18:43:28 -0500 |
---|---|---|
committer | Case Duckworth | 2020-06-07 18:43:28 -0500 |
commit | 93f21f4d2b6696af64928c5fd7fbb83d03da8bd5 (patch) | |
tree | e0301c890072bffe20441461bc92900ad976578d | |
parent | Comment unused options (diff) | |
download | bollux-93f21f4d2b6696af64928c5fd7fbb83d03da8bd5.tar.gz bollux-93f21f4d2b6696af64928c5fd7fbb83d03da8bd5.zip |
Change display and keymaps
-rwxr-xr-x | bollux | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/bollux b/bollux index c5e0d95..1489147 100755 --- a/bollux +++ b/bollux | |||
@@ -139,7 +139,7 @@ bollux_quit() { | |||
139 | } | 139 | } |
140 | 140 | ||
141 | set_title() { | 141 | set_title() { |
142 | printf '\e]2;%s - bollux\007' "$*" | 142 | printf '\e]2;%s\007' "$*" |
143 | } | 143 | } |
144 | 144 | ||
145 | prompt() { # prompt [-u] PROMPT [READ_ARGS...] | 145 | prompt() { # prompt [-u] PROMPT [READ_ARGS...] |
@@ -573,19 +573,18 @@ display() { # display METADATA [TITLE] | |||
573 | 573 | ||
574 | case "$mime" in | 574 | case "$mime" in |
575 | text/*) | 575 | text/*) |
576 | set_title "$BOLLUX_URL" | 576 | set_title "$title${title:+ - }bollux" |
577 | less_cmd=(less -R) | 577 | less_cmd=(less -R) |
578 | mklesskey "$BOLLUX_LESSKEY" && less_cmd+=(-k "$BOLLUX_LESSKEY") | 578 | mklesskey "$BOLLUX_LESSKEY" && less_cmd+=(-k "$BOLLUX_LESSKEY") |
579 | less_cmd+=( | 579 | less_cmd+=( |
580 | -Pm"$title${title:+ - }bollux$" | 580 | -Pm"$(less_prompt_escape "$BOLLUX_URL") - bollux$" |
581 | -PM'o\:open, g\:goto, [\:back, ]\:forward, r\:refresh$' | 581 | -P='o\:open, g\:goto, [\:back, ]\:forward, r\:refresh$' |
582 | -m | 582 | -m |
583 | -S | ||
584 | ) | 583 | ) |
585 | 584 | ||
586 | local typeset | 585 | local typeset |
587 | local submime="${mime#*/}" | 586 | local submime="${mime#*/}" |
588 | if declare -Fp "typeset_$submime" >/dev/null; then | 587 | if declare -Fp "typeset_$submime" &>/dev/null; then |
589 | typeset="typeset_$submime" | 588 | typeset="typeset_$submime" |
590 | else | 589 | else |
591 | typeset="passthru" | 590 | typeset="passthru" |
@@ -602,6 +601,18 @@ display() { # display METADATA [TITLE] | |||
602 | esac | 601 | esac |
603 | } | 602 | } |
604 | 603 | ||
604 | less_prompt_escape() { | ||
605 | local i | ||
606 | for ((i = 0; i < ${#1}; i++)); do | ||
607 | : "${1:i:1}" | ||
608 | case "$_" in | ||
609 | [\?:\.%\\]) printf '\%s' "$_" ;; | ||
610 | *) printf '%s' "$_" ;; | ||
611 | esac | ||
612 | done | ||
613 | printf '\n' | ||
614 | } | ||
615 | |||
605 | mklesskey() { | 616 | mklesskey() { |
606 | lesskey -o "$1" - <<-END | 617 | lesskey -o "$1" - <<-END |
607 | #command | 618 | #command |
@@ -615,7 +626,8 @@ mklesskey() { | |||
615 | \\40 forw-screen-force | 626 | \\40 forw-screen-force |
616 | h left-scroll | 627 | h left-scroll |
617 | l right-scroll | 628 | l right-scroll |
618 | ? toggle-option M | 629 | ? status # 'status' will show a little help thing. |
630 | = noaction | ||
619 | END | 631 | END |
620 | } | 632 | } |
621 | 633 | ||