Work on previewing images within tmux

This commit is contained in:
Daniel Flanagan 2020-11-23 10:03:57 -06:00
parent 03e94092f8
commit 209b9e8f3a
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
2 changed files with 5 additions and 3 deletions

View file

@ -3,10 +3,12 @@
SPLIT="$SPLIT" SPLIT="$SPLIT"
TERMINAL="$TERMINAL" TERMINAL="$TERMINAL"
USE_SCOPE="${USE_SCOPE:-0}" USE_SCOPE="${USE_SCOPE:-0}"
IN_KITTY=0
[ -n "$KITTY_WINDOW_ID" ] && kitty @ ls --no-response >/dev/null 2>&1 && IN_KITTY=1
if [ -e "${TMUX%%,*}" ] && tmux -V | grep -q '[ -][3456789]\.'; then if [ -e "${TMUX%%,*}" ] && tmux -V | grep -q '[ -][3456789]\.'; then
TERMINAL=tmux TERMINAL=tmux
elif [ -n "$KITTY_WINDOW_ID" ] && kitty @ ls >/dev/null 2>&1; then elif [ "$IN_KITTY" == 1 ]; then
TERMINAL=kitty TERMINAL=kitty
else else
TERMINAL="${TERMINAL:-xterm}" TERMINAL="${TERMINAL:-xterm}"
@ -77,7 +79,7 @@ preview_file () {
fi fi
elif [ "$encoding" = "binary" ]; then elif [ "$encoding" = "binary" ]; then
if [ "${mimetype%%/*}" = "image" ] ; then if [ "${mimetype%%/*}" = "image" ] ; then
if [ "$TERMINAL" = "kitty" ]; then if [ "$IN_KITTY" = "1" ]; then
# Kitty terminal users can use the native image preview method. # Kitty terminal users can use the native image preview method.
kitty +kitten icat --silent --transfer-mode=stream --stdin=no "$1" & kitty +kitten icat --silent --transfer-mode=stream --stdin=no "$1" &
elif exists catimg; then elif exists catimg; then

View file

@ -15,7 +15,7 @@ bind s run "tmux split-window -l 12 'sh -c ~/.config/lytedev-dotfiles/bin/tmuxsw
bind M-l source-file "$XDG_CONFIG_HOME/tmux/layouts/dev.tmux" bind M-l source-file "$XDG_CONFIG_HOME/tmux/layouts/dev.tmux"
set -g default-terminal "screen-256color" set -g default-terminal "kitty"
set -g mouse on set -g mouse on
set -g escape-time 0 set -g escape-time 0
set -g monitor-activity on set -g monitor-activity on