feat: install script re-org

This commit is contained in:
2026-02-13 15:13:12 +00:00
parent faf3bf2dfc
commit eb958a36e0
26 changed files with 5 additions and 3 deletions

28
install.d/00-os.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Print operating system information and hint which installer path will run.
#
log_info "Environment: DOTS_OS=$DOTS_OS, DOTS_PKG=$DOTS_PKG, DOTS_ENV=$DOTS_ENV"
if [[ "$DOTS_OS" == "macos" ]]; then
sw_vers
elif [[ "$DOTS_OS" == "linux" ]]; then
if [[ -r /etc/os-release ]]; then
cat /etc/os-release
fi
if [[ -z "$DOTS_PKG" ]]; then
log_warn "No known package manager found on Linux"
fi
else
log_error "Unknown OS: $DOTS_OS"
fi
if [[ "$DOTS_ENV" == "codespaces" ]]; then
log_info "Running in GitHub Codespaces"
fi
log_pass "OS detection complete"

19
install.d/10-brew.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS only) Install homebrew.
#
# macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_skip "Not macOS"; return 0; }
if ! command -v brew &> /dev/null; then
echo "Installing Homebrew..."
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
else
echo "Homebrew is already installed."
fi
brew --version
log_pass "Homebrew installed"

26
install.d/11-apt.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (distros with apt only) Install core apt packages.
#
# apt only
[[ "$DOTS_PKG" != "apt" ]] && { log_skip "Not using apt"; return 0; }
apt_packages=(
build-essential
ca-certificates
curl
gnupg
gnupg2
wget
)
sudo apt-get update -qq
sudo apt-get install -qq "${apt_packages[@]}"
unset apt_packages
apt --version
log_pass "apt packages installed"

35
install.d/12-pacman.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (distros with pacman only) Install core pacman packages.
#
# pacman only
[[ "$DOTS_PKG" != "pacman" ]] && { log_skip "Not using pacman"; return 0; }
pacman_packages=(
ca-certificates
curl
git
gnupg
wget
base-devel
)
sudo pacman -Sy --noconfirm
sudo pacman -S --noconfirm --needed "${pacman_packages[@]}"
unset pacman_packages
# Install yay (AUR helper)
if ! command -v yay &>/dev/null; then
log_info "Installing yay..."
git clone https://aur.archlinux.org/yay.git /tmp/yay
(cd /tmp/yay && makepkg -si --noconfirm)
rm -rf /tmp/yay
fi
pacman --version
yay --version
log_pass "pacman packages installed"

29
install.d/20-ssh.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Print SSH key.
#
# Skip in Codespaces (managed by GitHub)
[[ "$DOTS_ENV" == "codespaces" ]] && { log_skip "Codespaces"; return 0; }
# Skip if explicitly disabled
[[ -n "$SKIP_SSH_CONFIG" ]] && { log_skip "SKIP_SSH_CONFIG is set"; return 0; }
ssh_method="ed25519"
ssh_target="${HOME}/.ssh"
ssh_key="${ssh_target}/id_${ssh_method}"
ssh_pub="${ssh_key}.pub"
if [ ! -f "$ssh_key" ]; then
ssh-keygen \
-t "$ssh_method" \
-f "$ssh_key" \
-C "$(whoami)@$(hostname)-$(date -I)"
fi
cat "$ssh_pub"
unset ssh_method ssh_target ssh_key ssh_pub
log_pass "SSH key configured"

30
install.d/21-git.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Configure git.
#
# Skip in Codespaces (pre-installed in universal image)
[[ "$DOTS_ENV" == "codespaces" ]] && { log_skip "Codespaces"; git --version; return 0; }
if ! command -v git &> /dev/null; then
case "$DOTS_PKG" in
apt)
sudo apt-get install -qq git
;;
pacman)
sudo pacman -S --noconfirm git
;;
brew)
brew install git
;;
*)
log_warn "Skipping git install: no supported package manager found"
return 0
;;
esac
fi
git --version
log_pass "git configured"

53
install.d/22-zsh.sh Executable file
View File

