️ perf(_blank): error handling enabled, more efficient

This commit is contained in:
Eshan Roy
2024-11-20 01:16:34 +05:30
parent 70218eb538
commit 7f47b2a36e

View File

@@ -4,35 +4,50 @@
# Author : Eshan Roy <eshan@snigdhaos.or> # Author : Eshan Roy <eshan@snigdhaos.or>
# Author URL : https://eshanized.github.io/ # Author URL : https://eshanized.github.io/
echo # Function to log messages
echo "--->> Start snigdhaos-fixes <<---" log_message() {
echo echo "[INFO] $1"
}
# Get the current desktop environment # Function to log error messages
log_error() {
echo "[ERROR] $1" >&2
}
log_message "--->> Start snigdhaos-fixes <<---"
# Get the current desktop environment by listing sessions
desktop=$(ls /usr/share/xsessions/) desktop=$(ls /usr/share/xsessions/)
# Define a function to install and enable SDDM # Define a function to install and enable SDDM
install_sddm() { install_sddm() {
echo "INSTALLED: LightDM/GDM [STATUS: ACTIVE]" # Check if SDDM is already installed
pacman -S sddm --noconfirm --needed if ! pacman -Qq sddm > /dev/null; then
systemctl enable sddm.service -f log_message "Installing SDDM..."
pacman -S sddm --noconfirm --needed
else
log_message "SDDM is already installed."
fi
log_message "Enabling SDDM service..."
systemctl enable sddm.service --force
} }
# Check for specific desktop environments and install SDDM if necessary # Check for specific desktop environments and install SDDM if necessary
case $desktop in case $desktop in
ukui.desktop|deepin.desktop) ukui.desktop|deepin.desktop)
echo "Found : Lightm [STATUS: ACTIVE]" log_message "Found: UKUI or Deepin Desktop Environment [STATUS: ACTIVE]"
install_sddm install_sddm
;; ;;
*) *)
# Check for other desktop environments # Check for GNOME or other environments that need SDDM
if [ -f /usr/bin/gnome-session ] || [ -f /usr/bin/startdde ] || [ -f /usr/bin/ukui-session ]; then if [ -f /usr/bin/gnome-session ] || [ -f /usr/bin/startdde ] || [ -f /usr/bin/ukui-session ]; then
log_message "Found: GNOME or UKUI Session [STATUS: ACTIVE]"
install_sddm install_sddm
else else
echo "Nothing To Do!!!" log_message "No specific desktop environment found, nothing to do."
fi fi
;;
esac esac
echo log_message "--->> End snigdhaos-fixes <<---"
echo "--->> End snigdhaos-fixes <<---"
echo