diff --git a/scripts/config.lua b/scripts/config.lua new file mode 100644 index 0000000..4ae5834 --- /dev/null +++ b/scripts/config.lua @@ -0,0 +1,6 @@ +return { + target = { + linux = "~/scripts", + default = "~/scripts", + }, +} diff --git a/scripts/files/add-edid.sh b/scripts/files/add-edid.sh new file mode 100755 index 0000000..29fbb20 --- /dev/null +++ b/scripts/files/add-edid.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +ENTRY_DIR="/efi/loader/entries" +BACKUP_DIR="${ENTRY_DIR}/backup-$(date +%F-%H%M%S)" +EDID_PARAM="drm.edid_firmware=DP-1:edid/g80.bin" + +echo "Backing up boot entries..." +sudo mkdir -p "$BACKUP_DIR" +sudo cp -v "${ENTRY_DIR}"/*.conf "$BACKUP_DIR" + +echo "Adding EDID parameter to boot entry files..." +for file in "${ENTRY_DIR}"/*.conf; do + if grep -q "$EDID_PARAM" "$file"; then + echo "Already present in $(basename "$file"), skipping." + continue + fi + + # Use | as delimiter to avoid issues with '/' + sudo sed -i "s|^options|& ${EDID_PARAM}|" "$file" + echo "Updated $(basename "$file")" +done + +echo +echo "All done!" +echo "Backup saved to: $BACKUP_DIR" +echo "Reboot to apply changes." diff --git a/scripts/files/cgnat.sh b/scripts/files/cgnat.sh new file mode 100755 index 0000000..8b17eb5 --- /dev/null +++ b/scripts/files/cgnat.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Comprehensive CGNAT and IPv6 connectivity checker for Linux + +# ----------- Public IPs ----------- +PUBLIC_IPV4=$(curl -4 -s https://ifconfig.me) +PUBLIC_IPV6=$(curl -6 -s https://ifconfig.me) + +# ----------- Local Interface Info ----------- +WAN_IF=$(ip route show default | awk '/default/ {print $5}') +LOCAL_IPV4=$(ip -4 addr show "$WAN_IF" | awk '/inet / {print $2}' | cut -d/ -f1) +LOCAL_IPV6=$(ip -6 addr show "$WAN_IF" | awk '/inet6 / && !/fe80/ {print $2}' | cut -d/ -f1) + +echo "===== CGNAT / IPv6 Check =====" +echo "Network interface: $WAN_IF" +echo + +echo "Local IPv4: $LOCAL_IPV4" +echo "Public IPv4: $PUBLIC_IPV4" +echo +echo "Local IPv6: $LOCAL_IPV6" +echo "Public IPv6: $PUBLIC_IPV6" +echo +echo "--------------------------------" + +# ----------- IPv4 Analysis ----------- +if [[ -z "$PUBLIC_IPV4" ]]; then + echo "🌐 No public IPv4 address detected (possibly IPv6-only connection)." +elif [[ "$LOCAL_IPV4" =~ ^10\. || "$LOCAL_IPV4" =~ ^192\.168\. || "$LOCAL_IPV4" =~ ^172\.(1[6-9]|2[0-9]|3[0-1])\. || "$LOCAL_IPV4" =~ ^100\.(6[4-9]|[7-9][0-9]|1[0-1][0-9]|12[0-7])\. ]]; then + if [ "$PUBLIC_IPV4" != "$LOCAL_IPV4" ]; then + echo "⚠️ Your local IPv4 ($LOCAL_IPV4) is private, and your public IPv4 differs." + echo "➡️ You are likely behind CGNAT or another NAT layer." + else + echo "✅ Local and public IPv4 match — you have a public IPv4 address." + fi +else + echo "✅ Local IPv4 appears to be public ($LOCAL_IPV4). No CGNAT detected." +fi + +echo "--------------------------------" + +# ----------- IPv6 Analysis ----------- +if [[ -n "$PUBLIC_IPV6" ]]; then + echo "✅ Public IPv6 is active — your device has global IPv6 connectivity." +else + echo "❌ No global IPv6 address detected." +fi + +echo "--------------------------------" +echo "Done." diff --git a/scripts/files/cleanup-snapper.sh b/scripts/files/cleanup-snapper.sh new file mode 100755 index 0000000..e60e6fa --- /dev/null +++ b/scripts/files/cleanup-snapper.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -e + +echo "=== Snapper Cleanup Script ===" + +# 1. Show existing configs +echo "[*] Listing Snapper configs..." +snapper list-configs || { echo "No snapper configs found."; exit 0; } + +# 2. For each config, list snapshots and ask to delete +for config in $(snapper list-configs | awk 'NR>1 {print $1}'); do + echo "" + echo "[*] Config: $config" + snapper -c "$config" list || true + read -rp "Delete ALL snapshots for config '$config'? [y/N] " ans + if [[ "$ans" =~ ^[Yy]$ ]]; then + echo " -> Deleting snapshots for $config" + snapper -c "$config" delete 1-999999 || true + fi + read -rp "Remove config '$config'? [y/N] " ans2 + if [[ "$ans2" =~ ^[Yy]$ ]]; then + echo " -> Removing config $config" + snapper delete-config "$config" || true + fi +done + +# 3. Optionally uninstall Snapper +read -rp "Do you also want to uninstall Snapper? [y/N] " ans3 +if [[ "$ans3" =~ ^[Yy]$ ]]; then + if command -v zypper >/dev/null 2>&1; then + sudo zypper remove -y snapper + elif command -v dnf >/dev/null 2>&1; then + sudo dnf remove -y snapper + elif command -v apt >/dev/null 2>&1; then + sudo apt remove -y snapper + else + echo "Could not detect package manager. Please uninstall Snapper manually." + fi +else + echo "Snapper package left installed." +fi + +echo "=== Snapper cleanup complete ===" diff --git a/scripts/files/fix-locale.sh b/scripts/files/fix-locale.sh new file mode 100755 index 0000000..07e1aab --- /dev/null +++ b/scripts/files/fix-locale.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +XKB_FILE="/usr/share/X11/xkb/symbols/us" +BACKUP_FILE="${XKB_FILE}.backup.$(date +%s)" + +echo "Creating backup at $BACKUP_FILE..." +sudo cp "$XKB_FILE" "$BACKUP_FILE" +if [ $? -ne 0 ]; then + echo "Backup failed." + exit 1 +fi + +echo "Modifying intl section to map acute+c to cedilla..." + +# Create a temp file with the fix +TEMP_FILE=$(mktemp) + +# Extract intl section, modify it, then rebuild the file +sudo bash << 'SCRIPT' +XKB_FILE="/usr/share/X11/xkb/symbols/us" +TEMP_FILE=$(mktemp) + +# Replace acute+c mapping with cedilla in the intl section +sed '/xkb_symbols "intl"/,/^}/ { + s/ccedil, Ccedil/ccedil, Ccedil/g + s/\[ acute,/[ dead_acute,/g +}' "$XKB_FILE" > "$TEMP_FILE.new" + +# If sed found the pattern, use it; otherwise, manually add cedilla to acute deadkey +if grep -q "dead_acute" "$TEMP_FILE.new"; then + mv "$TEMP_FILE.new" "$XKB_FILE" +else + # Fallback: inject cedilla mapping after the intl section starts + sed '/xkb_symbols "intl"/a\ // Map apostrophe+c to cedilla\n key { [ c, C, ccedil, Ccedil ] };' "$BACKUP_FILE" > "$XKB_FILE" +fi + +rm -f "$TEMP_FILE" "$TEMP_FILE.new" +SCRIPT + +echo "Clearing XKB cache..." +rm -rf ~/.cache/xkb 2>/dev/null + +echo "Reloading Niri..." +niri msg action quit + +echo "Done. Log back in." diff --git a/scripts/files/g80.bin b/scripts/files/g80.bin new file mode 100644 index 0000000..0e8548d Binary files /dev/null and b/scripts/files/g80.bin differ diff --git a/scripts/files/launch-daemon.sh b/scripts/files/launch-daemon.sh new file mode 100755 index 0000000..c29c51c --- /dev/null +++ b/scripts/files/launch-daemon.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +GAME_ID="1697700" +YOUR_HOME="/home/thomasgl" +YOUR_STEAM_DIR="$YOUR_HOME/.local/share/Steam" + +compatdataDir="$YOUR_STEAM_DIR/steamapps/compatdata/${GAME_ID}" +mkdir "$compatdataDir" 2> /dev/null +winePrefixDir=${compatdataDir}/pfx + +echo "Trying to enter winePrefixDir.." +cd "$winePrefixDir" || exit +echo "Entered winePrefixDir!" + +export STEAM_COMPAT_DATA_PATH="$compatdataDir" +export STEAM_COMPAT_CLIENT_INSTALL_PATH="$YOUR_HOME/.steam" +export WINEPREFIX="${winePrefixDir}" + +echo "Starting..." +"$YOUR_STEAM_DIR/compatibilitytools.d/GE-Proton10-16/proton" run "$YOUR_STEAM_DIR/steamapps/common/Who's Lila/DAEMON/DAEMON.exe" diff --git a/scripts/files/launch-lila.sh b/scripts/files/launch-lila.sh new file mode 100755 index 0000000..9f4e0cf --- /dev/null +++ b/scripts/files/launch-lila.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +GAME_ID="1697700" +YOUR_HOME="/home/thomasgl" +YOUR_STEAM_DIR="$YOUR_HOME/.local/share/Steam" + +compatdataDir="$YOUR_STEAM_DIR/steamapps/compatdata/${GAME_ID}" +mkdir "$compatdataDir" 2> /dev/null +winePrefixDir=${compatdataDir}/pfx + +echo "Trying to enter winePrefixDir.." +cd "$winePrefixDir" || exit +echo "Entered winePrefixDir!" + +export STEAM_COMPAT_DATA_PATH="$compatdataDir" +export STEAM_COMPAT_CLIENT_INSTALL_PATH="$YOUR_HOME/.steam" +export WINEPREFIX="${winePrefixDir}" + +echo "Starting..." +"$YOUR_STEAM_DIR/compatibilitytools.d/GE-Proton10-16/proton" run "$YOUR_STEAM_DIR/steamapps/common/Who's Lila/WhosLila.exe" diff --git a/scripts/files/random-wallpaper.sh b/scripts/files/random-wallpaper.sh new file mode 100755 index 0000000..9c8e1fa --- /dev/null +++ b/scripts/files/random-wallpaper.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Predefined folder path +FOLDER="$HOME/wallpapers" + +# Check if folder exists +if [[ ! -d "$FOLDER" ]]; then + echo "Error: Folder '$FOLDER' does not exist." >&2 + exit 1 +fi + +# Find all image files recursively +images=($(find "$FOLDER" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o -iname "*.bmp" -o -iname "*.webp" \) 2>/dev/null)) + +# Check if any images were found +if [[ ${#images[@]} -eq 0 ]]; then + echo "No image files found in '$FOLDER' or its subdirectories" >&2 + exit 1 +fi + +# Select and output random image path +random_index=$((RANDOM % ${#images[@]})) +echo "${images[$random_index]}" diff --git a/scripts/files/reset-dp.sh b/scripts/files/reset-dp.sh new file mode 100755 index 0000000..f20de4b --- /dev/null +++ b/scripts/files/reset-dp.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Wait for Hyprland to fully initialize +sleep 2 + +OUTPUT="DP-1" +MODE="3840x2160@239.914001" # exact mode from wlr-randr + +# Turn off and back on +wlr-randr --output "$OUTPUT" --off +sleep 1 +wlr-randr --output "$OUTPUT" --mode "$MODE" diff --git a/scripts/files/rofi-media.sh b/scripts/files/rofi-media.sh new file mode 100755 index 0000000..3b45ec9 --- /dev/null +++ b/scripts/files/rofi-media.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Get the list of sinks and format for Rofi (index and name) +sinks=$(pactl list sinks short | awk '{print $2}') + +# Use Rofi to select a sink (case-insensitive search) +selected_sink_name=$(echo "$sinks" | rofi -i -dmenu -p "Select audio output:") + +# If a sink was selected +if [ -n "$selected_sink_name" ]; then + # Get the index of the selected sink + selected_sink_index=$(pactl list sinks short | grep -F "$selected_sink_name" | awk '{print $1}' | head -n 1) + + # Set the default sink + pactl set-default-sink "$selected_sink_index" +fi