This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

tools.zsh: improve tmux detection by checking process tree

+13 -2
+13 -2
tools/zsh/flake-module.nix
··· 186 186 # Auto-start tmux for new sessions 187 187 # Check if we're already in tmux (even through sudo) 188 188 if [[ "$TERM" != "linux" && -z "$TMUX" && "$TERM" != "dumb" ]]; then 189 - # Additional check: see if we're in a tmux pane even if $TMUX is unset 190 - if [[ -z "$(tmux list-panes -F '#{pane_pid}' 2>/dev/null | grep -w $$)" ]]; then 189 + # Check if we're inside tmux by looking for tmux in the process tree 190 + in_tmux=false 191 + pid=$$ 192 + while [[ $pid -ne 1 ]]; do 193 + if ps -p $pid -o comm= 2>/dev/null | grep -q '^tmux'; then 194 + in_tmux=true 195 + break 196 + fi 197 + # Get parent PID 198 + pid=$(ps -p $pid -o ppid= 2>/dev/null | tr -d ' ') || break 199 + done 200 + 201 + if [[ "$in_tmux" == "false" ]]; then 191 202 # Preserve SSH_AUTH_SOCK for tmux 192 203 if [[ -n "$SSH_AUTH_SOCK" ]]; then 193 204 tmux set-environment -g SSH_AUTH_SOCK "$SSH_AUTH_SOCK" 2>/dev/null