diff --git a/zsh/.config/zsh/config.d/00_detect_remote.zsh b/zsh/.config/zsh/config.d/00_detect_remote.zsh index b1f4e7a..0a413d8 100644 --- a/zsh/.config/zsh/config.d/00_detect_remote.zsh +++ b/zsh/.config/zsh/config.d/00_detect_remote.zsh @@ -2,11 +2,20 @@ # processes of this shell and checking for things like sshd/tailscaled. Runs # first because multiple other things rely on this. +# names of daemon processes a remote shell might be a child process of +declare -a remote_daemons +remote_daemons=( + sshd + tailscaled +) + declare -a is_remote is_remote=() proctree="$(pstree -s $$)" -[[ "$proctree" =~ sshd ]] && is_remote+=sshd -[[ "$proctree" =~ tailscaled ]] && is_remote+=tailscaled +for d in $remote_daemons[@]; do + [[ "$proctree" =~ $d ]] && is_remote+="$d" +done [ -n "$is_remote" ] && export IS_REMOTE_SESSION="$is_remote[@]" +echo is remote: $IS_REMOTE_SESSION