#!/bin/bash
# - bof - #



<<'comment'

sudo pacman -S curl --noconfirm --needed;
bash <(curl -s https://www.education.isdevelopment.us/Arch.Ins/04-Arch_Xfce-FinalConfiguration.sh)



# :A
# -  - #
# - Arch Xfce final configuration script - #

# - Method   # 1 - #
bash <(curl -s https://www.education.isdevelopment.us/Arch.Ins/04-Arch_Xfce-FinalConfiguration.sh)

# - Method   # 2 - #
cd ~/;
xfC_=Arch_Xfce-FinalConfiguration.sh;
curl -o ~/$xfC_ "https://www.education.isdevelopment.us/Arch.Ins/04-"$xfC_
chmod +x ~/$xfC_; ~/./$xfC_;
nvim ~/$xfC_;

# - Method   # 3 - #
cd ~/; rm -rf ~/Arch_Xfce-FinalConfiguration.sh; nvim ~/Arch_Xfce-FinalConfiguration.sh;
copy & paste this content
chmod +x ~/Arch_Xfce-FinalConfiguration.sh; ~/./Arch_Xfce-FinalConfiguration.sh;



# - Configured - #

# -  - #
# - Vim commands - #
https://vim.rtorr.com/

rm -rf ~/.bashrc;
nvim ~/.bashrc;

rm -rf ~/.zshrc;
nvim ~/.zshrc;

ssh-keygen -R 192.168.1.1

# - On client - #
cd ~/.ssh;
ssh-keygen -t rsa;

cat ~/.ssh/id_rsa.pub;

# - On server - #
nvim ~/.ssh/authorized_keys;

sudo apt install curl git htop inxi net-tools ntp neovim screenfetch tree -y;
sudo pacman -S curl git htop inxi net-tools ntp neovim screenfetch tree --noconfirm --needed;
comment



# -  - #
# - Global variables - #

# -  - #
# - Overwrite checkComputer - #
 overwriteCc_="No";
#overwriteCc_="Yes";

Plank_='No';
Plank_='Yes';

Desktop_=1;      # 1.Xfce 2.Cinnamon 3.Kde-Plasma 4.Gnome 5.Deepin 6.Budgie 7.OpenBox 8.XMonad 9.NoDesktop



# -  - #
# - Greetings_ - #
function Greetings_(){
  Header_;
  echo -e "\n  Warning: This script is going to install the Xfce final configuration"
  echo -e "\nImportant: This procedure will take a few minutes.";
  echo -e "\nProcedure: Open terminal & paste next command:\n";

cat <<"EOF"
  bash <(curl -s https://www.education.isdevelopment.us/Arch.Ins/04-Arch_Xfce-FinalConfiguration.sh)
EOF

  echo -e "\n\n";

  while true; do
    read -p "Do you want to start the installation now? (Yy/Nn): " yn
    case $yn in
        [Yy]* )
          echo -e "\n\n\nInstallation starting...\n\n"
          break;;
        [Nn]* )
          rm -rf ~/Arch_Xfce-FinalConfiguration.sh;
          exit;
          break;;
        * ) echo "Please answer (y)es or (n)o.";;
    esac
done
}



# -  - #
# - Header_ - #
function Header_(){
  clear;
  echo "";
  figlet -f small "Xfce Desktop" | lolcat;
  figlet -f small "Final Configuration" | lolcat;
  echo -e "\nby Djalmar Enrique Rayo (2025) - GNU General Public License (GPL)";
  echo "----------------------- Light version: $lightVersion_ -----------------------";
}



# -  - #
# - WhiskerMenu_ - #
function WhiskerMenu_(){
  local whiskermenuF_=~/.config/xfce4/panel/whiskermenu-1.rc \
        favorites_='favorites=org.manjaro.pamac.manager.desktop,org.gnome.FileRoller.desktop,org.bleachbit.BleachBit.desktop,org.gnome.Calculator.desktop,org.gnome.DiskUtility.desktop,simple-scan.desktop,org.kde.dolphin.desktop,org.kde.filelight.desktop,filezilla.desktop,firefox.desktop,gparted.desktop,org.kde.kpat.desktop,libreoffice-calc.desktop,libreoffice-writer.desktop,lightdm-gtk-greeter-settings.desktop,pinta.desktop,system-config-printer.desktop,xfce-settings-manager.desktop,org.kde.spectacle.desktop,org.gnome.gedit.desktop,thunar.desktop,com.gexperts.Tilix.desktop,transmission-gtk.desktop';
  echo -e "\nConfiguring whisker menu...";
  sed -i '1 i '$favorites_ $whiskermenuF_;
  sed -i '2 d' $whiskermenuF_;
  echo -e "\nWhisker menu was configured successfully...\n\n\n";
  sleep 5;
}



