diff --git a/README.md b/README.md index ceb5b32..98b8f35 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # TyOS-Local-Scripts -Scripts intégrés de TyOS - Ce dépôt peut être réinjecter dans l'OS dynamiquement ! \ No newline at end of file +Scripts intégrés de TyOS - Ce dépôt peut être réinjecter dans l'OS dynamiquement. \ No newline at end of file diff --git a/flatpak_selections b/flatpak_selections new file mode 100644 index 0000000..260186a --- /dev/null +++ b/flatpak_selections @@ -0,0 +1,35 @@ +#!/bin/bash + +# Directory containing scripts +SCRIPT_DIR="/usr/local/bin/flatpacks" + +# Check if the directory exists +if [[ ! -d "$SCRIPT_DIR" ]]; then + echo "Directory $SCRIPT_DIR does not exist." + exit 1 +fi + +# Get list of scripts +SCRIPTS=($(ls "$SCRIPT_DIR")) + +# Check if there are any scripts +if [[ ${#SCRIPTS[@]} -eq 0 ]]; then + whiptail --msgbox "No scripts found in $SCRIPT_DIR" 10 40 + exit 0 +fi + +# Build menu options +MENU_OPTIONS=() +for SCRIPT in "${SCRIPTS[@]}"; do + MENU_OPTIONS+=("$SCRIPT" "$SCRIPT") +done + +# Show menu with the new title +SELECTED_SCRIPT=$(whiptail --title "TyOS Flatpak Selections" --menu "Choose a script to run:" 20 60 10 "${MENU_OPTIONS[@]}" 3>&1 1>&2 2>&3) + +# Check if a script was selected +if [[ -n "$SELECTED_SCRIPT" ]]; then + bash "$SCRIPT_DIR/$SELECTED_SCRIPT" +else + whiptail --msgbox "No script selected." 10 40 +fi