From 209b9e8f3ac0c1414477d4dbf5ea97b408decafd Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 23 Nov 2020 10:03:57 -0600 Subject: [PATCH] Work on previewing images within tmux --- apps/nnn/plugins/preview | 6 ++++-- apps/shell/tmux/conf | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/nnn/plugins/preview b/apps/nnn/plugins/preview index d1cfcf4..c7e19fd 100755 --- a/apps/nnn/plugins/preview +++ b/apps/nnn/plugins/preview @@ -3,10 +3,12 @@ SPLIT="$SPLIT" TERMINAL="$TERMINAL" 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 TERMINAL=tmux -elif [ -n "$KITTY_WINDOW_ID" ] && kitty @ ls >/dev/null 2>&1; then +elif [ "$IN_KITTY" == 1 ]; then TERMINAL=kitty else TERMINAL="${TERMINAL:-xterm}" @@ -77,7 +79,7 @@ preview_file () { fi elif [ "$encoding" = "binary" ]; 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 +kitten icat --silent --transfer-mode=stream --stdin=no "$1" & elif exists catimg; then diff --git a/apps/shell/tmux/conf b/apps/shell/tmux/conf index 7188dd4..8cd1447 100644 --- a/apps/shell/tmux/conf +++ b/apps/shell/tmux/conf @@ -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" -set -g default-terminal "screen-256color" +set -g default-terminal "kitty" set -g mouse on set -g escape-time 0 set -g monitor-activity on