add home to repo

This commit is contained in:
valere
2025-11-15 09:59:44 +01:00
parent 170ede89f8
commit 463540770a
85 changed files with 1051 additions and 0 deletions

77
home/gamecube-pad/install.sh Executable file
View File

@@ -0,0 +1,77 @@
#!/bin/bash
set -e
PYTHON_SCRIPT="$HOME/.local/bin/gamecube-pad.py"
AUTOSTART_DIR="$HOME/.config/autostart"
AUTOSTART_FILE="$AUTOSTART_DIR/gamecube-pad.desktop"
SILENT=false
if [[ "$1" == "silent" ]]; then
SILENT=true
fi
log() {
if [ "$SILENT" = false ]; then
echo "$@"
fi
}
check_and_install_deps() {
for pkg in evdev uinput; do
if ! python3 -c "import $pkg" &>/dev/null; then
log "[!] Dépendance manquante : $pkg. Installation avec pip..."
python3 -m pip install --user "$pkg" &>/dev/null
fi
done
for cmd in xdotool wmctrl; do
if ! command -v "$cmd" &>/dev/null; then
log "[!] Commande manquante : $cmd. Merci de linstaller via votre gestionnaire de paquets."
fi
done
}
install_script() {
check_and_install_deps
log "[+] Copie du script Python..."
mkdir -p "$(dirname "$PYTHON_SCRIPT")"
cp "$HOME/.linux-env/gamecube-pad/gamecube-pad.py" "$PYTHON_SCRIPT"
chmod +x "$PYTHON_SCRIPT"
log "[+] Création du fichier autostart..."
mkdir -p "$AUTOSTART_DIR"
cat > "$AUTOSTART_FILE" <<EOF
[Desktop Entry]
Type=Application
Exec=$PYTHON_SCRIPT
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=GameCube Pad
Comment=Lance le script GameCube Pad au démarrage
EOF
log "[✓] Installation terminée. Le script se lancera automatiquement à l'ouverture de session."
}
uninstall_script() {
log "[+] Suppression du script Python et autostart..."
rm -f "$PYTHON_SCRIPT"
rm -f "$AUTOSTART_FILE"
log "[✓] Désinstallation terminée."
}
case "$1" in
uninstall)
uninstall_script
;;
silent)
SILENT=true
uninstall_script &>/dev/null
install_script &>/dev/null
;;
*)
install_script
;;
esac