Skip to content

Instantly share code, notes, and snippets.

@weilbith
Last active March 6, 2021 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weilbith/5b2e19c4bf807518f1b677e7e3fd56cc to your computer and use it in GitHub Desktop.
Save weilbith/5b2e19c4bf807518f1b677e7e3fd56cc to your computer and use it in GitHub Desktop.
Show image from URL in TMux pane with Ueberzeugt
#!/bin/bash
image_url=$1
download_path=$(mktemp --suffix "tmux-preview-image")
max_width=$(tmux display -p '#{pane_width}')
max_height=$(tmux display -p '#{pane_height}')
curl --output $download_path --silent $image_url
source $(ueberzug library)
ImageLayer 0< <(
ImageLayer::add [identifier]="tmux-preview-image" [x]="0" [y]="0" [max_width]="$max_width" [max_height]="$max_height" [path]="$download_path"
read
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment