This repository has no description
0

Configure Feed

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

zsh: prevent nested tmux sessions when using sudo

+10 -6
+10 -6
tools/zsh/flake-module.nix
··· 184 184 185 185 186 186 # Auto-start tmux for new sessions 187 + # Check if we're already in tmux (even through sudo) 187 188 if [[ "$TERM" != "linux" && -z "$TMUX" && "$TERM" != "dumb" ]]; then 188 - # Preserve SSH_AUTH_SOCK for tmux 189 - if [[ -n "$SSH_AUTH_SOCK" ]]; then 190 - tmux set-environment -g SSH_AUTH_SOCK "$SSH_AUTH_SOCK" 2>/dev/null 191 - fi 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 191 + # Preserve SSH_AUTH_SOCK for tmux 192 + if [[ -n "$SSH_AUTH_SOCK" ]]; then 193 + tmux set-environment -g SSH_AUTH_SOCK "$SSH_AUTH_SOCK" 2>/dev/null 194 + fi 192 195 193 - # Start tmux with a new session 194 - exec tmux -u new-session 196 + # Start tmux with a new session 197 + exec tmux -u new-session 198 + fi 195 199 fi 196 200 197 201 # Set tmux status bar color based on hostname for SSH sessions