#!/bin/bash
#install components
echo "Installing required Packages"
sudo pacman -S --noconfirm alacritty alsa-utils atftp base base-devel bash-language-server btop btrfs-progs bluez clang curl dolphin dunst ffmpeg fastfetch firefox flatpak fzf gcc git gnu-netcat greetd-tuigreet grim grub gst-plugin-pipewire htop hyfetch imagemagick inetutils iwd jq kitty ldns libpulse linux linux-firmware lua-language-server micro nano networkmanager nmap openssh pulsemixer pipewire nerd-fonts otf-font-awesome pipewire pipewire-alsa pipewire-jack pipewire-pulse polkit-kde-agent qt5-wayland qt6-wayland slurp smartmontools swww traceroute ttf-jetbrains-mono ufw unzip vim waybar wget wireless_tools wireplumber wireshark-qt wofi wpa_supplicant wl-clipboard qt6ct xdg-desktop-portal-hyprland xdg-utils xf86-video-amdgpu xf86-video-ati xf86-video-nouveau xf86-video-vmware xorg-server xorg-xinit yazi zip zram-generator z zsh nm-connection-editor qrencode neovim vnstat hyprland podman distrobox docker

#aur/yay setup
echo "Installing yay"
cd ~
mkdir install-tmp
cd install-tmp
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
yay --version
cd ~/install-tmp

#networkmanager setup
echo "enabling NetworkManager"
sudo systemctl enable NetworkManager.service

rustup default stable

#AUR list
echo "Installing AUR packages"
yay -Syu --answerdiff None --answerclean All hyprland-workspaces bluetuith tio fast-ssh uftpd nwg-dock-hyprland

#eww compilation
echo "compiling EWW"
cd ~/install-tmp
git clone https://github.com/elkowar/eww
cd eww
cargo build --release --no-default-features --features=wayland
cd target/release
chmod +x ./eww
sudo cp ./eww /usr/bin

#vim plug installer
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs     https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

#desktop env dotfiles
echo "Installing Desktop enviroment configs"
rm -rf ~/.config/*
ln -s ~/Dotfiles/desktopenvs/hyprland/eww/ ~/.config/
ln -s ~/Dotfiles/desktopenvs/hyprland/kitty/ ~/.config/
ln -s ~/Dotfiles/desktopenvs/hyprland/hypr/ ~/.config/
ln -s ~/Dotfiles/desktopenvs/hyprland/wofi/ ~/.config/
ln -s ~/Dotfiles/desktopenvs/hyprland/dunst/ ~/.config/
ln -s ~/Dotfiles/desktopenvs/hyprland/alacritty ~/.config/
ln -s ~/Dotfiles/desktopenvs/hyprland/nwg-dock-hyprland ~/.config/
ln -s ~/Dotfiles/desktopenvs/hyprland/btop ~/.config/
#ln -s ~/Dotfiles/desktopenvs/hyprland/gtk/* ~/.config 

# svg for fflogo
cp ~/Dotfiles/resources/fflogo.svg ~/Pictures/fflogo.svg

cp ~/Dotfiles/desktopenvs/hyprland/hypr-usr/* ~/.config
cp ~/Dotfiles/nvim/cyberqueer.vim ~/.local/share/nvim/site/plugged/vim-airline-themes/autoload/airline/themes/
# Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash

# in lieu of restarting the shell
\. "$HOME/.nvm/nvm.sh"

# Download and install Node.js:
nvm install 22

# Verify the Node.js version:
node -v # Should print "v22.14.0".
nvm current # Should print "v22.14.0".

# Verify npm version:
npm -v # Should print "10.9.2".

#ohmyzsh plugins
echo "Installing oh my zsh plugins"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

#greetd setup
echo "Installing greetd"
sudo cp -f ~/Dotfiles/desktopenvs/hyprland/greetd-tuigreet/config.toml /etc/greetd/config.toml
sudo systemctl enable greetd.service


#cli dotfiles
echo "Installing bash and zsh setting files"
rm ~/.bashrc
rm ~/.zshrc
ln -s ~/Dotfiles/.bashrc ~/.bashrc
ln -s ~/Dotfiles/.zshrc ~/.zshrc

ln -s ~/Dotfiles/starship.toml ~/.config/
ln -s ~/Dotfiles/micro/ ~/.config/
ln -s ~/Dotfiles/nvim/ ~/.config/
ln -s ~/Dotfiles/yazi/ ~/.config/
ln -s ~/Dotfiles/spotify-tui/config.yml ~/.config/spotify-tui/


sudo cp -r .config /etc/skel/
sudo cp -r ~/Dotfiles/gtk-themes/cyberqueer /usr/share/themes
sudo cp ~/Dotfiles/desktopenvs/hyprland/btop/themes/cyberqueer.theme /usr/share/btop/themes

cd ~/install-tmp
mkdir ~/.icons
wget https://github.com/guillaumeboehm/Nordzy-cursors/releases/download/v2.3.0/Nordzy-cursors-lefthand.tar.gz
tar -zxvf Nordzy-cursors-lefthand.tar.gz -C $HOME/.icons/
#tar -zxvf Nordzy-cursors-white.tar.gz -C $HOME/.icons/

echo '
    #zsh setup
    echo "Setting up zsh"
    chsh -s /usr/bin/zsh
    #homectl update --shell=/usr/bin/zsh

    #starship setup
    echo "Installing Starship"
    curl -sS https://starship.rs/install.sh | sh

    #zsh setup
    echo "Setting up zsh"
    chsh -s /usr/bin/zsh
    #homectl update --shell=/usr/bin/zsh

    #ohmyzsh setup
    echo "Installing oh my zsh"
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

    #ohmyzsh plugins
    echo "Installing oh my zsh plugins"
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
' | zsh 

