From dd85f11f9dae0bd4dc1b082e7b9343df3c682ae7 Mon Sep 17 00:00:00 2001
From: Tony Blyler <git@tonyblyler.com>
Date: Tue, 29 Oct 2024 08:47:12 -0400
Subject: [PATCH] make sure `startx` is only automatically called on TTY1 if
 std{in,out,err} are actually on a TTY -- not sddm or similar

---
 chezmoi/dot_zprofile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/chezmoi/dot_zprofile b/chezmoi/dot_zprofile
index d05b585..266d388 100644
--- a/chezmoi/dot_zprofile
+++ b/chezmoi/dot_zprofile
@@ -1,5 +1,8 @@
-source "${HOME}/.zshrc.d/cbi.sh" 2>/dev/null
-if [ "$TTY" = '/dev/tty1' ]; then
+if [ -e "${HOME}/.zshrc.d/cbi.sh" ]; then
+	source "${HOME}/.zshrc.d/cbi.sh" 2>/dev/null
+fi
+
+if [ "$TTY" = '/dev/tty1' ] && [ -t 0 ] && [ -t 1 ] && [ -t 2 ]; then
 	startx
 	exit
 fi