#!/bin/bash # Infinite loop to keep the script running after the user exits the greeter while true; do # List directories in /usr/share/sddm/themes themes_dir="/usr/share/sddm/themes" # List directories, extract only names, and append "Exit" option themes=$(ls -d "$themes_dir"/*/ | xargs -n 1 basename) last_chosen_theme="${chosen_theme}" # Combine themes list with "Exit" option options=$(echo -e "$themes\nSet theme ${last_chosen_theme}") # Use gum to choose a theme or exit chosen_theme=$(echo "$options" | gum choose) # Check if the user chose "Exit", if so, break the loop and exit if [ "$chosen_theme" == "Set theme ${last_chosen_theme}" ]; then echo $themes_dir/$last_chosen_theme break fi # If the user selects a theme, run the sddm-greeter in test mode if [ -n "$chosen_theme" ]; then sddm-greeter --test-mode --theme "$themes_dir/$chosen_theme" > /dev/null 2>&1 fi done