From 7f47b2a36ee1cb0a401df463736bf989bb7a5936 Mon Sep 17 00:00:00 2001 From: Eshan Roy Date: Wed, 20 Nov 2024 01:16:34 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20perf(=5Fblank):=20error=20?= =?UTF-8?q?handling=20enabled,=20more=20efficient?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/local/bin/snigdhaos-fixes | 41 ++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/usr/local/bin/snigdhaos-fixes b/usr/local/bin/snigdhaos-fixes index 7faf23f..ff55281 100755 --- a/usr/local/bin/snigdhaos-fixes +++ b/usr/local/bin/snigdhaos-fixes @@ -4,35 +4,50 @@ # Author : Eshan Roy # Author URL : https://eshanized.github.io/ -echo -echo "--->> Start snigdhaos-fixes <<---" -echo +# Function to log messages +log_message() { + 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/) # 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 if SDDM is already installed + if ! pacman -Qq sddm > /dev/null; then + 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 case $desktop in ukui.desktop|deepin.desktop) - echo "Found : Lightm [STATUS: ACTIVE]" + log_message "Found: UKUI or Deepin Desktop Environment [STATUS: ACTIVE]" 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 + log_message "Found: GNOME or UKUI Session [STATUS: ACTIVE]" install_sddm else - echo "Nothing To Do!!!" + log_message "No specific desktop environment found, nothing to do." fi + ;; esac -echo -echo "--->> End snigdhaos-fixes <<---" -echo \ No newline at end of file +log_message "--->> End snigdhaos-fixes <<---"