@@ -0,0 +1,53 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Configure zsh shell with direct plugin management.
#
# install zsh
if ! command -v zsh &> /dev/null; then
case "$DOTS_PKG" in
apt)
sudo apt-get install -qq zsh
;;
pacman)
sudo pacman -S --noconfirm zsh
;;
brew)
brew install zsh
;;
*)
log_warn "Skipping zsh install: no supported package manager found"
return 0
;;
esac
fi
zsh --version
# plugin directory (XDG compliant)
PLUGIN_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins"
mkdir -p "$PLUGIN_DIR"
# install zsh-autosuggestions
if [ ! -d "$PLUGIN_DIR/zsh-autosuggestions" ]; then
git clone -q \
https://github.com/zsh-users/zsh-autosuggestions.git \
"$PLUGIN_DIR/zsh-autosuggestions"
fi
# install zsh-syntax-highlighting
if [ ! -d "$PLUGIN_DIR/zsh-syntax-highlighting" ]; then
git clone -q \
https://github.com/zsh-users/zsh-syntax-highlighting.git \
"$PLUGIN_DIR/zsh-syntax-highlighting"
fi
# change default shell to zsh
if [[ "$SHELL" != *zsh ]]; then
sudo chsh -s "$(command -v zsh)" "$(whoami)"
sudo usermod -s "$(command -v zsh)" "$(whoami)"
fi
log_pass "zsh configured"

46
install.d/23-stow.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Install and run stow.
#
if ! command -v stow &> /dev/null; then
case "$DOTS_PKG" in
apt)
sudo apt-get install -qq stow
;;
pacman)
sudo pacman -S --noconfirm stow
;;
brew)
brew install stow
;;
*)
log_warn "Skipping stow install: no supported package manager found"
return 0
;;
esac
fi
stow --version
root_dir=${DOTFILES:-$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")}
rm -f "$HOME/.bash_profile"
rm -f "$HOME/.bashrc"
rm -f "$HOME/.gitconfig"
rm -f "$HOME/.profile"
rm -f "$HOME/.zshrc"
rm -f "$HOME/.p10k.zsh"
rm -f "$HOME/.ssh/config"
mkdir -p "$HOME/.config"
mkdir -p "$HOME/.ssh"
stow --dir="$root_dir" --target="$HOME" home
# Bust PATH cache to force regeneration with new profile
rm -f "${XDG_CACHE_HOME:-$HOME/.cache}/dots/path"
log_pass "stow linked"

27
install.d/24-tmux.sh Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Install and configure tmux.
#
if ! command -v tmux &> /dev/null; then
case "$DOTS_PKG" in
apt)
sudo apt-get install -qq tmux
;;
pacman)
sudo pacman -S --noconfirm tmux
;;
brew)
brew install tmux
;;
*)
log_warn "Skipping tmux install: no supported package manager found"
return 0
;;
esac
fi
tmux -V
log_pass "tmux installed"

106
install.d/30-mise.sh Executable file
View File

