09-18-2014, 03:36 PM
Valtam, is there a way to trick zenity to use space instead of "_"?
Code:
#! /bin/bash
#--------------------------------------------------------------------------------------------------------
# Name: Linux Lite Cleaner
# Description: A GUI tool to easily clean your Linux Lite system.
# Authors: Misko_2083, Jerry Bezencon
# Date: September 16th, 2014
# Website: https://www.freecinema2022.gq
#--------------------------------------------------------------------------------------------------------
APTCACHESIZE=$(du -sh /var/cache/apt/archives/ | awk '{print $1}')
TRASHCACHESIZE=$(du -sh $HOME/.local/share/Trash/ | awk '{print $1}')
THUMBCACHESIZE=$(du -sh $HOME/.thumbnails/ | awk '{print $1}')
#icon
ic="/usr/share/pixmaps/litecleaner.png"
# workaround for zenity trying to execute FALSE as a command
false=$(printf "FALSE")
# Testing if firefox is installed
if [ `builtin type -p firefox` ];then
FFCACHESIZE=$(du -sh "$HOME/.cache/mozilla/"| awk '{print $1}')
firefox=$(echo -e $falseĀ "Clean_Firefox" Internet Safe You_can_currently_remove-$FFCACHESIZE-from_your_Firefox_cache )
else
firefox=$(echo ) # Hide Firefox from the list
fi
# Testing if google-chrome is installed
if [ `builtin type -p google-chrome` ]; then
GCCACHESIZE=$(du -sh $HOME/.cache/google-chrome/ | awk '{print $1}' )
chrome=$(echo $false "Clean_Chrome" "Internet" "Safe" "You_can_currently_remove-$GCCACHESIZE-from_your_Chrome_cache" )
else
chrome=$(echo ) # Hide Google Chrome from the list
fi
# Testing if chromium is installed
if [ `builtin type -p chromium-browser` ]; then
CHRCACHESIZE=$(du -sh $HOME/.cache/chromium/ | awk '{print $1}')
chromium=$(echo $false "Clean_Chromium" "Internet" "Safe" "You_can_currently_remove-$CHRCACHESIZE-from_your_Chromium_cache" )
else
chromium=$(echo ) # Hide chromium-browser from the list
fi
selection=$(zenity --window-icon="$ic" --list --checklist --width=780 --height=420 --column="Select" --column="Name" --column="Category" --column="Status" \
--column="Description" --text='Select the task you wish to perform, then click the Begin button. Sort Categories by clicking on the column.\n\nThere are 2 levels of <b>Status</b>:\n<span foreground="green">Safe</span> - Safe to perform, no harm can be done.\n<span foreground="red">Caution</span> - Proceed with caution, read the warning on the proceeding step.\n\nYou can select multiple tasks to perform (password required for some tasks).' --title="Lite Cleaner" --ok-label="Begin" --cancel-label="Quit" \
TRUE "Clean package cache" "Packages" "Safe" "You can currently remove $APTCACHESIZE worth of files from your apt cache" \
FALSE "Autoremove packages" "Packages" "Safe" "Remove packages installed for programs that are no longer present" \
$firefox \
$chrome \
$chromium \
FALSE "Clear thumbnail cache" "Images" "Safe" "You can currently remove $THUMBCACHESIZE from your thumbnail cache" \
FALSE "Empty your Trash Bin" "Home" "Safe" "You can currently remove $TRASHCACHESIZE from your Trash bin" \
FALSE "Locate large files" "System" "Caution" "Find files on your system larger than 50MB" )
# [Future feature, DO NOT enable] FALSE "Remove old kernels" "System" "Caution" "Remove kernels you no longer wish to boot from" )
# Exec scripts
echo $selection | grep "Clean package cache" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/aptgetclean 2>/dev/null
fi
echo $selection | grep "Autoremove packages" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/autoremovepkg 2>/dev/null
fi
echo $selection | grep "Clean_Firefox" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/firefox 2>/dev/null
fi
echo $selection | grep "Clean_Chrome" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/chrome 2>/dev/null
fi
echo $selection | grep "Clean_Chromium" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/chromium 2>/dev/null
fi
echo $selection | grep "Clear thumbnail cache" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/thumbnails 2>/dev/null
fi
echo $selection | grep "Empty your Trash Bin" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/emptytrash 2>/dev/null
fi
echo $selection | grep "Locate large files" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/files50 2>/dev/null
fi
# [Future feature, DO NOT enable]
# echo $selection | grep "Remove old kernels" > /dev/null
# if [ $? = 0 ];then
# /usr/scripts/clean/remkernels 2>/dev/null
# fi