Skip to content

Commit

Permalink
Improve TERM_PROGRAM detection and kitty/ghostty support
Browse files Browse the repository at this point in the history
  • Loading branch information
wookayin committed Jan 30, 2025
1 parent 8083e66 commit 5bcab76
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion imgcat/imgcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@ def get_tty_size():

def get_backend():
'''Determine a proper backend from environment variables.'''
if os.getenv('TERM', '').__contains__('kitty'):

term = os.getenv('TERM_PROGRAM', None)
if term == 'tmux' or term is None:
term = os.getenv('TERM', '')

if term.__contains__('kitty') or term.__contains__('ghostty'):
from . import kitty
return kitty
else:
Expand Down

0 comments on commit 5bcab76

Please sign in to comment.