@@ -0,0 +1,106 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Install mise runtime manager and all development tools.
# Consolidated installation of Python, Node.js, GitHub CLI, Terraform, Firebase, etc.
#
# Install mise
if ! command -v mise &>/dev/null; then
log_info "Installing mise..."
case "$DOTS_PKG" in
brew)
brew install mise
;;
apt)
# https://mise.jdx.dev/getting-started.html#apt-debian-ubuntu
wget -qO - https://mise.jdx.dev/gpg-key.pub | gpg --dearmor | \
sudo tee /etc/apt/keyrings/mise-archive-keyring.gpg 1> /dev/null
echo "deb [signed-by=/etc/apt/keyrings/mise-archive-keyring.gpg arch=amd64] https://mise.jdx.dev/deb stable main" | \
sudo tee /etc/apt/sources.list.d/mise.list
sudo apt-get update -qq
sudo apt-get install -qq mise
;;
pacman)
yay -S --noconfirm mise
;;
*)
# Fallback: curl install
log_info "Using curl installer..."
curl https://mise.jdx.dev/install.sh | sh
# Add to PATH for current session
export PATH="$HOME/.local/bin:$PATH"
;;
esac
fi
mise --version
# Skip runtimes in Codespaces (use pre-installed versions)
if [[ "$DOTS_ENV" != "codespaces" ]]; then
typeset -a MISE_RUNTIMES=(
"python@3.14.2"
"node@25.5.0"
)
log_info "Installing runtimes..."
mise install "${MISE_RUNTIMES[@]}"
for tool in "${MISE_RUNTIMES[@]}"; do
mise use -g "$tool"
done
fi
# Activate mise shims so runtimes (e.g. python3) are available for app installers
eval "$(mise activate bash)"
export PATH="$HOME/.local/share/mise/shims:$PATH"
typeset -a MISE_APPS=(
"fzf@latest"
"zoxide@latest"
"ripgrep@latest"
"delta@latest"
)
if [[ "$DOTS_ENV" != "codespaces" ]]; then
MISE_APPS+=(
"poetry@2.3.2"
"gh@2.86.0"
"terraform@1.14.4"
"firebase@15.5.1"
"fastfetch@latest"
)
fi
log_info "Installing apps..."
mise install "${MISE_APPS[@]}"
for tool in "${MISE_APPS[@]}"; do
mise use -g "$tool"
done
if [[ "$DOTS_ENV" != "codespaces" ]]; then
# Setup Poetry ZSH completions (XDG compliant)
COMPLETIONS_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/completions"
mkdir -p "$COMPLETIONS_DIR"
if [ ! -f "$COMPLETIONS_DIR/_poetry" ]; then
mise exec -- poetry completions zsh > "$COMPLETIONS_DIR/_poetry"
fi
fi
# Verify installations
log_info "Verifying installations..."
if [[ "$DOTS_ENV" != "codespaces" ]]; then
mise exec -- python --version
mise exec -- poetry --version
echo "node $(mise exec -- node --version)"
echo "npm $(mise exec -- npm --version)"
mise exec -- gh --version
mise exec -- terraform --version | head -1
echo "firebase: $(mise exec -- firebase --version)"
echo "fastfetch: $(mise exec -- fastfetch --version 2>&1 | head -1)"
fi
fzf --version
zoxide --version
rg --version | head -1
delta --version | head -1
log_pass "mise tools installed"

60
install.d/41-docker.sh Executable file
View File

@@ -0,0 +1,60 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS) Install Docker.
# (Linux) Setup Docker.
#
# skip if SKIP_DOCKER_CONFIG is set
[[ -n "$SKIP_DOCKER_CONFIG" ]] && { log_skip "SKIP_DOCKER_CONFIG is set"; return 0; }
# skip if in WSL
if [[ -n "$WSL_DISTRO_NAME" ]]; then
log_skip "Running in WSL"
return 0
fi
# skip if in Codespaces
[[ "$DOTS_ENV" == "codespaces" ]] && { log_skip "Codespaces"; return 0; }
# skip on macOS
[[ "$DOTS_OS" == "macos" ]] && { log_skip "macOS"; return 0; }
if ! command -v docker &> /dev/null; then
case "$DOTS_PKG" in
apt)
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
;;
pacman)
sudo pacman -S --noconfirm --needed docker docker-buildx docker-compose
;;
*)
log_warn "Skipping Docker install: no supported package manager found"
;;
esac
fi
readonly docker_group="docker"
if ! grep -q "$docker_group" /etc/group; then
log_info "Adding docker group"
sudo groupadd "$docker_group"
fi
if ! groups "$USER" | grep -q "\b$docker_group\b"; then
log_info "Adding user to docker group"
sudo usermod -aG docker "$USER"
fi
docker --version
log_pass "Docker configured"

30
install.d/42-azure.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Install Azure CLI.
#
# Skip in Codespaces (project-specific tool)
[[ "$DOTS_ENV" == "codespaces" ]] && { log_skip "Codespaces"; return 0; }
if ! command -v az &>/dev/null; then
case "$DOTS_PKG" in
apt)
# https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
;;
pacman)
sudo pacman -S --noconfirm azure-cli &>/dev/null
;;
brew)
brew install azure-cli
;;
*)
log_warn "Skipping Azure CLI install: no supported package manager found"
;;
esac
fi
az --version
log_pass "Azure CLI installed"

35
install.d/50-redis.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Install Redis.
#
# Skip in Codespaces (project-specific tool)
[[ "$DOTS_ENV" == "codespaces" ]] && { log_skip "Codespaces"; return 0; }
if ! command -v redis-cli &>/dev/null; then
case "$DOTS_PKG" in
apt)
redis_keyring_path="/usr/share/keyrings/redis-archive-keyring.gpg"
if [[ ! -f "$redis_keyring_path" ]]; then
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o "$redis_keyring_path"
fi
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" \
| sudo tee /etc/apt/sources.list.d/redis.list > /dev/null
sudo apt-get install -qq redis
;;
pacman)
sudo pacman -S --noconfirm redis
;;
brew)
brew install redis
;;
*)
log_warn "Skipping Redis install: no supported package manager found"
;;
esac
fi
redis-cli --version
log_pass "Redis installed"

