Skip to content

Commit 719a49b

Browse files
committed
Improve TERM_PROGRAM detection and kitty/ghostty support
1 parent ffc579e commit 719a49b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

imgcat/imgcat.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,12 @@ def get_tty_size():
179179

180180
def get_backend():
181181
'''Determine a proper backend from environment variables.'''
182-
if os.getenv('TERM', '').__contains__('kitty'):
182+
183+
term = os.getenv('TERM_PROGRAM', None)
184+
if term == 'tmux' or term is None:
185+
term = os.getenv('TERM', '')
186+
187+
if term.__contains__('kitty') or term.__contains__('ghostty'):
183188
from . import kitty
184189
return kitty
185190
else:

0 commit comments

Comments
 (0)