diff options
| author | Craig Jennings <c@cjennings.net> | 2026-01-28 11:04:30 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-01-28 11:04:30 -0600 |
| commit | 66848098e786268913f7100a6c4cb1d39e342909 (patch) | |
| tree | 44181704675ba0ad1617a6cba33d316e9981e005 /dotfiles/hyprland/.profile.d/99-hyprland-autostart.sh | |
| parent | d1660f7c7cf90314222319378fea4ffe87f4671f (diff) | |
feat(hyprland): add TTY1 auto-start with crash recovery
Auto-starts Hyprland on TTY1 login while preserving console access if
Hyprland crashes. Uses no exec so shell stays alive as parent process.
Skip with touch ~/.skip-hyprland. Silent launch with logging to
~/.local/var/log/.
Diffstat (limited to 'dotfiles/hyprland/.profile.d/99-hyprland-autostart.sh')
| -rw-r--r-- | dotfiles/hyprland/.profile.d/99-hyprland-autostart.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/dotfiles/hyprland/.profile.d/99-hyprland-autostart.sh b/dotfiles/hyprland/.profile.d/99-hyprland-autostart.sh new file mode 100644 index 0000000..9d80353 --- /dev/null +++ b/dotfiles/hyprland/.profile.d/99-hyprland-autostart.sh @@ -0,0 +1,26 @@ +# 99-hyprland-autostart.sh +# Auto-start Hyprland on TTY1 console login + +# Guard: only on TTY1, not SSH, no existing display +[ "$XDG_VTNR" = "1" ] || return 0 +[ -z "$SSH_TTY" ] || return 0 +[ -z "$WAYLAND_DISPLAY" ] || return 0 +[ -z "$DISPLAY" ] || return 0 +command -v Hyprland >/dev/null 2>&1 || return 0 + +# Skip if flag file exists (touch ~/.skip-hyprland to disable) +[ -f "$HOME/.skip-hyprland" ] && return 0 + +# Setup logging (same pattern as start-hyprland wrapper) +_hypr_log_dir="$HOME/.local/var/log" +mkdir -p "$_hypr_log_dir" +_hypr_log="$_hypr_log_dir/hyprland-$(date +%Y-%m-%d-%H%M%S).log" + +# Clear screen and start Hyprland (no exec = return to shell on exit) +clear +Hyprland >"$_hypr_log" 2>&1 + +# Hyprland exited - inform user +echo "Hyprland session ended. Type 'start-hyprland' to restart." + +unset _hypr_log_dir _hypr_log |