14
install.d/60-iterm2.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS only) Install iTerm2.
#
# macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_skip "Not macOS"; return 0; }
if ! echo "$BREW_CASKS" | grep -q "^iterm2$"; then
brew install --cask iterm2
fi
log_pass "iTerm2 installed"

35
install.d/61-nerdfont.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS only) Install nerdfonts.
#
# macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_skip "Not macOS"; return 0; }
fonts_list=(
font-fira-mono-nerd-font
font-fira-code-nerd-font
)
# Check if any fonts are missing
fonts_missing=false
for font in "${fonts_list[@]}"; do
if ! echo "$BREW_CASKS" | grep -q "^$font$"; then
fonts_missing=true
break
fi
done
if [[ "$fonts_missing" == "true" ]]; then
brew tap homebrew/cask-fonts
for font in "${fonts_list[@]}"; do
if ! echo "$BREW_CASKS" | grep -q "^$font$"; then
brew install --cask "$font"
fi
done
fi
unset fonts_list fonts_missing
log_pass "Nerd Fonts installed"

16
install.d/70-cca.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS only) Install Colour Contrast Analyser (CCA).
#
# macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_skip "Not macOS"; return 0; }
if ! echo "$BREW_CASKS" | grep -q "^colour-contrast-analyser$"; then
brew install --cask colour-contrast-analyser
else
echo "Colour Contrast Analyser (CCA) is already installed."
fi
log_pass "CCA installed"

16
install.d/71-rectangle.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS only) Install Rectangle.
#
# macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_skip "Not macOS"; return 0; }
if ! echo "$BREW_CASKS" | grep -q "^rectangle$"; then
brew install --cask rectangle
else
echo "Rectangle is already installed."
fi
log_pass "Rectangle installed"

16
install.d/72-meetingbar.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS only) Install MeetingBar.
#
# macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_skip "Not macOS"; return 0; }
if ! echo "$BREW_CASKS" | grep -q "^meetingbar$"; then
brew install --cask meetingbar
else
echo "MeetingBar is already installed."
fi
log_pass "MeetingBar installed"

16
install.d/73-betterdisplay.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS only) Install BetterDisplay.
#
# macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_skip "Not macOS"; return 0; }
if ! echo "$BREW_CASKS" | grep -q "^betterdisplay$"; then
brew install --cask betterdisplay
else
echo "BetterDisplay is already installed."
fi
log_pass "BetterDisplay installed"

16
install.d/74-dockutil.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS only) Install dockutil.
#
# macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_skip "Not macOS"; return 0; }
if ! echo "$BREW_FORMULAE" | grep -q "^dockutil$"; then
brew install dockutil
else
echo "dockutil is already installed."
fi
log_pass "dockutil installed"

27
install.d/81-cmatrix.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Install cmatrix.
#
# skip if in Codespaces
[[ "$DOTS_ENV" == "codespaces" ]] && { log_skip "Codespaces"; return 0; }
if ! command -v cmatrix &> /dev/null; then
case "$DOTS_PKG" in
apt)
sudo apt-get install -qq cmatrix &>/dev/null
;;
pacman)
sudo pacman -S --noconfirm cmatrix &>/dev/null
;;
brew)
brew install cmatrix
;;
*)
log_warn "Skipping cmatrix install: no supported package manager found"
;;
esac
fi
log_pass "cmatrix installed"

181
install.d/90-macos.sh Executable file
View File

@@ -0,0 +1,181 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS only) Configure defaults
#
# macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_skip "Not macOS"; return 0; }
# Keyboard
# --------
# off -- Keyboard: Capitalize words automatically
defaults write -globalDomain NSAutomaticCapitalizationEnabled -bool false
# off -- Keyboard: Add period with double-space
defaults write -globalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
# off -- Keyboard: Quote substitution
defaults write -globalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
# off -- Keyboard: Dash substitution
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# off -- Keyboard: Auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
defaults write NSGlobalDomain WebAutomaticSpellingCorrectionEnabled -bool false
# Appearance
# ----------
# Graphite -- Appearance (prevent top-left window colours)
defaults write -globalDomain AppleAquaColorVariant -int 6
# on -- Appearance: Dark mode
defaults write -globalDomain AppleInterfaceStyle -string "Dark"
# #2CB494 -- Highlight color
defaults write -globalDomain AppleHighlightColor -string "0.172549 0.705882 0.580392"
# Control Center
# --------------
# off -- Control Center: Show Bluetooth icon in menu bar
defaults write \
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
Bluetooth \
-int 24
# off -- Control Center: Show Wi-Fi icon in menu bar
defaults write \
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
WiFi \
-int 24
# off -- Control Center: Show Now Playing icon in menu bar
defaults write \
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
NowPlaying \
-int 24
# off -- Control Center: Show Battery icon in menu bar
defaults write \
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
Battery \
-int 24
# Finder
# ------
# on -- Finder: Add quit option
defaults write com.apple.finder QuitMenuItem -bool true
# on -- Finder: Show hidden files
defaults write com.apple.finder AppleShowAllFiles -bool true
# on -- Finder: Show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# off -- Finder: Show warning before changing an extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# on -- Finder: Show path bar
defaults write com.apple.finder ShowPathbar -bool true
# on -- Finder: Show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# on -- Finder: Keep folders on top
defaults write com.apple.finder _FXSortFoldersFirst -bool true
# off -- Finder: Use macOS Crash Reporter
defaults write com.apple.CrashReporter DialogType -string "none"
# off -- Finder: Enable dashboard widgets
defaults write com.apple.dashboard mcx-disabled -bool true
# on -- Finder: Show hard drives on desktop
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
# on -- Finder: Show external hard drives on desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
# on -- Finder: Show removable media on desktop
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
# on -- Finder: Show mounted servers on desktop
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
# off -- Finder: Show recent tags
defaults write com.apple.finder ShowRecentTags -bool false
# off -- Finder: Create .DS_Store files
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# home -- Finder: New Finder windows show
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
# list -- Finder: Preferred view style
defaults write com.apple.finder FXPreferredViewStyle -string "nlsv"
# Spotlight
# ---------
# on -- Spotlight: Hide menu bar icon
defaults write com.apple.Spotlight MenuItemHidden -int 1
# Dock
# ----
# off -- Dock: Show recent applications
defaults write com.apple.dock show-recents -bool false
# on -- Dock: Use scroll gestures
defaults write com.apple.dock scroll-to-open -bool true
# Remove default apps from the dock
default_apps=(
"Messages"
"Mail"
"Maps"
"Photos"
"FaceTime"
"Calendar"
"Contacts"
"Reminders"
"Freeform"
"TV"
"Music"
"News"
"Keynote"
"Numbers"
"Pages"
)
for default_app in "${default_apps[@]}"; do
dockutil --remove "$default_app" --no-restart 1>/dev/null 2>&1 || true
done
# Set up apps in the dock
dock_order=(
"/System/Library/CoreServices/Finder.app" # Cannot be moved
"/System/Applications/App Store.app"
"/System/Applications/Apps.app"
"/System/Applications/System Settings.app"
"/System/Applications/Utilities/Activity Monitor.app"
"/Applications/iTerm.app"
)
dock_state=$(defaults read com.apple.dock persistent-apps 2>/dev/null || echo "")
for i in "${!dock_order[@]}"; do
if [[ $i -ne 0 ]]; then
path="${dock_order[$i]}"
name=$(basename "$path" | sed 's/\.app$//')
if [[ $dock_state == *"$name"* ]]; then
dockutil --move "${path}" --position "$i" --no-restart 2>/dev/null || true
else
dockutil --add "${path}" --position "$i" --no-restart 2>/dev/null || true
fi
fi
done
if [[ ! $dock_state == *"spacer"* ]]; then
dockutil --add '' --type spacer --section apps --position "${#dock_order[@]}" --no-restart 2>/dev/null || true
fi
log_info "Restart Finder/Dock to apply: osascript -e 'quit app \"Finder\"'"
log_pass "macOS defaults configured"

12
install.d/99-fastfetch.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Display system information with fastfetch.
#
# Skip in Codespaces (cosmetic only)
[[ "$DOTS_ENV" == "codespaces" ]] && { log_skip "Codespaces"; return 0; }
fastfetch --pipe false