🐞 fix(cases): simplified encapsulation and cases

This commit is contained in:
Eshan Roy
2024-08-01 04:13:56 +05:30
parent 4eb3ce590d
commit aed645c7e2

View File

@@ -8,46 +8,31 @@ echo
echo "--->> Start snigdhaos-fixes <<---" echo "--->> Start snigdhaos-fixes <<---"
echo echo
# Get the current desktop environment
desktop=$(ls /usr/share/xsessions/) desktop=$(ls /usr/share/xsessions/)
echo
# shellcheck disable=SC2086
echo "Your Current Desktop: "$desktop
echo
# Let's make some cases # Define a function to install and enable SDDM
install_sddm() {
echo "INSTALLED: LightDM/GDM [STATUS: ACTIVE]"
pacman -S sddm --noconfirm --needed
systemctl enable sddm.service -f
}
# Check for specific desktop environments and install SDDM if necessary
case $desktop in case $desktop in
ukui.desktop) ukui.desktop|deepin.desktop)
echo "Found : Lightm [STATUS: ACTIVE]" echo "Found : Lightm [STATUS: ACTIVE]"
pacman -S sddm --noconfirm --needed install_sddm
systemctl enable sddm.service -f
;;
deepin.desktop)
echo "Found : Lightm [STATUS: ACTIVE]"
pacman -S sddm --noconfirm --needed
systemctl enable sddm.service -f
;; ;;
*) *)
# Check for other desktop environments
if [ -f /usr/bin/gnome-session ] || [ -f /usr/bin/startdde ] || [ -f /usr/bin/ukui-session ]; then
install_sddm
else
echo "Nothing To Do!!!" echo "Nothing To Do!!!"
fi
esac esac
if [ -f /usr/bin/gnome-session ]; then
echo "INSTALLED: GDM [STATUS: ACTIVE]"
pacman -S sddm --noconfirm --needed
systemctl enable sddm.service -f
fi
if [ -f /usr/bin/startdde ]; then
echo "INSTALLED: LightDM [STATUS: ACTIVE]"
pacman -S sddm --noconfirm --needed
systemctl enable sddm.service -f
fi
if [ -f /usr/bin/ukui-session ]; then
echo "INSTALLED: LightDM [STATUS: ACTIVE]"
pacman -S sddm --noconfirm --needed
systemctl enable sddm.service -f
fi
echo echo
echo "--->> End snigdhaos-fixes <<---" echo "--->> End snigdhaos-fixes <<---"
echo echo