diff options
author | Ivan Shatsky <root@free-tier-instance.us-west1-b.c.neural-map-305409.internal> | 2022-11-07 09:31:48 +0300 |
---|---|---|
committer | Ivan Shatsky <root@free-tier-instance.us-west1-b.c.neural-map-305409.internal> | 2022-11-07 09:31:48 +0300 |
commit | f2a164feb0ce9ae222a9bd1bcfdb6cfbbc5fcd03 (patch) | |
tree | 118471b8d06f4b66a1d32e9d1bd1ecc893fef9ef | |
parent | c42eba333cf725e615cc01fbb105817aba0389c2 (diff) |
Correct screen resolution calculation, improved image output
-rwxr-xr-x | far2l/bootstrap/view.sh | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/far2l/bootstrap/view.sh b/far2l/bootstrap/view.sh index 7bba89e9..dc22c311 100755 --- a/far2l/bootstrap/view.sh +++ b/far2l/bootstrap/view.sh @@ -292,10 +292,8 @@ if [[ "$FILE" == *": "*"image data, "* ]] \ || [[ "$FILE" == *": "*"SVG"*" image"* ]] \ || [[ "$FILE" == *": "*"JPEG"*" image"* ]] \ || [[ "$FILEMIME" == *": image/"* ]]; then - # ??? workaround for bash to get values of variables - bash -c "echo ${FOO}" >/dev/null 2>&1 - TCOLUMNS=$( bash -c "echo ${COLUMNS}" ) - TLINES=$( bash -c "echo ${LINES}" ) + TCOLUMNS=$( tput cols ) + TLINES=$( tput lines ) TCOLUMNS=$(( ${TCOLUMNS:-80} - 0 )) TLINES=$(( ${TLINES:-25} - 2 )) VPRETTY="no" @@ -305,7 +303,13 @@ if [[ "$FILE" == *": "*"image data, "* ]] \ TCOLUMNS=$(( ${TCOLUMNS:-80} - 1 )) chafa -c none --symbols -all+stipple+braille+ascii+space+extra --size ${TCOLUMNS}x${TLINES} "$1" >>"$2" 2>&1 echo "Image is viewed by chafa in "${TCOLUMNS}"x"${TLINES}" symbols sized area" >>"$2" 2>&1 - chafa --color-space=din99d -w 9 --symbols all --fill all "$1" && read -n1 -r -p "" >>"$2" 2>&1 + for i in $( seq $TLINES ); do echo; done + clear + DESCRIPTION="Image name, dimensions and color depth will be here soon (really soon)" + # Best settings for the fonts with limited character ranges (Consolas, Lucida Console, etc.) + #chafa -c full --color-space=din99d -w 9 --symbols solid+half+space-wide-inverted --fill all "$1" && echo -n $DESCRIPTION && read -n1 -r -p "" >>"$2" 2>&1 + # Settings for the fonts with extended character ranges (Cascadia Code, Cascadia Mono, etc.) + chafa --color-space=din99d -w 9 --symbols all --fill all "$1" && echo -n $DESCRIPTION && read -n1 -r -p "" >>"$2" 2>&1 clear elif command -v timg >/dev/null 2>&1; then |