#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/../lib/common.sh" source "$SCRIPT_DIR/../lib/package.sh" # Only run on elementary OS if ! is_elementary; then log_info "Skipping elementary OS defaults (not running on elementary OS)" exit 0 fi log_info "Configuring elementary OS defaults" ############################################################################### # Install Prerequisites ############################################################################### log_info "Installing theme prerequisites" # Ensure git is installed (needed for cloning theme repos) if ! command_exists git; then log_info "Installing git" maybe_sudo apt-get update maybe_sudo apt-get install -y git fi # Install GTK theme engines required for MacTahoe theme log_info "Installing GTK theme engines" maybe_sudo apt-get update maybe_sudo apt-get install -y \ gtk2-engines-murrine \ gtk2-engines-pixbuf \ sassc \ optipng log_success "Prerequisites installed" ############################################################################### # Setup directories ############################################################################### THEME_DIR="$HOME/.themes" ICON_DIR="$HOME/.icons" WALLPAPER_DIR="$HOME/.local/share/backgrounds" ensure_dir "$THEME_DIR" ensure_dir "$ICON_DIR" ensure_dir "$WALLPAPER_DIR" ############################################################################### # Download MacTahoe Wallpapers ############################################################################### log_info "Setting up MacTahoe wallpapers" # Check if wallpapers are already downloaded if ls "$WALLPAPER_DIR"/MacTahoe-*.jpg >/dev/null 2>&1 || ls "$WALLPAPER_DIR"/MacTahoe-*.png >/dev/null 2>&1; then log_success "MacTahoe wallpapers already downloaded" # Use the first available wallpaper WALLPAPER_FILE=$(ls "$WALLPAPER_DIR"/MacTahoe-*.{jpg,png} 2>/dev/null | head -n 1) else log_info "Downloading MacTahoe wallpapers from theme repository" # Clone the MacTahoe GTK theme repository to get wallpapers TEMP_DIR=$(mktemp -d) cd "$TEMP_DIR" git clone --depth=1 https://github.com/vinceliuice/MacTahoe-gtk-theme.git cd MacTahoe-gtk-theme # Check if wallpapers directory exists and copy wallpapers if [ -d "wallpaper" ]; then cp wallpaper/*.{jpg,png} "$WALLPAPER_DIR/" 2>/dev/null || true log_success "MacTahoe wallpapers copied to $WALLPAPER_DIR" elif [ -d "src/wallpapers" ]; then cp src/wallpapers/*.{jpg,png} "$WALLPAPER_DIR/" 2>/dev/null || true log_success "MacTahoe wallpapers copied to $WALLPAPER_DIR" else log_warn "No wallpapers found in MacTahoe theme repository" fi # Clean up cd "$HOME" rm -rf "$TEMP_DIR" # Select the first available wallpaper WALLPAPER_FILE=$(ls "$WALLPAPER_DIR"/MacTahoe-*.{jpg,png} 2>/dev/null | head -n 1) if [ -z "$WALLPAPER_FILE" ]; then log_warn "No MacTahoe wallpapers found, will use system default" fi fi ############################################################################### # Install MacTahoe GTK Theme ############################################################################### log_info "Installing MacTahoe GTK theme" # Check if theme is already installed if [ -d "$THEME_DIR/MacTahoe-gtk-theme" ] || [ -d "$THEME_DIR/MacTahoe" ]; then log_success "MacTahoe GTK theme already installed" else log_info "Downloading and installing MacTahoe GTK theme" # Clone the repository to a temporary directory TEMP_DIR=$(mktemp -d) cd "$TEMP_DIR" log_info "Cloning MacTahoe GTK theme repository" git clone --depth=1 https://github.com/vinceliuice/MacTahoe-gtk-theme.git cd MacTahoe-gtk-theme # Run the installation script log_info "Running GTK theme installation script" ./install.sh -d "$THEME_DIR" # Clean up cd "$HOME" rm -rf "$TEMP_DIR" log_success "MacTahoe GTK theme installed to $THEME_DIR" fi ############################################################################### # Install MacTahoe Icon Theme ############################################################################### log_info "Installing MacTahoe icon theme" # Check if icon theme is already installed if [ -d "$ICON_DIR/MacTahoe-icon-theme" ] || [ -d "$ICON_DIR/MacTahoe" ]; then log_success "MacTahoe icon theme already installed" else log_info "Downloading and installing MacTahoe icon theme" # Clone the repository to a temporary directory TEMP_DIR=$(mktemp -d) cd "$TEMP_DIR" log_info "Cloning MacTahoe icon theme repository" git clone --depth=1 https://github.com/vinceliuice/MacTahoe-icon-theme.git cd MacTahoe-icon-theme # Run the installation script log_info "Running icon theme installation script" ./install.sh -d "$ICON_DIR" # Clean up cd "$HOME" rm -rf "$TEMP_DIR" log_success "MacTahoe icon theme installed to $ICON_DIR" fi ############################################################################### # Install MacTahoe Cursor Theme ############################################################################### log_info "Installing MacTahoe cursor theme" # Check if cursor theme is already installed if [ -d "$ICON_DIR/MacTahoe-cursors" ] || [ -d "$ICON_DIR/MacTahoe" ]; then log_success "MacTahoe cursor theme already installed" else log_info "Downloading and installing MacTahoe cursor theme" # Clone the repository to a temporary directory TEMP_DIR=$(mktemp -d) cd "$TEMP_DIR" log_info "Cloning MacTahoe icon theme repository (includes cursors)" git clone --depth=1 https://github.com/vinceliuice/MacTahoe-icon-theme.git cd MacTahoe-icon-theme/cursors # Run the installation script log_info "Running cursor theme installation script" ./install.sh # Clean up cd "$HOME" rm -rf "$TEMP_DIR" log_success "MacTahoe cursor theme installed to $ICON_DIR" fi ############################################################################### # Apply Themes ############################################################################### log_info "Applying MacTahoe themes" # Check if gsettings is available if command_exists gsettings; then # Set GTK theme gsettings set org.gnome.desktop.interface gtk-theme "MacTahoe" # Set window manager theme (for Pantheon) gsettings set org.gnome.desktop.wm.preferences theme "MacTahoe" # Set icon theme gsettings set org.gnome.desktop.interface icon-theme "MacTahoe" # Set cursor theme gsettings set org.gnome.desktop.interface cursor-theme "MacTahoe-cursors" log_success "MacTahoe themes applied (GTK, icons, and cursor)" else log_warn "gsettings not found, themes installed but not applied" log_info "You can manually apply the themes in System Settings > Desktop > Appearance" fi ############################################################################### # Configure GDM/LightDM Theme and Wallpaper ############################################################################### log_info "Configuring display manager theme and wallpaper" # Copy wallpaper to system location if it exists if [ -n "$WALLPAPER_FILE" ] && [ -f "$WALLPAPER_FILE" ]; then maybe_sudo mkdir -p /usr/share/backgrounds/provision 2>/dev/null || true maybe_sudo cp "$WALLPAPER_FILE" /usr/share/backgrounds/provision/wallpaper.jpg 2>/dev/null || true SYSTEM_WALLPAPER="/usr/share/backgrounds/provision/wallpaper.jpg" else SYSTEM_WALLPAPER="/usr/share/backgrounds/elementaryos-default" fi # Check if gdm3 is installed if command_exists gdm3 || [ -f /etc/gdm3/greeter.dconf-defaults ] || [ -f /usr/share/gnome-shell/theme/gdm3.css ]; then log_info "Configuring GDM theme and wallpaper" # Update alternatives to use MacTahoe theme for GDM if [ -d "$THEME_DIR/MacTahoe" ]; then maybe_sudo update-alternatives --install /usr/share/gnome-shell/theme/gdm3.css gdm3.css "$THEME_DIR/MacTahoe/gnome-shell/gnome-shell.css" 100 2>/dev/null || true fi # Set GDM wallpaper if [ -f /etc/gdm3/greeter.dconf-defaults ]; then maybe_sudo sed -i.backup "s|^picture-uri=.*|picture-uri='file://$SYSTEM_WALLPAPER'|" /etc/gdm3/greeter.dconf-defaults 2>/dev/null || true log_success "GDM theme and wallpaper configured" fi # Check if lightdm is installed (elementary OS default) elif command_exists lightdm || [ -f /etc/lightdm/lightdm.conf ]; then log_info "LightDM detected (elementary OS default display manager)" # Configure LightDM greeter theme and wallpaper if [ -f /etc/lightdm/lightdm-gtk-greeter.conf ]; then maybe_sudo sed -i.backup "s/^theme-name=.*/theme-name=MacTahoe/" /etc/lightdm/lightdm-gtk-greeter.conf 2>/dev/null || true maybe_sudo sed -i "s/^icon-theme-name=.*/icon-theme-name=MacTahoe/" /etc/lightdm/lightdm-gtk-greeter.conf 2>/dev/null || true maybe_sudo sed -i "s|^background=.*|background=$SYSTEM_WALLPAPER|" /etc/lightdm/lightdm-gtk-greeter.conf 2>/dev/null || true # Add wallpaper line if it doesn't exist if ! grep -q "^background=" /etc/lightdm/lightdm-gtk-greeter.conf 2>/dev/null; then echo "background=$SYSTEM_WALLPAPER" | maybe_sudo tee -a /etc/lightdm/lightdm-gtk-greeter.conf > /dev/null fi log_success "LightDM greeter theme and wallpaper configured" else log_info "LightDM config not found, creating it" maybe_sudo tee /etc/lightdm/lightdm-gtk-greeter.conf > /dev/null << EOF [greeter] theme-name=MacTahoe icon-theme-name=MacTahoe cursor-theme-name=MacTahoe-cursors font-name=Meslo LG S Nerd Font 11 background=$SYSTEM_WALLPAPER EOF log_success "LightDM greeter theme and wallpaper configured" fi fi ############################################################################### # Set Desktop Wallpaper ############################################################################### log_info "Setting desktop wallpaper" if command_exists gsettings && [ -n "$WALLPAPER_FILE" ] && [ -f "$WALLPAPER_FILE" ]; then # Set wallpaper for Pantheon/GNOME gsettings set org.gnome.desktop.background picture-uri "file://$WALLPAPER_FILE" 2>/dev/null || true gsettings set org.gnome.desktop.background picture-uri-dark "file://$WALLPAPER_FILE" 2>/dev/null || true gsettings set org.gnome.desktop.background picture-options "zoom" 2>/dev/null || true log_success "Desktop wallpaper set to $WALLPAPER_FILE" else log_warn "Skipping desktop wallpaper configuration" fi ############################################################################### # Additional Elementary OS Tweaks ############################################################################### log_info "Applying additional elementary OS tweaks" if command_exists gsettings; then # Enable dark mode gsettings set io.elementary.settings-daemon.prefers-color-scheme "dark" 2>/dev/null || true gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" 2>/dev/null || true # Pantheon Desktop tweaks gsettings set org.pantheon.desktop.gala.behavior overlay-action "'wingpanel --toggle-indicator=app-launcher'" 2>/dev/null || true # Disable hot corners (optional, can be customized) gsettings set org.pantheon.desktop.gala.behavior hotcorner-topleft "'none'" 2>/dev/null || true gsettings set org.pantheon.desktop.gala.behavior hotcorner-topright "'none'" 2>/dev/null || true gsettings set org.pantheon.desktop.gala.behavior hotcorner-bottomleft "'none'" 2>/dev/null || true gsettings set org.pantheon.desktop.gala.behavior hotcorner-bottomright "'none'" 2>/dev/null || true # Window button layout (macOS-like: close on left) gsettings set org.gnome.desktop.wm.preferences button-layout "close,minimize,maximize:" 2>/dev/null || true # Font settings gsettings set org.gnome.desktop.interface font-name "Inter 10" 2>/dev/null || true gsettings set org.gnome.desktop.interface document-font-name "Inter 11" 2>/dev/null || true gsettings set org.gnome.desktop.interface monospace-font-name "Meslo LG S Nerd Font 10" 2>/dev/null || true gsettings set org.gnome.desktop.wm.preferences titlebar-font "Inter Medium 10" 2>/dev/null || true # Touchpad settings (natural scrolling like macOS) gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll true 2>/dev/null || true gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true 2>/dev/null || true # Animations gsettings set org.pantheon.desktop.gala.animations enable-animations true 2>/dev/null || true gsettings set org.gnome.desktop.interface enable-animations true 2>/dev/null || true # Dock settings (Plank) gsettings set net.launchpad.plank.dock.settings:/net/launchpad/plank/docks/dock1/ icon-size 48 2>/dev/null || true gsettings set net.launchpad.plank.dock.settings:/net/launchpad/plank/docks/dock1/ hide-mode "'window-dodge'" 2>/dev/null || true gsettings set net.launchpad.plank.dock.settings:/net/launchpad/plank/docks/dock1/ theme "'MacTahoe'" 2>/dev/null || true gsettings set net.launchpad.plank.dock.settings:/net/launchpad/plank/docks/dock1/ position "'bottom'" 2>/dev/null || true log_success "Elementary OS tweaks applied" else log_warn "gsettings not found, skipping additional tweaks" fi log_success "elementary OS defaults configured" log_info "Changes should take effect immediately. For display manager changes, logout/login required."