# -  - #
# - PlankThemes_ - #
function PlankThemes_(){
  local PlankThemes=/Arch.Ins/Software.Ins/PlankThemes.zip \
        sThe_=/usr/share/plank/themes \
        ;
  echo -e "\nDownloading plank themes...\n";
  cd ~/Downloads;
  curl -O $uWServer_$PlankThemes;
  unzip PlankThemes.zip;

  echo "Copying plank themes...";
  sudo rm -rf $sThe_;
  sudo mkdir -p $sThe_;

  sudo mv ~/Downloads/plank/themes/* $sThe_;
  rm -rf ~/Downloads/plank*;
  rm -rf ~/Downloads/PlankThemes.*;
  cd $Dir_;

  echo -e "\nPlank themes were configured successfully...\n\n\n";
  sleep 5;
}



# -  - #
# - dotConfig_Xfce_ - #
function dotConfig_Xfce_(){
  local sPhase_=$1;
  local sUsr_=($USER) \
        aUsr_='is_derayo' \
        wF_=/Arch.Ins/Software.Ins/ \
        sFd_=Xfce_DesktopConfigurationFiles.tar.bz2;
  local sPlk_=/home/$sUsr_/.config/plank/dock1/launchers/;
  local sDsk_=$sPlk_"Disk-1.dockitem" \
        sDoc_=$sPlk_"Documents.dockitem" \
        sSys_=$sPlk_"System-1.dockitem";
  local sJson_=/home/$sUsr_/.config/yay/config.json;

  echo -e "\nDownloading configuration files...\n";

  cd ~/Downloads;
  if [ "$sPhase_" == "1" ]; then
    curl -O $uWServer_$wF_$sFd_; fi;

  echo -e "\nApplying configuration files...\n";
  rm -rf ~/.config;
  sleep 2;
  rm -rf ~/.config;

  tar -xvf $sFd_ -C ~/ --wildcards *.config;

<<'comment'
  tar -xvf $dotConf_Xfce_Downloads -C ~/Downloads --wildcards \
            *libreoffice --wildcards *BraveSoftware;
comment

  if [ "$sPhase_" == "2" ]; then
    rm -rf $sFd_; fi;

  if [ "$sUsr_" != "is_derayo" ]; then
    rm -rf $sDsk_ $sDoc_ $sSys_;

    echo -e "[PlankDockItemPreferences]" > $sDsk_;
    echo -e "Launcher=file:///home/"$sUsr_"/Desktop/Disk" >> $sDsk_;

    echo -e "[PlankDockItemPreferences]" > $sDoc_;
    echo -e "Launcher=file:///home/"$sUsr_"/Desktop/Documents" >> $sDoc_;

    echo -e "[PlankDockItemPreferences]" > $sSys_;
    echo -e "Launcher=file:///home/"$sUsr_"/Desktop/System" >> $sSys_;

    sed -i 's/'"$aUsr_"'/'"$sUsr_"'/' $sJson_;
  fi;

  cd $Dir_;
  echo -e "\nConfiguration files were applied successfully...\n\n\n";
  sleep 5;
}



# -  - #
# - XfceDesktopProgramsShortcuts_ - #
function XfceDesktopProgramsShortcuts_(){
  local wF_=/Arch.Ins/Software.Ins/ \
        sFd_=Xfce_DesktopPrograms-Shortcut.zip \
        sDt_=~/Desktop/ \
        sDoc_=~/Downloads/Documents \
        sDsk_=~/Downloads/Disk \
        sSys_=~/Downloads/System;

  echo -e "\n\nDownloading Xfce desktop programs shortcuts...";

  rm -rf $sDoc_ $sDsk_ $sSys_;

  cd ~/Downloads;
  curl -O $uWServer_$wF_$sFd_;
  unzip $sFd_;

  echo -e "\n\nCopying desktop programs shortcuts...\n";

  rm -rf $sDt_'Documents' $sDt_'Disk' $sDt_'System';

  mv $sDoc_ $sDt_;
  mv $sDsk_ $sDt_;
  mv $sSys_ $sDt_;

  rm -rf $sFd_;
  cd $Dir_;

  echo -e "\n\nXfce desktop programs shortcuts were configured successfully...\n\n\n";
  sleep 5;
}



source <(curl -s https://www.education.isdevelopment.us/Functions/Functions.sh)
lightVersion_=$( lVersion_ );



checkComputer_ Arch_Xfce-FinalConfiguration.sh;
Greetings_;
distroVersion_;
update_;

ConfiguringSystem_ 1;
echo -e "\n\nSystem configured successfully on the first phase...";
sleep 10;

ConfiguringSystem_ 2;
weztermConfiguration_;

rm -rf ~/Arch_Xfce-FinalConfiguration.sh;

echo -e "\n\nSystem configured successfully on the final phase...";
echo -e "\n\nComputer will shutdown so all changes are applied...";
sleep 10;

sudo shutdown now;
sudo reboot now;



<<'comment'
cd ~/; rm -rf ~/Arch_Xfce-FinalConfiguration.sh; nvim ~/Arch_Xfce-FinalConfiguration.sh;
copy & paste this content
chmod +x ~/Arch_Xfce-FinalConfiguration.sh; ~/./Arch_Xfce-FinalConfiguration.sh;
comment



# - eof - #