# - bof - #
#!/bin/bash



clear;



<<'comment'
cd ~/; rm -rf ~/Arch_DesktopsInstall.sh; nvim ~/Arch_DesktopsInstall.sh;
Copy & paste all this content
chmod +x ~/Arch_DesktopsInstall.sh; ~/./Arch_DesktopsInstall.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



# -  - #
# - 1.Xfce 2.Cinnamon 3.Kde-Plasma 4.Gnome 5.Deepin(NoGood) 6.Budgie 7.OpenBox 8.XMonad 9.NoDesktop 10.Pantheon 11.Cosmic - #
 Desktop_=1;      # Xfce
#Desktop_=4;      # Gnome
#Desktop_=9;      # NoDesktop
#Desktop_=11;     # Cosmic

 PulseAudio_='No';
#PulseAudio_='Yes';
 if [ "$Desktop_" == "9" ]; then
    PulseAudio_='No'; fi;

 PipeWire_='Yes';
#PipeWire_='No';
 if [ "$Desktop_" == "9" ]; then
    PipeWire_='No'; fi;

 if [ "$PipeWire_" == "Yes" ]; then
    PulseAudio_='No'; fi;



# -  - #
# - update_ - #
function update_(){
  echo "";
  echo 'Updating system...';
  sudo pacman -Syu --noconfirm && sudo pacman -Syyuu --noconfirm;        
  echo "System has been updated...";
  sleep 10;
}



