Created
August 30, 2025 13:33
-
-
Save DAK404/5cc3c8fab5a330941c33a9b28d75bde5 to your computer and use it in GitHub Desktop.
Vinceliuice's Icon Theme Universal Installer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # Universal Icon Theme Installer for VinceLiuice themes | |
| # | |
| set -e | |
| # ------------------- | |
| # Config & Defaults | |
| # ------------------- | |
| GITHUB_BASE="https://github.com/vinceliuice" | |
| DEST_DIR="$HOME/.local/share/icons" | |
| THEME_NAME="" | |
| REPO_NAME="" | |
| THEME_VARIANT="" | |
| COLOR_VARIANT="" | |
| BOLD_VARIANT="" | |
| ACTION="install" # install | uninstall | |
| # ------------------- | |
| # Helper Functions | |
| # ------------------- | |
| # Print the help information | |
| print_usage() { | |
| echo "Usage: $0 -r <repo> -n <theme-name> [options]" | |
| echo | |
| echo "Options:" | |
| echo " -r, --repo GitHub repo name (required)" | |
| echo " -n, --name Theme name (required)" | |
| echo " -t, --theme Theme variant (e.g., blue, purple, nord, all)" | |
| echo " -c, --color Color variant (e.g., light, dark)" | |
| echo " -b, --bold Enable bold variant" | |
| echo " -d, --dest Destination directory (default: ~/.local/share/icons)" | |
| echo " -u, --uninstall Uninstall theme" | |
| echo " -h, --help Show help" | |
| echo | |
| echo "Examples:" | |
| echo " $0 -r WhiteSur-icon-theme -n WhiteSur" | |
| echo " $0 -r MacOS-icon-theme -n MacTahoe -t blue -c dark -b" | |
| echo " $0 -r Tela-icon-theme -n Tela -u" | |
| } | |
| # Parse the arguments to install variants and types for the icon themes | |
| parse_args() { | |
| while [[ $# -gt 0 ]]; do | |
| case "$1" in | |
| -r|--repo) REPO_NAME="$2"; shift 2 ;; | |
| -n|--name) THEME_NAME="$2"; shift 2 ;; | |
| -t|--theme) THEME_VARIANT="$2"; shift 2 ;; | |
| -c|--color) COLOR_VARIANT="$2"; shift 2 ;; | |
| -b|--bold) BOLD_VARIANT="true"; shift ;; | |
| -d|--dest) DEST_DIR="$2"; shift 2 ;; | |
| -u|--uninstall) ACTION="uninstall"; shift ;; | |
| -h|--help) print_usage; exit 0 ;; | |
| *) echo "Unknown option: $1"; print_usage; exit 1 ;; | |
| esac | |
| done | |
| if [[ -z "$REPO_NAME" || -z "$THEME_NAME" ]]; then | |
| echo "Error: Repo name and theme name are required." | |
| print_usage | |
| exit 1 | |
| fi | |
| } | |
| # Set the destination directory if script is executed with sudo | |
| detect_dest_dir() { | |
| if [[ $EUID -eq 0 ]]; then | |
| DEST_DIR="/usr/share/icons" | |
| fi | |
| } | |
| # Clone the Icon theme's repo from GitHub | |
| clone_repo() { | |
| local tmp_dir=$(mktemp -d) | |
| echo "Cloning $REPO_NAME from GitHub..." | |
| git clone --depth=1 "$GITHUB_BASE/$REPO_NAME" "$tmp_dir" | |
| echo "$tmp_dir" | |
| } | |
| # Install the theme based on the arguments parsed | |
| install_theme() { | |
| local tmp_dir="$1" | |
| echo "Installing $THEME_NAME into $DEST_DIR" | |
| mkdir -p "$DEST_DIR" | |
| local install_cmd=("./install.sh" "-d" "$DEST_DIR") | |
| [[ -n "$THEME_VARIANT" ]] && install_cmd+=("-t" "$THEME_VARIANT") | |
| [[ -n "$COLOR_VARIANT" ]] && install_cmd+=("-c" "$COLOR_VARIANT") | |
| [[ -n "$BOLD_VARIANT" ]] && install_cmd+=("-b") | |
| (cd "$tmp_dir" && bash "${install_cmd[@]}") | |
| echo "✅ Installed $THEME_NAME successfully." | |
| } | |
| uninstall_theme() { | |
| echo "Uninstalling $THEME_NAME from $DEST_DIR" | |
| rm -rf "$DEST_DIR/$THEME_NAME"* | |
| echo "❌ Removed $THEME_NAME." | |
| } | |
| # ------------------- | |
| # Main | |
| # ------------------- | |
| main() { | |
| parse_args "$@" | |
| detect_dest_dir | |
| if [[ "$ACTION" == "uninstall" ]]; then | |
| uninstall_theme | |
| exit 0 | |
| fi | |
| local repo_dir | |
| repo_dir=$(clone_repo) | |
| install_theme "$repo_dir" | |
| rm -rf "$repo_dir" | |
| } | |
| main "$@" | |
| ############################### | |
| # Example usage for the themes | |
| # ./install.sh -r MacOS-icon-theme -n MacTahoe -t blue -c dark -b | |
| # Installs MacTahoe theme, blue icons with dark variant | |
| ############################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment