fixes/after.sh
2026-09-30 03:31:13 +03:00

132 lines
No EOL
4 KiB
Bash

#!/bin/bash
set -e
read -rp "Enter your username: " USERNAME
if ! id "$USERNAME" &>/dev/null; then
echo "Error: user '$USERNAME' does not exist."
exit 1
fi
USER_HOME="/home/$USERNAME"
echo "Using user: $USERNAME"
echo
# ─────────────────────────────────────
# Misc
# ─────────────────────────────────────
# PACMAN LOVES CANDY
grep -qxF 'ILoveCandy' /etc/pacman.conf || \
sed -i '/^# Misc options/a ILoveCandy' /etc/pacman.conf
# DISABLE KWALLETD
mkdir -p "$USER_HOME/.config"
cat > "$USER_HOME/.config/kwalletrc" <<'EOF'
[Wallet]
Enabled=false
EOF
# ENABLE DOLPHIN STORAGE INFO
kwriteconfig6 \
--file "$USER_HOME/.config/dolphinrc" \
--group General \
--key ShowStatusBar \
FullWidth
# ─────────────────────────────────────
# Install yay
# ─────────────────────────────────────
echo "Installing yay..."
pacman -S --needed --noconfirm git base-devel
su - "$USERNAME" <<'EOF'
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si --noconfirm
yay -S --needed --noconfirm --removemake zsh-theme-powerlevel10k ttf-meslo-nerd coolercontrol-bin mangojuice heroic-games-launcher-bin polymc-qt5-bin open-video-downloader-bin brave-bin onlyoffice-bin
EOF
# ─────────────────────────────────────
# ZSH
# ─────────────────────────────────────
echo "Configuring Zsh..."
chsh -s /bin/zsh "$USERNAME"
cat > "$USER_HOME/.zshrc" <<'EOF'
# ─────────────────────────────────────
# Powerlevel10k
# ─────────────────────────────────────
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
# ─────────────────────────────────────
# Plugins
# ─────────────────────────────────────
# Autosuggestions
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
# Syntax highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# ─────────────────────────────────────
# Powerlevel10k configuration
# ─────────────────────────────────────
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# ─────────────────────────────────────
# Completion
# ─────────────────────────────────────
autoload -Uz compinit
compinit
setopt CORRECT
setopt AUTO_CD
zstyle ':completion:*' completer _complete _approximate
zstyle ':completion:*' menu select
# ─────────────────────────────────────
# History
# ─────────────────────────────────────
HISTFILE="$HOME/.zsh_history"
SAVEHIST=10000
setopt APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
EOF
# Make everything we created belong to the user
chown -R "$USERNAME:$USERNAME" "$USER_HOME"
# ─────────────────────────────────────
# Backups
# ─────────────────────────────────────
echo "Configuring Snapper and GRUB..."
systemctl enable grub-btrfsd
snapper -c root create-config /
grub-mkconfig -o /boot/grub/grub.cfg
echo "Done."