muesli / duf

Disk Usage/Free Utility - a better 'df' alternative
Other
12.76k stars 395 forks source link

tmux not recognized as interactive terminal (no color) #261

Open joliss opened 1 year ago

joliss commented 1 year ago

I'm in an interactive terminal in a tmux:

$ echo $TMUX
/tmp/tmux-1000/default,16080,0

$ test -t 1 && echo stdout is a terminal
stdout is a terminal

But when I run duf, I don't get colorized output unless I set CLICOLOR_FORCE=1.

C0rn3j commented 7 months ago
% duf --version                                                                                                                   
duf 0.8.1

% tmux -V       
tmux 3.4

Works fine here, can you still reproduce?

If so, try posting env output and we can see what's different.

joliss commented 5 months ago

Ah, it works fine on tmux 3.4 on Mac, but not on tmux 3.2a on Linux. The difference seems to be that with tmux 3.2a on Linux, I have TERM=screen, but with tmux 3.4, I have TERM=screen-256color.

~/src/duf $ tmux -V
tmux 3.2a
~/src/duf $ echo $TERM
screen
~/src/duf $ ./duf
[no color]
~/src/duf $ TERM=screen-256color ./duf
[has color]

It would probably be fine for duf to default to printing ANSI codes when TERM=screen and stdout is a terminal.