#! /bin/bash
#--------------------------------------------------------------------------------------------------------
# Name: Xfce Desktop Icons
# Add/Remove Desktop icons in Xfce
# Architecture: all
# Author: Jerry Bezencon
# Website: https://www.linuxliteos.com
#--------------------------------------------------------------------------------------------------------

# Set variables
desktoppath="/usr/share/xfldesktop/"
ic="/usr/share/pixmaps/xfldesktop.png"		# Xfce Desktop icon variable

desktopicons=$(yad --borders=20 --window-icon="$ic" --list --title "Desktop Icons" --text "\nSelect the Desktop Icon/s you wish to enable or disable\n" --checklist --width="420" --height="490" \
--column "Select" --column " " --column "Desktop Icon" \
FALSE " " " This PC - Enable" \
FALSE " " " User Files - Enable" \
FALSE " " " Network - Enable" \
FALSE " " " Control Panel - Enable" \
FALSE " " " Recycle Bin - Enable" \
FALSE " " " This PC - Disable" \
FALSE " " " User Files - Disable" \
FALSE " " " Network - Disable" \
FALSE " " " Control Panel - Disable" \
FALSE " " " Recycle Bin - Disable" \
--separator=",");

# Enable Desktop Icon/s

echo $desktopicons | grep "This PC - Enable" > /dev/null
if [ $? = 0 ];then
    cp $desktoppath/computer.desktop /home/$USER/Desktop 2>/dev/null
fi

echo $desktopicons | grep "User Files - Enable" > /dev/null
if [ $? = 0 ];then
    cp $desktoppath/userfiles.desktop /home/$USER/Desktop 2>/dev/null
fi

echo $desktopicons | grep "Network - Enable" > /dev/null
if [ $? = 0 ];then
    cp $desktoppath/network.desktop /home/$USER/Desktop 2>/dev/null
fi

echo $desktopicons | grep "Control Panel - Enable" > /dev/null
if [ $? = 0 ];then
    cp $desktoppath/settings.desktop /home/$USER/Desktop 2>/dev/null
fi

echo $desktopicons | grep "Recycle Bin - Enable" > /dev/null
if [ $? = 0 ];then
    cp $desktoppath/recyclebin.desktop /home/$USER/Desktop 2>/dev/null
fi

# Disable Desktop Icon/s

echo $desktopicons | grep "This PC - Disable" > /dev/null
if [ $? = 0 ];then
    rm /home/$USER/Desktop/computer.desktop 2>/dev/null
fi

echo $desktopicons | grep "User Files - Disable" > /dev/null
if [ $? = 0 ];then
    rm /home/$USER/Desktop/userfiles.desktop 2>/dev/null
fi

echo $desktopicons | grep "Network - Disable" > /dev/null
if [ $? = 0 ];then
    rm /home/$USER/Desktop/network.desktop 2>/dev/null
fi

echo $desktopicons | grep "Control Panel - Disable" > /dev/null
if [ $? = 0 ];then
    rm /home/$USER/Desktop/settings.desktop 2>/dev/null
fi

echo $desktopicons | grep "Recycle Bin - Disable" > /dev/null
if [ $? = 0 ];then
    rm /home/$USER/Desktop/recyclebin.desktop 2>/dev/null
fi

exit 0
