#!/bin/bash # XScreenSaver Drop-in Setup for Fedora + MATE Desktop # Version 0.02 -- July 10th 2025 # Author: Ben @ LostGeek.NET set -e echo "=== XScreenSaver Setup for Fedora + MATE Desktop ===" # Step 0: Check dependencies command -v dnf >/dev/null || { echo "This script must be run on a Fedora-based system with dnf."; exit 1; } # Step 1: Remove mate-screensaver echo "[1/6] Removing mate-screensaver..." pkill -f mate-screensaver || true systemctl --user stop mate-screensaver.service || true sudo dnf remove -y mate-screensaver mate-screensaver-base || true # Step 2: Prevent reinstallation via /etc/dnf/dnf.conf echo "[2/6] Blocking mate-screensaver from reinstall..." if ! grep -Eq '^exclude=.*mate-screensaver' /etc/dnf/dnf.conf; then echo "Adding exclude line to /etc/dnf/dnf.conf..." sudo sed -i '/^\[main\]/a exclude=mate-screensaver mate-screensaver-base' /etc/dnf/dnf.conf else echo "mate-screensaver already excluded in dnf.conf." fi # Step 3: Install xscreensaver (+ optional extras) echo "[3/6] Installing xscreensaver..." echo "Install GL and GL-extra modules?" echo "1) Yes (xscreensaver-gl + gl-extras)" echo "2) No (just base)" read -rp "Choice [default: 1]: " choice choice=${choice:-1} if [[ "$choice" == 1 ]]; then sudo dnf install -y xscreensaver xscreensaver-gl xscreensaver-gl-extras else sudo dnf install -y xscreensaver fi # Step 4: Autostart xscreensaver echo "[4/6] Adding xscreensaver to autostart..." AUTOSTART_DIR="$HOME/.config/autostart" XS_FILE="$AUTOSTART_DIR/xscreensaver.desktop" mkdir -p "$AUTOSTART_DIR" cat > "$XS_FILE" < /dev/null <<'EOF' #!/bin/bash if [[ "$1" == "--lock" ]]; then xscreensaver-command -lock else xscreensaver-command "$@" fi EOF sudo chmod +x /usr/local/bin/mate-screensaver-command # Step 6: Optional sonar ping support echo "[6/6] Sonar screensaver can do real ping effects (requires SETUID)." read -rp "Enable real ping for sonar? (y/N): " sonar sonar=${sonar,,} if [[ "$sonar" =~ ^(y|yes)$ ]]; then if [[ -f /usr/libexec/xscreensaver/sonar ]]; then echo "Enabling real ping SETUID on sonar..." sudo chmod +s /usr/libexec/xscreensaver/sonar else echo "Sonar not found at /usr/libexec/xscreensaver/sonar." fi else echo "Skipping sonar SETUID." fi echo "" echo " XScreenSaver setup complete." echo " - mate-screensaver removed and permanently excluded" echo " - xscreensaver installed and autostarts" echo " - Lock screen compatibility via wrapper" echo "" echo "You can now use MOD+L or menu Lock Screen normally." exit 0