#!/bin/bash
#--------------------------------------------
# Description: Linux Lite Sounds Dialogue
# Disable Logout Sound
# Authors: Jerry Bezencon
# Website: https://www.linuxliteos.com
#--------------------------------------------
# Variables
APPNAME="Lite Sounds - Disable Logout Sound"
ic="/usr/share/icons/Papirus/24x24/apps/litesoundsglob.png" # dialog icon 24x24 PNG
EALUSER=$(whoami)
TMPF="/tmp/autologin"
if [ ! -f "$TMPF" ]; then echo "$EALUSER" > "$TMPF"; chmod 600 "$TMPF"; else :; fi
if [ $EUID -ne 0 ]; then pkexec $0; if [ "${PIPESTATUS[@]}" -eq "126" ]; then rm -f "$TMPF"; fi; exit; else :; fi
# Main window dialogue.
zenity --question --icon-name="info" --window-icon="$ic" --ok-label="Disable Logout Sound" --cancel-label="Cancel" --width="400" --height="60" --title="$APPNAME" \
--text='You are about to Disable the Logout Sound\n\
Click Disable Logout Sound to continue or Cancel to exit.' 2>/dev/null
if [ "$?" -eq "0" ]; then
mv /usr/local/bin/xfce4-session /usr/local/bin/xfce4-session.disabled
if [ "${PIPESTATUS[0]}" -eq "0" ]; then
zenity --info --width="280" --timeout=5 --height=40 --title=" $APPNAME" --window-icon=$ic --text="\nLogout Sound has been disabled." 2>/dev/null
exit 0
else
zenity --info --width="300" --height="40" --title="$APPNAME" --text="\nThe Logout Sound may already be disabled." 2>/dev/null
continue
fi
else
exit 0
fi
done
exit 0