Created
September 7, 2024 09:25
-
-
Save chunibyo-wly/b36525d17717895fc178998878d8dc6a to your computer and use it in GitHub Desktop.
Prevent WSLg suspend when terminal closed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FLAG_FILE="/tmp/startup_script_executed" | |
if [ ! -f "$FLAG_FILE" ]; then | |
# Your commands here | |
echo "Running startup commands..." | |
# Example: Start a new tmux session with specific windows | |
tmux new-session -d -s my_session | |
tmux new-window -t my_session:1 -n "tmux-startup-window" "while true; do echo 1 > /tmp/tmux_output.txt; sleep 1; done" | |
# Create the flag file | |
touch "$FLAG_FILE" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
& 'C:\Program Files\WSL\wsl.exe' -e /home/chunibyo/.tmux_startup.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment