From f5813fc80147dbb27b0d81ba27fb1100c55f5c56 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sat, 16 Jul 2022 14:38:40 +0100 Subject: [PATCH] Fix false-positive check for tty in flatpak When there is absolutely no tty set at all (e.g. in a shell spawned by a flatpak), tty prints 'not a tty', which matches `tty | grep "tty"`. Luckily `tty` also returns `1`, so we can do a two-stage check instead. This fixes #38 --- conf.d/fishline-init.fish | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/conf.d/fishline-init.fish b/conf.d/fishline-init.fish index 6b46e79..ac65245 100644 --- a/conf.d/fishline-init.fish +++ b/conf.d/fishline-init.fish @@ -13,7 +13,11 @@ end source $FLINE_THEME_DIR/default_symbols.fish # Load default color theme depending on terminal capabilities -if begin; [ (uname) != "Darwin" ]; and tty | grep tty > /dev/null; end +if begin + [ (uname) != "Darwin" ] + and set -l out (tty) + and string match -eq "tty" $out + end # Emable a TTY safe default theme if a TTY is detected source $FLINE_THEME_DIR/tty_compatible.fish else if begin; not command -s tput > /dev/null; or [ (tput colors) -lt 256 ]; end