LINUX LITE 7.2 FINAL RELEASED - SEE RELEASE ANNOUNCEMENTS SECTION FOR DETAILS


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lite Tweaks - Suggestions welcomed
#71
(09-18-2014, 03:36 PM)misko_2083 link Wrote: Valtam, is there a way to trick zenity to use space instead of "_"?

I'd have to look into that, try either backticks or single quotes for now.
Reply
#72
I've made progress with this.
I had to put list items with spaces and other chars into a "variable".
I've solved that with bash arrays.
The script now shows firefox, google-chrome and chromium on the list only if their cache directories exist.
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"

# Check if firefox cache exists
if [  -d  "$HOME/.cache/mozilla/" ];then
    FFCACHESIZE=$(du -sh "$HOME/.cache/mozilla/"| awk '{print $1}')
    firefox=("FALSE"  "Clean Firefox" "Internet" "Safe" "You can currently remove $FFCACHESIZE from your Firefox cache" )
else
        firefox=( ) # If no "$HOME/.cache/mozilla/" exists don't show Firefox on the list
fi

# Check if google-chrome cache exists
if [ -d  "$HOME/.cache/google-chrome/" ]; then
    GCCACHESIZE=$(du -sh $HOME/.cache/google-chrome/ | awk '{print $1}' )
    chrome=("FALSE" "Clean Chrome" "Internet" "Safe" "You can currently remove $GCCACHESIZE from your Chrome cache" )
    else
        chrome=( )
fi

# Check if chromium cache exists
if [  -d  "$HOME/.cache/chromium/" ]; then
    CHRCACHESIZE=$(du -sh $HOME/.cache/chromium/ | awk '{print $1}')
    chromium=("FALSE" "Clean Chromium" "Internet" "Safe" "You can currently remove $CHRCACHESIZE from your Chromium cache" )
else
         chromium=( )
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
P.S. In the chromium script command doesn't remove "$HOME/.cache/chromium/" directory
Code:
rm -rf $HOME/.cache/chromium/* | zenity --progress --title="$APPNAME" --window-icon="${INSTALL_ICON}" --text="Please wait whilst Chromium is being cleaned..." --pulsate --width=400 --auto-close --auto-kill
so I guess it should be changed to this:
Code:
rm -rf $HOME/.cache/chromium/ | zenity --progress --title="$APPNAME" --window-icon="${INSTALL_ICON}" --text="Please wait whilst Chromium is being cleaned..." --pulsate --width=400 --auto-close --auto-kill
Reply
#73
(09-21-2014, 10:50 PM)misko_2083 link Wrote: P.S. In the chromium script command doesn't remove "$HOME/.cache/chromium/" directory
Code:
rm -rf $HOME/.cache/chromium/* | zenity --progress --title="$APPNAME" --window-icon="${INSTALL_ICON}" --text="Please wait whilst Chromium is being cleaned..." --pulsate --width=400 --auto-close --auto-kill
so I guess it should be changed to this:
Code:
rm -rf $HOME/.cache/chromium/ | zenity --progress --title="$APPNAME" --window-icon="${INSTALL_ICON}" --text="Please wait whilst Chromium is being cleaned..." --pulsate --width=400 --auto-close --auto-kill

What line was that on? I don't see that here.
Reply
#74
You're right. I've checked it on github. Smile I must have tried something, and forgot to change it back. Should really get more sleep. Big Grin

I've spoted this on github:
https://github.com/linuxlite/litecleaner...ean/chrome
13    This will process will purge Chrome of <b>$FFCACHESIZE</b> worth of files.
https://github.com/linuxlite/litecleaner...n/chromium
13    This will process will purge Chromium of <b>$FFCACHESIZE</b> worth of files.
https://github.com/linuxlite/litecleaner...emptytrash
13    This will process will empty your Trash bin.
https://github.com/linuxlite/litecleaner...an/firefox
13    This will process will purge Firefox of <b>$FFCACHESIZE</b> worth of files.


Reply
#75
I've got to update github sometime today Smile
Reply
#76
Before you update, I wanted to add these two things. Smile
If the trash is empty and if there are no thumbnails they will not show up in the cleaner.

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}')

#icon
ic="/usr/share/pixmaps/litecleaner.png"

# Check if firefox cache exists
if [  -d  "$HOME/.cache/mozilla/" ];then
    FFCACHESIZE=$(du -sh "$HOME/.cache/mozilla/"| awk '{print $1}')
    firefox=("FALSE"  "Clean Firefox" "Internet" "Safe" "You can currently remove $FFCACHESIZE from your Firefox cache" )
else
        firefox=( )
fi

# Check if google-chrome cache exists
if [ -d  "$HOME/.cache/google-chrome/" ]; then
    GCCACHESIZE=$(du -sh $HOME/.cache/google-chrome/ | awk '{print $1}' )
    chrome=("FALSE" "Clean Chrome" "Internet" "Safe" "You can currently remove $GCCACHESIZE from your Chrome cache" )
    else
        chrome=( )
fi

# Check if chromium cache exists
if [  -d  "$HOME/.cache/chromium/" ]; then
    CHRCACHESIZE=$(du -sh $HOME/.cache/chromium/ | awk '{print $1}')
    chromium=("FALSE" "Clean Chromium" "Internet" "Safe" "You can currently remove $CHRCACHESIZE from your Chromium cache" )
else
         chromium=( )
fi

# Check if thumbnails exist
if [  "$(ls -A $HOME/.thumbnails/)" ]; then
        THUMBCACHESIZE=$(du -sh $HOME/.thumbnails/ | awk '{print $1}')
    thumbn=("FALSE" "Clear thumbnail cache" "Images" "Safe" "You can currently remove $THUMBCACHESIZE from your thumbnail cache" )
else
        thumbn=( )
fi

# Check if trash is empty
if [  "$(ls -A $HOME/.local/share/Trash/files/)" ]; then
        TRASHCACHESIZE=$(du -sh $HOME/.local/share/Trash/ | awk '{print $1}')
    trash=("FALSE" "Empty your Trash Bin" "Home" "Safe" "You can currently remove $TRASHCACHESIZE from your Trash bin" )
else
        trash=( )
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[@]}" \
"${thumbn[@]}" \
"${trash[@]}" \
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
Reply
#77
Very nice contribution there misko, github and Install Updates have been updated Smile
Reply
#78
I've finished the Old Kernel Cleaner. Smile
What text should I use for the dialog?
[Image: cRfNniU.png]
Reply
#79
This will remove kernels you no longer wish to use.

Be sure to select both the header and the image for each version of
the kernel that you wish to remove.

When you click on Yes....
Reply
#80
Is this OK?
[Image: VWwx9pO.png]
Reply


Forum Jump:


Users browsing this thread: 17 Guest(s)