#!/bin/bash # ▄█ █▄ ▄████████ ▄█ ▄█ ▄█ ▄████████ ▄██ ▄ # ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ██▄ # ███ ███ ███ ███ ███ ███ ███▌ ███ █▀ ███▄▄▄███ # ███ ███ ███ ███ ███ ███ ███▌ ▄███▄▄▄ ▀▀▀▀▀▀███ # ███ ███ ▀███████████ ███ ███ ███▌ ▀▀███▀▀▀ ▄██ ███ # ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ # ███ ▄█▄ ███ ███ ███ ███▌ ▄ ███▌ ▄ ███ ███ ███ ███ # ▀███▀███▀ ███ █▀ █████▄▄██ █████▄▄██ █▀ ███ ▀█████▀ # ▀ ▀ # help() # # Print the help message function help() { echo "Usage: $0 [-h | -c | --uninstall]" echo "" echo "-h, --help Show this help" echo "-c, --config Start the setup process" echo "--uninstall Uninstall the software" } # uninstall() # # Uninstall Wallify. This function will remove the autostart file, # the configuration file and the configuration directory. function uninstall() { start_time=$(date +%s%3N) echo "Uninstalling..." if [ -f ~/.config/autostart/wallify.sh.desktop ]; then rm -f ~/.config/autostart/wallify.sh.desktop else echo "Error: ~/.config/autostart/wallify.sh.desktop does not exist." fi if [ -d ~/.config/Wallify ]; then rm -rf ~/.config/Wallify else echo "Error: ~/.config/Wallify does not exist." fi echo "Done." end_time=$(date +%s%3N) duration=$((end_time - start_time)) echo "Uninstallation took $duration milliseconds." } # config() # # This function is used to configure Wallify. It will ask the user to select # a wallpaper file and then create a configuration file, a start script and an # autostart file. The configuration file will be saved in # `~/.config/Wallify/wallpaper.conf` and will contain the path of the selected # wallpaper. The start script will be saved in # `~/.config/Wallify/start.sh` and will contain the command to launch the # wallpaper with the selected options. The autostart file will be saved in # `~/.config/autostart/wallify.sh.desktop` and will contain the command to launch # the start script on startup. function config() { USER=$(whoami) WALLPAPER_FILE=$(zenity --file-selection --title="Wallify - Select a wallpaper" --filename="" 2>/dev/null) if [ $? -eq 0 ]; then echo "Selected file: $WALLPAPER_FILE" if [ -f "$WALLPAPER_FILE" ]; then echo "+ Creating configuration directory" mkdir -p ~/.config/Wallify echo "+ Creating configuration file" echo "WALLPAPER_FILE=$WALLPAPER_FILE" > ~/.config/Wallify/wallpaper.conf echo "+ Creating start.sh script" cat > ~/.config/Wallify/start.sh <