Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/elfmz/far2l.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Shatsky <root@free-tier-instance.us-west1-b.c.neural-map-305409.internal>2022-11-07 09:31:48 +0300
committerIvan Shatsky <root@free-tier-instance.us-west1-b.c.neural-map-305409.internal>2022-11-07 09:31:48 +0300
commitf2a164feb0ce9ae222a9bd1bcfdb6cfbbc5fcd03 (patch)
tree118471b8d06f4b66a1d32e9d1bd1ecc893fef9ef
parentc42eba333cf725e615cc01fbb105817aba0389c2 (diff)
Correct screen resolution calculation, improved image output
-rwxr-xr-xfar2l/bootstrap/view.sh14
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