w3m-img: Add -bg support

This commit is contained in:
Dylan Araps 2016-10-22 01:14:02 +11:00
parent b12e5b1f56
commit 60beb88def
3 changed files with 10 additions and 1 deletions

View File

@ -440,6 +440,8 @@ alias neofetch2="neofetch \
window. This only works with w3m. window. This only works with w3m.
--yoffset px How close the image will be to the top edge of the --yoffset px How close the image will be to the top edge of the
window. This only works with w3m. window. This only works with w3m.
--bg_color color Background color to display behind transparent image.
This only works with w3m.
--gap num Gap between image and text. --gap num Gap between image and text.
NOTE: --gap can take a negative value which will NOTE: --gap can take a negative value which will
move the text closer to the left side. move the text closer to the left side.

View File

@ -2312,7 +2312,7 @@ displayimage() {
# appearing in specific terminal emulators. # appearing in specific terminal emulators.
sleep 0.05 sleep 0.05
printf "%b%s\n" "0;1;$xoffset;$yoffset;$width;$height;;;;;$img\n4;\n3;" |\ printf "%b%s\n" "0;1;$xoffset;$yoffset;$width;$height;;;;;$img\n4;\n3;" |\
$w3m_img_path 2>/dev/null || padding="\033[0C" $w3m_img_path -bg "$background_color" 2>/dev/null || padding="\033[0C"
;; ;;
"iterm2") "iterm2")
@ -3037,6 +3037,8 @@ usage() { cat << EOF
window. This only works with w3m. window. This only works with w3m.
--yoffset px How close the image will be to the top edge of the --yoffset px How close the image will be to the top edge of the
window. This only works with w3m. window. This only works with w3m.
--bg_color color Background color to display behind transparent image.
This only works with w3m.
--gap num Gap between image and text. --gap num Gap between image and text.
NOTE: --gap can take a negative value which will NOTE: --gap can take a negative value which will
move the text closer to the left side. move the text closer to the left side.
@ -3176,6 +3178,7 @@ getargs() {
--crop_offset) crop_offset="$2" ;; --crop_offset) crop_offset="$2" ;;
--xoffset) xoffset="$2" ;; --xoffset) xoffset="$2" ;;
--yoffset) yoffset="$2" ;; --yoffset) yoffset="$2" ;;
--background_color | --bg_color) background_color="$2" ;;
--gap) gap="$2" ;; --gap) gap="$2" ;;
--clean) --clean)
rm -rf "$thumbnail_dir" rm -rf "$thumbnail_dir"

View File

@ -198,6 +198,10 @@ window in pixel. This only works with w3m.
How close the image will be to the top edge How close the image will be to the top edge
of the window. This only works with w3m. of the window. This only works with w3m.
.TP .TP
.B \--bg_color 'color'
Background color to display behind transparent image.
This only works with w3m.
.TP
.B \--gap 'num' .B \--gap 'num'
Gap between image and text. Gap between image and text.
.br .br