Merge pull request #91 from dylanaraps/size
--size now takes a percentage
This commit is contained in:
commit
817f41089e
2 changed files with 17 additions and 7 deletions
|
@ -277,7 +277,7 @@ alias fetch2="fetch \
|
|||
--image type Image source. Where and what image we display.
|
||||
Possible values: wall, shuffle, ascii,
|
||||
/path/to/img, off
|
||||
--size px Size in pixels to make the image.
|
||||
--size 20 | --size 20% Size to make the image, takes pixels or a percentage.
|
||||
--image_backend w3m/iterm2 Which program to use to draw images.
|
||||
--shuffle_dir path/to/dir Which directory to shuffle for an image.
|
||||
--image_position left/right Where to display the image: (Left/Right)
|
||||
|
|
16
fetch
16
fetch
|
@ -1864,12 +1864,22 @@ getimage () {
|
|||
font_height=$((term_height / lines))
|
||||
|
||||
# Image size is half of the terminal
|
||||
if [ "$image_size" == "auto" ]; then
|
||||
case "$image_size" in
|
||||
"auto")
|
||||
image_size=$((columns * font_width / 2))
|
||||
|
||||
[ "$((term_height - term_height / 4))" -lt "$image_size" ] && \
|
||||
image_size=$((term_height - term_height / 4))
|
||||
fi
|
||||
;;
|
||||
|
||||
*"%")
|
||||
percent=${image_size/\%}
|
||||
image_size=$((percent * term_width / 100))
|
||||
|
||||
[ "$((percent * term_height / 50))" -lt "$image_size" ] && \
|
||||
image_size=$((percent * term_height / 100))
|
||||
;;
|
||||
esac
|
||||
|
||||
# Where to draw the image
|
||||
case "$image_position" in
|
||||
|
@ -2265,7 +2275,7 @@ usage () { cat << EOF
|
|||
--image type Image source. Where and what image we display.
|
||||
Possible values: wall, shuffle, ascii,
|
||||
/path/to/img, off
|
||||
--size px Size in pixels to make the image.
|
||||
--size 20 | --size 20% Size to make the image, takes pixels or a percentage.
|
||||
--image_backend w3m/iterm2 Which program to use to draw images.
|
||||
--shuffle_dir path/to/dir Which directory to shuffle for an image.
|
||||
--image_position left/right Where to display the image: (Left/Right)
|
||||
|
|
Loading…
Reference in a new issue