Created
July 7, 2025 22:42
-
-
Save civersen/c4ec83afe4b1e37f07653931dd489f44 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| # This script automates the installation of SwayWM and basic development tools | |
| # on Debian-based systems. | |
| # --- Function to check for sudo privileges --- | |
| check_sudo() { | |
| if [[ "$EUID" -ne 0 ]]; then | |
| echo "This script requires superuser privileges (sudo)." | |
| echo "Please run it with 'sudo ./install_sway.sh' or enter your password when prompted." | |
| # Attempt to re-execute with sudo if not already running as root | |
| if command -v sudo &> /dev/null; then | |
| exec sudo "$0" "$@" | |
| else | |
| echo "sudo command not found. Please run as root." | |
| exit 1 | |
| fi | |
| fi | |
| } | |
| # --- Call the sudo check function --- | |
| check_sudo | |
| # --- Update package lists before starting installations --- | |
| echo "Updating package lists..." | |
| sudo apt update -y || { echo "Failed to update package lists. Exiting."; exit 1; } | |
| echo "Package lists updated." | |
| # --- Install SwayWM and related packages --- | |
| read -p "Do you want to install SwayWM and its recommended utilities (y/N)? " install_sway_choice | |
| if [[ "$install_sway_choice" =~ ^[Yy]$ ]]; then | |
| echo "Installing SwayWM and recommended utilities..." | |
| sudo apt install -y \ | |
| sway \ | |
| swaylock \ | |
| swaybg \ | |
| wayland-protocols \ | |
| xdg-desktop-portal-wlr \ | |
| foot \ | |
| mate-polkit \ | |
| grim \ | |
| slurp \ | |
| wofi || { echo "Failed to install SwayWM packages. Please check for errors."; } | |
| echo "SwayWM installation attempt complete." | |
| else | |
| echo "Skipping SwayWM installation." | |
| fi | |
| echo "" # Add a newline for better readability | |
| # --- Install basic development tools --- | |
| read -p "Do you want to install basic development tools (git, neovim) (y/N)? " install_dev_tools_choice | |
| if [[ "$install_dev_tools_choice" =~ ^[Yy]$ ]]; then | |
| echo "Installing basic development tools..." | |
| sudo apt install -y \ | |
| git \ | |
| rsync \ | |
| alacritty \ | |
| curl \ | |
| neovim || { echo "Failed to install development tools. Please check for errors."; } | |
| echo "Basic development tools installation attempt complete." | |
| else | |
| echo "Skipping basic development tools installation." | |
| fi | |
| echo "" # Add a newline for better readability | |
| echo "Script finished." | |
| echo "Remember to reboot or log out and back in to a TTY to start Sway, or configure a display manager like Greetd." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment