gat
gat copied to clipboard
Sixel output isn't working through tmux
Hi, and thanks!
My whole crazy tmux.conf below, but probably most notable is that it includes set -g allow-passthrough on, set -ga terminal-overrides ",xterm*:Tc", and TERM is tmux-256color:
tmux.conf
# Hit backtick to prime tmux for an action
set -g prefix `
# Action: backtick: type a literal backtick
bind ` send-prefix
# Set TERM, indicating color support
set -g default-terminal tmux-256color
set -ga terminal-overrides ",xterm*:Tc"
# TODO: https://github.com/wezterm/wezterm/discussions/6702
# Enable passthrough for image protocol support
set -g allow-passthrough on
# Enable mouse usage
set -g mouse on
# Big ol' scrollback
set -g history-limit 300000
# Set WM window title (not the tmux "window," herein called a "tab")
set -g set-titles on
set -g set-titles-string "#W - #{USER}@#h.#I"
# Action: enter: toggle status bar
bind enter set -g status
# Status bar as tab bar
bg_tab='#1f1f28'
set -g status-position top
set -g status-left ''
set -g status-right ''
set -g status-justify right
set -g status-interval 1
setw -g status-style "bg=terminal"
setw -g window-status-style fg='blue',bg="$bg_tab"
setw -g window-status-current-style fg='white',bg="$bg_tab",italics
# powerline extended:
leftend=''
rightend=''
# powerline:
# leftend=''
# rightend=''
# ASCII:
# leftend='<<'
# rightend='>>'
# naked:
# leftend=''
# rightend=''
tab_string="\
#[fg=$bg_tab bg=terminal]$leftend#[fg=default bg=default] \
#{?#{==:#{pane_current_path},$HOME},,\
#{s|^$HOME/||;\
=|-24|…:\
pane_current_path}\
}\
#[bold]\
#{?#{!=:#W,zsh},:#W,\
#{?#{==:#{pane_current_path},$HOME},~,}\
}\
#[nobold]\
#{?#{!=:#{window_panes},1},+,}\
#[fg=$bg_tab bg=terminal]$rightend\
"
setw -g window-status-format "$tab_string"
setw -g window-status-current-format "$tab_string"
# Action: comma: edit "window" title (part of the tab title, usually command name)
# Action: j: left tab
# Action: k: right tab
# Action: l: new tab
bind j prev
bind k next
bind l new-window -c "#{pane_current_path}"
# Action: c OR [: enter copy-mode
# Action: pgup: enter copy-mode, then scroll up
# Action: v OR ]: paste tmux buffer
# Actions within copy-mode only (no prefix for these):
# Action: q: exit copy-mode
# Action: mouse selection: select and save in tmux buffer
# Action: space: start selection
# Action: enter: save selection in tmux buffer, then exit copy-mode
# Action: c: save selection in tmux buffer and clipboard
# Action: h: view tmux buffer with syntax highlighting in new window
# Action: ctrl+{left,right}: jump by word
fg_selection='#dcd7ba'
bg_selection='#3b3a84'
# TODO: clearly state the effect of vi keys here
setw -g mode-keys vi
bind c copy-mode
bind v paste-buffer
set -g set-clipboard on
bind -T copy-mode-vi c send -X copy-pipe "xclip -sel clip"
bind -T copy-mode-vi h send -X copy-pipe "xclip -sel clip" \; \
split -c "#{pane_current_path}" \; \
resize-pane -Z \; \
send "read '?What syntax? '; xclip -sel clip -o | highlight -O truecolor -s navy -t 2 --stdout -S \$REPLY | LESS='JRWXij.5' less; exit" \; \
send Enter
bind -T copy-mode-vi C-Left send-keys -X previous-word
bind -T copy-mode-vi C-Right send-keys -X next-word-end
setw -g mode-style fg="$fg_selection",bg="$bg_selection"
set -g pane-active-border-style fg='white'
set -g pane-border-style fg='blue'
# ------
# Splits
# ------
# Action: {-,=,\,+}: split pane
# Action: space: rotate through split layouts
# Action: shift+{right,left,down,up}: resize
# Action: mouse drag pane border: resize
bind - split -v -l 45% -c "#{pane_current_path}"
bind + split -h -l 45% -c "#{pane_current_path}"
bind = split -h -l 45% -c "#{pane_current_path}"
bind \\ split -h -l 45% -c "#{pane_current_path}"
bind -r S-right resize-pane -R 4
bind -r S-down resize-pane -D 4
bind -r S-left resize-pane -L 4
bind -r S-up resize-pane -U 4
# left/right/up/down walk to pane
bind w select-pane -U # walk to pane
bind a select-pane -L # walk to pane
bind s select-pane -D # walk to pane
bind d select-pane -R # walk to pane
# q,<num> jump to pane
# space change split layout
# z maximize pane
# {/} move pane left/right
bind 2 split -h -l 45% -c "#{pane_current_path}"
# -- https://github.com/laktak/extrakto --
run ~/.config/tmux/plugins/extrakto/extrakto.tmux
# -- https://github.com/tmux-plugins/tmux-resurrect --
# To use skim instead of fzf, uncomment the line below
# set -g @extrakto_fzf_tool "sk"
run ~/.config/tmux/plugins/tmux-resurrect/resurrect.tmux
Within tmux:
Outside of tmux:
Tested on each of Rio and Wezterm.
Note that tmux has a limit on the size of Sixel images, and if your image exceeds that limit you won't see anything. By default I think it's about 1MB, but there is an option you can set to increase that limit: input-buffer-size. Note that this limit applies to the Sixel encoding of the image - not the size of the original image.