function session_(){
  local sF_=~/t_session.txt \
        sS1_=$1 sS2_='' \
        sS3_='' sS4_='';
  ls /usr/bin/*-session > $sF_;
  sS2_=$( echo $(cat $sF_));

  # -  - #
  # - Lowercase - #
  sS3_=${sS1_,,};

  sS4_=$(echo "$sS2_" | grep -oF "$sS3_" );
  sS5_=$(echo $sS4_ | awk '{print $1;}');
  rm -rf $sF_;
  if [ "$sS3_" == "$sS5_" ]; then echo $sS1_; else echo ""; fi;
}



# -  - #
# - xfce_ - #
function xfce_(){
  local sS1_="xfce4";
  local sS2_=$(echo $(session_ $sS1_)) \
        msg_0="Installing "$sS1_" desktop..." \
        msg_1=$sS1_" desktop already installed...";
  echo "";
  if [ "$sS1_" == "$sS2_" ]; then echo $msg_1; return; fi;
  lightdm_;
  echo $msg_0;
  echo "";
  sudo pacman -S xfce4 xfce4-goodies xfce4-terminal --noconfirm --needed;
  echo "exec startxfce4" > ~/.xinitrc;
  echo "";
  read -t 3 -p $sS1_" desktop was installed...";
  echo "";
  sleep 10;
}



# -  - #
# - cinnamon_ - #
function cinnamon_(){
  local sS1_="cinnamon";
  local sS2_=$(echo $(session_ $sS1_)) \
        msg_0="Installing "$sS1_" desktop..." \
        msg_1=$sS1_" desktop already installed...";
  echo "";
  if [ "$sS1_" == "$sS2_" ]; then echo $msg_1; return; fi;
  lightdm_;
  echo $msg_0;
  echo "";
  sudo pacman -S cinnamon gnome-terminal gnome-system-monitor nemo-fileroller --noconfirm --needed;

  echo "";
  read -t 3 -p $sS1_" desktop was installed...";
  echo "";
  sleep 10;
}



# -  - #
# - kde_ - #
function kde_(){
  local sS1_="kde";
  local sS2_=$(echo $(session_ $sS1_)) \
        msg_0="Installing "$sS1_" desktop..." \
        msg_1=$sS1_" desktop already installed...";
  echo "";
  if [ "$sS1_" == "$sS2_" ]; then echo $msg_1; return; fi;
  sddm_;
  echo $msg_0;
  echo "";
  sudo pacman -S plasma kde-applications konsole --noconfirm --needed;
  read -t 3 -p $sS1_" desktop was installed...";
  echo "";
  sleep 10;
}



# -  - #
# - gnome_ - #
function gnome_(){
  local sS1_="gnome";
  local sS2_=$(echo $(session_ $sS1_)) \
        msg_0="Installing "$sS1_" desktop..." \
        msg_1=$sS1_" desktop already installed...";
  echo "";
  if [ "$sS1_" == "$sS2_" ]; then echo $msg_1; return; fi;
  gdm_;
  echo $msg_0;
  echo "";
  sudo pacman -S gnome gnome-shell gnome-backgrounds gnome-control-center gnome-extra \
                 gnome-terminal gnome-tweaks nautilus adwaita-icon-theme --noconfirm --needed;
  sudo pacman -S gnome-browser-connector gnome-menus --noconfirm --needed;
  read -t 3 -p $sS1_" desktop was installed...";
  echo "";
  sleep 10;

<<'comment'
  # - Extensions - #
  User Themes
  blur myshell
  vytals
  arcmenu  
  # - Install - #
  gnome-browser-connector
  gnome-menus
comment
}



# -  - #
# - cosmic_ - #
function cosmic_(){
  local sS1_="cosmic";
  local sS2_=$(echo $(session_ $sS1_)) \
        msg_0="Installing "$sS1_" desktop..." \
        msg_1=$sS1_" desktop already installed...";
  echo "";
  #if [ "$sS1_" == "$sS2_" ]; then echo $msg_1; return; fi;
  gdm_;
  echo $msg_0;
  echo "";
  sudo pacman -S cosmic cosmic-files cosmic-store cosmic terminal cosmic-test-editor --noconfirm --needed;

<<'comment'
  sudo pacman -S gnome-backgrounds gnome-control-center gnome-extra \
                 gnome-terminal gnome-tweaks nautilus adwaita-icon-theme --noconfirm --needed;
  sudo pacman -S gnome-browser-connector gnome-menus --noconfirm --needed;
comment

  read -t 3 -p $sS1_" desktop was installed...";
  echo "";
  sleep 10;

<<'comment'
  # - Extensions - #
  User Themes
  blur myshell
  vytals
  arcmenu 
  # - Install - #
  sudo pacman -S gnome-browser-connector gnome-menus --noconfirm --needed;
comment
}



# -  - #
# - deepin_ - #
function deepin_(){
  local sS1_="deepin";
  local sS2_=$(echo $(session_ $sS1_)) \
        msg_0="Installing "$sS1_" desktop..." \
        msg_1=$sS1_" desktop already installed...";
  local lightdmF_=/etc/lightdm/lightdm.conf;
  echo "";
  if [ "$sS1_" == "$sS2_" ]; then echo $msg_1; return; fi;
  lightdm_;
  echo $msg_0;
  sudo pacman -S deepin deepin-kwin --noconfirm  --needed;
  sudo pacman -S deepin-extra --noconfirm --needed;
  sudo sed -i 's/# greeter-session = Session to load for greeter/greeter-session=lightdm-deepin-greeter/' $lightdmF_;

  # sudo sed -i 's/#ParallelDownloads = 5/'"$sSed_"'/' $lightdmF_;
  # sudo vim /etc/lightdm/lightdm.conf;
  # greeter-session=lightdm-deepin-greeter
  read -t 3 -p $sS1_" desktop was installed...";
  echo "";
  sleep 10;
}



# -  - #
# - budgie_ - #
function budgie_(){
  local sS1_="budgie";
  local sS2_=$(echo $(session_ $sS1_)) \
        msg_0="Installing "$sS1_" desktop..." \
        msg_1=$sS1_" desktop already installed...";
  echo "";
  if [ "$sS1_" == "$sS2_" ]; then echo $msg_1; return; fi;
  lightdm_;
  echo $msg_0;
  sudo pacman -S budgie-desktop gnome gnome-control-center i3lock --noconfirm --needed;
  read -t 3 -p $sS1_" desktop was installed...";
  echo "";
  sleep 10;
}



# -  - #
# - Pantheon_ - #
function Pantheon_(){
  local sS1_="pantheon" \
        lightdmF_=/etc/lightdm/lightdm.conf;
  local sS2_=$(echo $(session_ $sS1_)) \
        msg_0="Installing "$sS1_" desktop..." \
        msg_1=$sS1_" desktop already installed...";
  echo "";
  if [ "$sS1_" == "$sS2_" ]; then echo $msg_1; return; fi;
  lightdm_;
  echo $msg_0;
  sudo pacman -S elementary-icon-theme elementary-wallpapers inter-font lightdm-gtk-greeter \
                 lightdm-pantheon-greeter pantheon pantheon-applications-menu sound-theme-elementary switchboard \
                 wingpanel-indicator-datetime wingpanel-indicator-session --noconfirm --needed;
  sudo pacman -S dconf-editor --noconfirm --needed;

  yay -S gnome-settings-daemon-elementary --noconfirm --needed;
  yay -S pantheon-default-settings pantheon-dock-git pantheon-session-git --noconfirm --needed;
  yay -S switchboard-plug-pantheon-tweaks-git --noconfirm --needed;
  yay -S urutau-icons-git --noconfirm --needed;
  sudo sed -i 's/# greeter-session = Session to load for greeter/greeter-session=io.elementary.greeter/' $lightdmF_;
  read -t 3 -p $sS1_" desktop was installed...";
  echo "";
  sleep 10;

<<'comment'
yay -S pantheon-session-git cerbere-git gala-git wingpanel-git pantheon-applications-menu-git plank pantheon-default-settings-git pantheon-dpms-helper-git elementary-icon-theme gtk-theme-elementary-git elementary-wallpapers-git wingpanel-indicator-power-git pantheon-print-git pantheon-polkit-agent-git elementary-icon-theme-git lightdm-pantheon-greeter-git ttf-dejavu ttf-droid ttf-freefont ttf-liberation pantheon-files-git pantheon-terminal-git pantheon-code-git pantheon-calculator-git pantheon-music-git pantheon-videos-git pantheon-calendar-git wingpanel-indicator-datetime-git pantheon-screenshot pantheon-photos-git pantheon-camera-git switchboard-git
aurman -S cerbere-git contractor-git elementary-icon-theme-git elementary-wallpapers-git file-roller gala-git geary granite-git gtk-theme-elementary-git lightdm lightdm-pantheon-greeter-git networkmanager pantheon-applications-menu-git pantheon-calculator-git pantheon-calendar-git pantheon-camera-git pantheon-code pantheon-default-settings-git pantheon-dpms-helper-git pantheon-files gvfs pantheon-geoclue2-agent-git pantheon-photos-git pantheon-polkit-agent-git pantheon-print-git pantheon-screenshot-git pantheon-session-git pantheon-shortcut-overlay-git pantheon-terminal-git plank sound-theme-elementary-git switchboard-git switchboard-plug-a11y-git switchboard-plug-about-git switchboard-plug-bluetooth-git switchboard-plug-datetime-git switchboard-plug-desktop-git switchboard-plug-display-git switchboard-plug-elementary-tweaks-git switchboard-plug-applications-git switchboard-plug-keyboard-git switchboard-plug-locale-git switchboard-plug-mouse-touchpad-git switchboard-plug-network-git switchboard-plug-notifications-git switchboard-plug-parental-controls-git switchboard-plug-power-git switchboard-plug-printers-git switchboard-plug-security-privacy-git switchboard-plug-sharing-git switchboard-plug-sound-git switchboard-plug-user-accounts-git otf-raleway ttf-dejavu ttf-droid ttf-liberation ttf-opensans wingpanel-git wingpanel-indicator-ayatana-git wingpanel-indicator-bluetooth-git wingpanel-indicator-datetime-git wingpanel-indicator-keyboard-git wingpanel-indicator-network-git wingpanel-indicator-nightlight-git wingpanel-indicator-notifications-git wingpanel-indicator-power-git wingpanel-indicator-privacy-git wingpanel-indicator-session-git wingpanel-indicator-sound-git --noconfirm --needed;
comment
}



# -  - #
# - OpenBox_ - #
function OpenBox_(){
  local sS1_="OpenBox" \
        launchSh_=~/.config/launch.sh;
  local sS2_=$(echo $(session_ $sS1_)) \
        msg_0="Installing "$sS1_" desktop..." \
        msg_1=$sS1_" desktop already installed..." \
        autostartF_=~/.config/openbox/autostart \
        menuXmlHome_=~/menu.xml \
        menuXml_=~/.config/openbox/menu.xml \
        menuXml_WServer_='/Images/Programs/Linux.Img/Linux_Arch.Img/Arch_Install/TilingWindowManager/OpenBoxInstall/dot.config/openbox/menu.xml' \
        rcXmlHome_=~/rc.xml \
        rcXml_=~/.config/openbox/rc.xml \
        rcXml_WServer_='/Images/Programs/Linux.Img/Linux_Arch.Img/Arch_Install/TilingWindowManager/OpenBoxInstall/dot.config/openbox/rc.xml' \
        Dir_=($PWD);
  local bgSavedCfgHome_=~/bg-saved.cfg \
        bgSavedCfg_=~/.config/nitrogen/bg-saved.cfg \
        bgSavedCfg_WServer_='/Images/Programs/Linux.Img/Linux_Arch.Img/Arch_Install/TilingWindowManager/OpenBoxInstall/dot.config/nitrogen/bg-saved.cfg' \
        nitrogenCfgHome_=~/nitrogen.cfg \
        nitrogenCfg_=~/.config/nitrogen/nitrogen.cfg \
        nitrogenCfg_WServer_='/Images/Programs/Linux.Img/Linux_Arch.Img/Arch_Install/TilingWindowManager/OpenBoxInstall/dot.config/nitrogen/nitrogen.cfg' \
        tint2rcCfgHome_=~/tint2rc \
        tint2rcCfg_=~/.config/tint2/tint2rc \
        tint2rcCfg_WServer_='/Images/Programs/Linux.Img/Linux_Arch.Img/Arch_Install/TilingWindowManager/OpenBoxInstall/dot.config/tint2/tint2rc';

  echo "";
  if [ "$sS1_" == "$sS2_" ]; then echo $msg_1; return; fi;
  lightdm_;
  echo $msg_0;
  sudo pacman -S lxappearance-obconf menumaker nitrogen obconf openbox pcmanfm rofi tint2 \
                 ttf-font-awesome ttf-dejavu ttf-liberation volumeicon xautolock xterm --noconfirm --needed;

  # pamixer

  yay -S i3lock-color --noconfirm --needed;
  sudo pacman -S polkit-gnome --noconfirm --needed;



  mkdir -p ~/.config/nitrogen;
  mkdir -p ~/.config/openbox;
  mkdir -p ~/.config/tint2;



  echo "" >> $autostartF_;
  echo "# -  - #" >> $autostartF_;
  echo "# - Screen resolution - #" >> $autostartF_;

  if [ "$cHost_" == "iMac" ]; then
    #echo "xrandr --output Virtual-1 --mode 1920x1080 &" >> $autostartF_;
     echo "xrandr --output Virtual-1 --mode 2560x1440 &" >> $autostartF_;
  else
     echo "xrandr --output Virtual-1 --mode 2048x1152 &" >> $autostartF_;
  fi;

  echo "" >> $autostartF_;
  echo "# -  - #" >> $autostartF_;
  echo "# - Menu bar configuration - #" >> $autostartF_;
  echo "tint2 &" >> $autostartF_;
  
  echo "" >> $autostartF_;
  echo "# -  - #" >> $autostartF_;
  echo "# - Wallpaper - #" >> $autostartF_;
  echo "nitrogen --restore &" >> $autostartF_;

  echo "" >> $autostartF_;
  echo "# -  - #" >> $autostartF_;
  echo "# - Windows configuration - #" >> $autostartF_;
  echo "picom -f &" >> $autostartF_;

  echo "" >> $autostartF_;
  echo "# -  - #" >> $autostartF_;
  echo "# - Volume icon on menu bar - #" >> $autostartF_;
  echo "volumeicon &" >> $autostartF_;

  echo "" >> $autostartF_;
  echo "# -  - #" >> $autostartF_;
  echo "# - i3Lock-color configuration - #" >> $autostartF_;
  echo "xautolock -time 1 -locker "sh ~/.config/launch.sh" &" >> $autostartF_;

  echo "" >> $autostartF_;
  echo "# -  - #" >> $autostartF_;
  echo "# - Start polkit-gnome (sudo authentication) - #" >> $autostartF_;
  echo "exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &" >> $autostartF_;

  echo "" >> $autostartF_;
  echo "# -  - #" >> $autostartF_;
  echo "# - Start pamac-tray - #" >> $autostartF_;
  echo "pamac-tray &" >> $autostartF_;

  echo "" >> $autostartF_;
  echo "# -  - #" >> $autostartF_;
  echo "# - Start network applet - #" >> $autostartF_;
  echo "nm-applet &" >> $autostartF_;

  mmaker openbox -ft xterm;
  
  cd ~/;

  # -  - #
  # - Processing OpenBox configuration files - #

  # - ~/.config/openbox/menu.xml - #
  curl -O http://$uServerIP_$menuXml_WServer_;
  rm -r $menuXml_;
  mv $menuXmlHome_ $menuXml_;

  # - ~/.config/openbox/rc.xml - #
  curl -O http://$uServerIP_$rcXml_WServer_;
  rm -r $rcXml_;
  mv $rcXmlHome_ $rcXml_;

  # - ~/.config/nitrogen/bg-saved.cfg - #
  curl -O http://$uServerIP_$bgSavedCfg_WServer_;
  rm -r $bgSavedCfg_;
  mv $bgSavedCfgHome_ $bgSavedCfg_;

  # - ~/.config/nitrogen/nitrogen.cfg - #
  curl -O http://$uServerIP_$nitrogenCfg_WServer_;
  rm -r $nitrogenCfg_;
  mv $nitrogenCfgHome_ $nitrogenCfg_;

  # - ~/.config/tint2/tint2rc - #
  curl -O http://$uServerIP_$tint2rcCfg_WServer_;
  rm -r $tint2rcCfg_;
  mv $tint2rcCfgHome_ $tint2rcCfg_;

  cd $Dir_;
  echo "$sS1_ configuration is done...";



  # -  - #
  # - i3lock configure - #
  
cat <<EOT >> $launchSh_;
#!/bin/sh

# -  - #
# - i3lock configuration - #
# - vim ~/.config/launch.sh - #
# -  - #

BLANK='#00000000'
CLEAR='#ffffff22'
DEFAULT='#ff00ffcc'
TEXT='#ee00eeee'
WRONG='#880000bb'
VERIFYING='#bb00bbbb'

/usr/bin/i3lock \
--insidever-color=$CLEAR     \
--ringver-color=$VERIFYING   \
\
--insidewrong-color=$CLEAR   \
--ringwrong-color=$WRONG     \
\
--inside-color=$BLANK        \
--ring-color=$DEFAULT        \
--line-color=$BLANK          \
--separator-color=$DEFAULT   \
\
--verif-color=$TEXT          \
--wrong-color=$TEXT          \
--time-color=$TEXT           \
--date-color=$TEXT           \
--layout-color=$TEXT         \
--keyhl-color=$WRONG         \
--bshl-color=$WRONG          \
\
--screen 1                   \
--blur 5                     \
--clock                      \
--indicator                  \
--time-str="%H:%M:%S"        \
--date-str="%A, %m %Y"       \
--keylayout 1                \


EOT

  chmod +x $launchSh_;

  echo "";
  read -t 3 -p $sS1_" desktop was installed...";
  echo "";
  sleep 10;
}



# -  - #
# - XMonad_ - #
function XMonad_(){
  local sS1_="XMonad";
  local sS2_=$(echo $(session_ $sS1_)) \
        msg_0="Installing "$sS1_" desktop..." \
        msg_1=$sS1_" desktop already installed..." \
        bash_profileF_=~/.bash_profile \
        xprofileF_=~/.xprofile \
        bashrcF_=~/.bashrc \
        picomConfF_=/etc/xdg/picom.conf \
        xMonadD_=~/.xmonad \
        xinitrcF_=~/.xinitrc;
  local xMonadF_=$xMonadD_/xmonad.sh;
  echo "";
  if [ "$sS1_" == "$sS2_" ]; then echo $msg_1; return; fi;
  lightdm_;
  echo $msg_0;
  echo "";  
  yay -S i3lock-color --noconfirm --needed;
  sudo pacman -S alsa-utils cronie dmenu lxappearance nitrogen pamixer picom rofi ttf-dejavu \
                 ttf-font-awesome ttf-liberation xmobar xmonad xmonad-contrib xterm --noconfirm --needed;

  #cd ~/Downloads;
  # git clone https://github.com/Axarva/dotfiles-2.0.git;
  # cd ~/Downloads/dotfiles-2.0;

  # chmod +x install-on-arch.sh;
  # ./install-on-arch.sh;

  # sed -i '12 i export PATH="$PATH:$HOME/bin"' $bashrcF_;
  # sed -i '13 i \ ' $bashrcF_;

  # sed -i '5 i startx' $bash_profileF_;
  # sed -i '6 i \ ' $bash_profileF_;
  
  touch $xprofileF_;
  echo "# Wallpaper" >> $xprofileF_;
  echo "nitrogen --restore &" >> $xprofileF_;
  echo "" >> $xprofileF_;
  echo "# Compositor" >> $xprofileF_;
  echo "picom -f &" >> $xprofileF_;

  sudo sed -i 's/vsync = true;/# vsync = true;/' $picomConfF_;

  mkdir -p $xMonadD_;
  touch $xMonadF_;
  echo "import XMonad" >> $xMonadF_;
  echo '' >> $xMonadF_;
  echo 'main = xmonad def' >> $xMonadF_;
  echo '     { terminal = "tilix"' >> $xMonadF_;
  echo '     , modMask = mod4Mask' >> $xMonadF_;
  echo '     }' >> $xMonadF_;
  
  # - After install Ermano configuration - #
  
  
  # cd ~/;
  xmonad --recompile;
  
  sudo reboot now;

  # touch $xinitrcF_;
  # echo "exec xmonad" >> $xinitrcF_;

  read -t 3 -p $sS1_" desktop was installed...";
  echo "";
  sleep 10;
}



# -  - #
# - NoDesktop_ - #
function NoDesktop_(){
  local sS1_="NoDesktop";
  local sS2_=$(echo $(session_ $sS1_)) \
        msg_0="Installing "$sS1_" desktop..." \
        msg_1=$sS1_" desktop already installed..." \
        autostartF_=~/.config/openbox/autostart;
  echo "";
  if [ "$sS1_" == "$sS2_" ]; then echo $msg_1; return; fi;
  # lightdm_;
  echo $msg_0;
  echo "";
  #sudo pacman -S obconf lxappearance-obconf openbox tint2 ttf-dejavu ttf-liberation xterm --noconfirm --needed;
  #sudo pacman -S menumaker nitrogen volumeicon --noconfirm --needed;
  #yay -S i3lock-color --noconfirm --needed;
  read -t 3 -p $sS1_" desktop was installed...";
  echo "";
  sleep 10;
}



# -  - #
# - lightdm_ - #
function lightdm_(){
  local sS1_='lightdm' sS2_='';
  echo "";
  # - lightdm (Budgie, Cinnamon, Deepin, Mate, OpenBox, Xfce & XMonad) - #

  sS2_=$( echo $(pacman -Qqe | grep "$sS1_" ) | awk '{print $1;}');
  if [ "$sS1_" == "$sS2_" ]; then echo "lightdm already installed..."; sleep 5; return; fi;

  echo 'Installing lightdm desktop manager...';
  sudo pacman -S lightdm --noconfirm --needed;
  sudo systemctl enable lightdm;

  echo 'Installing lightdm-gtk-greeter...';
  sudo pacman -S lightdm-gtk-greeter --noconfirm --needed;

  echo 'Installing lightdm-gtk-greeter-settings...';
  sudo pacman -S lightdm-gtk-greeter-settings --noconfirm --needed;

  echo "";
  sleep 10;
}



# -  - #
# - sddm_ - #
function sddm_(){
  echo '';
  echo 'Installing sddm desktop manager...';
  # - sddm (KDE Plasma) - #
  sudo pacman -S sddm --noconfirm --needed;
  sudo systemctl enable sddm;
  sleep 10;
}



# -  - #
# - gdm_ - #
function gdm_(){
  local sD_='gdm desktop manager'
  echo "";
  echo 'Installing '$sD_'...';
  # - gdm (Gnome) - #
  sudo pacman -S gdm --noconfirm --needed;
  sudo systemctl enable gdm;
  echo "";
  echo 'gdm desktop manager was installed...';
  sleep 10;
}



# -  - #
# - AudioDrivers_ - #
function AudioDrivers_(){
  echo "";
  echo 'Installing audio drivers...';
  # -  - #
  # - Audio software - #
  if [ "$Desktop_" != "9" ]; then
     if [ "$PulseAudio_" == "Yes" ]; then
        sudo pacman -S pulseaudio pulseaudio-alsa pulseaudio-bluetooth --noconfirm --needed;
     fi;
     if [ "$PipeWire_" == "Yes" ]; then
        sudo pacman -S alsa-utils pavucontrol \
                       pipewire pipewire-alsa pipewire-jack pipewire-pulse \
                       sof-firmware wireplumber --noconfirm --needed;
     fi;
  fi;
  echo "";
  echo 'Audio drivers were installed...';
  sleep 10;
}



# -  - #
# - XorgServer_ - #
function XorgServer_(){
  echo "";
  echo 'Installing Xorg server...';
  # -  - #
  # - Xorg server software - #
  if [ "$Desktop_" != "9" ]; then
     sudo pacman -S xorg xorg-server xorg-xinit --noconfirm --needed;
  fi;
  echo "";
  echo "Xorg server sortware was installed...";
  sleep 10;
}



# -  - #
# - cleaning_ - #
function cleaning_(){
  echo '';

  echo 'Cleaning system cache...';
  sudo pacman -Scc --noconfirm;

  echo 'Removing orphan packages...';
  sudo pacman -R $(pacman -Qtdq) --noconfirm;

  echo 'Cleaning user cache...';
  sudo du -sh ~/.cache/;
  rm -rf ~/.cache/*;
  sudo rm -rf ~/.cache/*;

  echo 'Cleaning done...';
}




update_;
XorgServer_;
AudioDrivers_;

case $Desktop_ in
  ''|*[!0-9]*)
    echo '';
    echo 'Its not a number...';
    ;;
  1)
    xfce_;
    ;;
  2)
    cinnamon_;
    ;;
  3)
    kde_;
    ;;
  4)
    gnome_;
    ;;
  5)
    deepin_;
    ;;
  6)
    budgie_;
    ;;
  7)
    OpenBox_;
    ;;
  8)
    XMonad_;
    ;;
  9)
    NoDesktop_;
    ;;
  10)
    Pantheon_;
    ;;
  11)
    Cosmic_;
    ;;
    *)
    echo "Option no valid: " $Desktop_;
    ;;
esac

cleaning_;

# -  - #
# - Remove bash file - #
rm -rf ~/Arch_DesktopsInstall.sh;

echo "";
read -t 5 -p 'The system will reboot so you can login in the new Desktop installation...';
echo "";
sudo reboot now;



# - eof - #