#!/bin/bash # Autostart unit and the installed/running checks. # # Sourced by setup_activitywatch.sh; split out to keep aw_service.sh under the # 250-line cap. Sourced rather than run, so it inherits the caller's # strict mode and the variables defined above the source line. # Function to setup autostart setup_autostart() { echo "" echo "5. Setting Up Autostart..." echo "=========================" local autostart_dir="$USER_HOME/.config/autostart" local desktop_file="$autostart_dir/activitywatch.desktop" local i3_config="$USER_HOME/.config/i3/config" # Method 1: XDG Autostart (works with most desktop environments) if [[ $EUID -eq 0 ]]; then sudo -u "$ACTUAL_USER" mkdir -p "$autostart_dir" else mkdir -p "$autostart_dir" fi # Create desktop file for autostart cat >"$desktop_file" <