Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old May 14th, 2005   #1
Sam
Dark Roasted Ubuntu
 
Sam's Avatar
 
Join Date: Feb 2005
Location: Geneva, Switzerland
Beans: 1,048
Ubuntu 9.10 Karmic Koala
Send a message via ICQ to Sam
Wink SCRIPT: Take back the Firefox & Thunderbird logo

This script is for Hoary or Breezy only !!!
To use it with Dapper please follow this thread !



This script is based from the HOWTO: Take back the Firefox Logo from Sionide.
Also thanks to Commuto, rune and Speque for their help with Dapper.


I wrote this script because the Firefox icon is replaced with the horrible blue globe everytime Firefox is updated.
I also added the possibility to replace the Thunderbird icon and its profile manager.



You have the choice to replace the Firefox program icon, the Firefox document icon , the Thunderbird program icon and/or the Thunderbird profile manager icon.
  • Tested with Firefox 1.0.6-0ubuntu0.1 and Thunderbird 1.0.6-0ubuntu05.04.
  • Works in Breezy too (Firefox 1.5 and Thunderbird 1.5).
  • For Dapper (Ubuntu 6.06), please see this thread !

Here we go:
  • Create a new script:
    Code:
    $ sudo gedit /usr/local/bin/restore_mozilla_icons
  • Paste the following lines:
    Code:
    #! /bin/sh
    
    #
    # Restore the original Firefox and/or Thunderbird icons.
    #
    
    FIREFOX_LIB="/usr/lib/mozilla-firefox/"
    FIREFOX_BIN="/usr/bin/mozilla-firefox"
    THUNDERBIRD_BIN="/usr/bin/mozilla-thunderbird"
    
    ICON_PACK_URL="http://ubuntu.globalvision.ch/mozilla_icons.tar.bz2"
    ICON_PACK_FILENAME="mozilla_icons.tar.bz2"
    TMP_DIR="/tmp/moz-icons"$$"/"
    
    
    #Ctrl-C trapping
    trap ctrlc INT
    ctrlc()
    {
    	echo -e "\nAborted by user."
    	rm -rf $TMP_DIR
    	exit 2
    }
    
    
    #Check if run as root
    if [ "$UID" -ne 0 ] ; then
    	echo "You must be root to do that!"
    	exit 1
    fi
    
    
    #Ask which icons to replace
    replace_ff="0"
    replace_ff_doc="0"
    replace_tb="0"
    replace_tb_pm="0"
    
    if [ -x "$FIREFOX_BIN" ] ; then
    	#Firefox
    	echo -n "Replace the Mozilla Firefox program icon (y/n)? [y] "
    	read input
    	if [ -z "$input" ] || [ "$input" == "y" ] || [ "$input" == "yes" ] || [ "$input" == "Y" ] || [ "$input" == "YES" ] ; then
    		replace_ff="1"
    	fi
    
    	#Firefox document
    	echo -n "Replace the Mozilla Firefox document icon (y/n)? [y] "
    	read input
    	if [ -z "$input" ] || [ "$input" == "y" ] || [ "$input" == "yes" ] || [ "$input" == "Y" ] || [ "$input" == "YES" ] ; then
    		replace_ff_doc="1"
    	fi
    fi
    
    if [ -x "$THUNDERBIRD_BIN" ] ; then
    	#Thunderbird
    	echo -n "Replace the Mozilla Thunderbird program icon (y/n)? [y] "
    	read input
    	if [ -z "$input" ] || [ "$input" == "y" ] || [ "$input" == "yes" ] || [ "$input" == "Y" ] || [ "$input" == "YES" ] ; then
    		replace_tb="1"
    	fi
    
    	#Thunderbird profile manager
    	echo -n "Replace the Mozilla Thunderbird profile manager icon (y/n)? [y] "
    	read input
    	if [ -z "$input" ] || [ "$input" == "y" ] || [ "$input" == "yes" ] || [ "$input" == "Y" ] || [ "$input" == "YES" ] ; then
    		replace_tb_pm="1"
    	fi
    fi
    
    if [ "$replace_ff" -eq "0" ] && [ "$replace_ff_doc" -eq "0" ] && [ "$replace_tb" -eq "0" ] && [ "$replace_tb_pm" -eq "0" ] ; then
    	echo "Nothing to do here."
    	exit 0
    fi
    
    
    #Ask for divert the original packaged files to alternate locations
    divert="0"
    
    echo -e "\nDo you want to divert the original packaged files to alternate locations"
    echo -n "(make the changes permanent) (y/n)? [y] "
    read input
    if [ -z "$input" ] || [ "$input" == "y" ] || [ "$input" == "yes" ] || [ "$input" == "Y" ] || [ "$input" == "YES" ] ; then
    	divert="1"
    fi
    
    
    #Downloading
    echo -en "\nDownloading and replacing icons. Please wait..."
    
    mkdir $TMP_DIR
    wget $ICON_PACK_URL -O $TMP_DIR$ICON_PACK_FILENAME >/dev/null 2>&1
    if [ ! -f $TMP_DIR$ICON_PACK_FILENAME ] ; then
    	echo -e "\nCannot download icons. Please check your internet connection."
    	rm -rf $TMP_DIR
    	exit 1
    fi
    tar xjf $TMP_DIR$ICON_PACK_FILENAME -C $TMP_DIR
    
    
    #Replace Firefox icon
    if [ "$replace_ff" -gt "0" ] ; then
    	if [ ! -f $TMP_DIR"mozilla-firefox.png" ] || [ ! -f $TMP_DIR"mozilla-firefox.xpm" ] ; then
    		echo "Cannot continue (unavailable Firefox icon file)"
    		rm -rf $TMP_DIR
    		exit 1
    	fi
    
    	#Backup
    	cp -f /usr/share/pixmaps/mozilla-firefox.png /usr/share/pixmaps/mozilla-firefox.old.png
    	cp -f /usr/share/pixmaps/mozilla-firefox.xpm /usr/share/pixmaps/mozilla-firefox.old.xpm
    	cp -f $FIREFOX_LIB"icons/default.xpm" $FIREFOX_LIB"icons/default.old.xpm"
    	cp -f $FIREFOX_LIB"chrome/icons/default/default.xpm" $FIREFOX_LIB"chrome/icons/default/default.old.xpm"
    
    	#Divert
    	if [ "$divert" -gt "0" ] ; then
    		dpkg-divert --rename /usr/share/pixmaps/mozilla-firefox.png >/dev/null
    		dpkg-divert --rename /usr/share/pixmaps/mozilla-firefox.xpm >/dev/null
    		dpkg-divert --rename $FIREFOX_LIB"icons/default.xpm" >/dev/null
    		dpkg-divert --rename $FIREFOX_LIB"chrome/icons/default/default.xpm" >/dev/null
    	fi
    
    	#Replace icons
    	cp $TMP_DIR"mozilla-firefox.png" /usr/share/pixmaps/mozilla-firefox.png
    	cp $TMP_DIR"mozilla-firefox.xpm" /usr/share/pixmaps/mozilla-firefox.xpm
    	cp $TMP_DIR"mozilla-firefox.xpm" $FIREFOX_LIB"icons/default.xpm"
    	cp $TMP_DIR"mozilla-firefox.xpm" $FIREFOX_LIB"chrome/icons/default/default.xpm"
    	echo -n "."
    fi
    
    
    #Replace Firefox document icon
    if [ "$replace_ff_doc" -gt "0" ] ; then
    	if [ ! -f $TMP_DIR"mozilla-firefox-doc.png" ] ; then
    		echo "Cannot continue (unavailable Firefox document icon file)"
    		rm -rf $TMP_DIR
    		exit 1
    	fi
    
    	#Backup
    	cp -f $FIREFOX_LIB"icons/document.png" $FIREFOX_LIB"icons/document.old.png"
    
    	#Divert
    	if [ "$divert" -gt "0" ] ; then
    		dpkg-divert --rename $FIREFOX_LIB"icons/document.png" >/dev/null
    	fi
    
    	#Replace icons
    	cp $TMP_DIR"mozilla-firefox-doc.png" $FIREFOX_LIB"icons/document.png"
    	echo -n "."
    fi
    
    
    #Replace Thunderbird icon
    if [ "$replace_tb" -gt "0" ] ; then
    	if [ ! -f $TMP_DIR"mozilla-thunderbird.xpm" ] ; then
    		echo "Cannot continue (unavailable Thunderbird icon file)"
    		rm -rf $TMP_DIR
    		exit 1
    	fi
    
    	#Backup
    	cp -f /usr/share/pixmaps/mozilla-thunderbird.xpm /usr/share/pixmaps/mozilla-thunderbird.old.xpm
    	cp -f /usr/share/pixmaps/mozilla-thunderbird-menu.xpm /usr/share/pixmaps/mozilla-thunderbird-menu.old.xpm
    	cp -f /usr/lib/mozilla-thunderbird/chrome/icons/default/mozilla-thunderbird.xpm /usr/lib/mozilla-thunderbird/chrome/icons/default/mozilla-thunderbird.old.xpm
    	cp -f /usr/lib/mozilla-thunderbird/chrome/icons/default/messengerWindow16.xpm /usr/lib/mozilla-thunderbird/chrome/icons/default/messengerWindow16.old.xpm
    	cp -f /usr/lib/mozilla-thunderbird/chrome/icons/default/messengerWindow.xpm /usr/lib/mozilla-thunderbird/chrome/icons/default/messengerWindow.old.xpm
    
    	#Divert
    	if [ "$divert" -gt "0" ] ; then
    		dpkg-divert --rename /usr/share/pixmaps/mozilla-thunderbird.xpm >/dev/null
    		dpkg-divert --rename /usr/share/pixmaps/mozilla-thunderbird-menu.xpm >/dev/null
    		dpkg-divert --rename /usr/lib/mozilla-thunderbird/chrome/icons/default/mozilla-thunderbird.xpm >/dev/null
    		dpkg-divert --rename /usr/lib/mozilla-thunderbird/chrome/icons/default/messengerWindow16.xpm >/dev/null
    		dpkg-divert --rename /usr/lib/mozilla-thunderbird/chrome/icons/default/messengerWindow.xpm >/dev/null
    	fi
    
    	#Replace icons
    	cp $TMP_DIR"mozilla-thunderbird.xpm" /usr/share/pixmaps/mozilla-thunderbird.xpm
    	cp $TMP_DIR"mozilla-thunderbird.xpm" /usr/share/pixmaps/mozilla-thunderbird-menu.xpm
    	cp $TMP_DIR"mozilla-thunderbird.xpm" /usr/lib/mozilla-thunderbird/chrome/icons/default/mozilla-thunderbird.xpm
    	cp $TMP_DIR"mozilla-thunderbird.xpm" /usr/lib/mozilla-thunderbird/chrome/icons/default/messengerWindow16.xpm
    	cp $TMP_DIR"mozilla-thunderbird.xpm" /usr/lib/mozilla-thunderbird/chrome/icons/default/messengerWindow.xpm
    	echo -n "."
    fi
    
    
    #Replace Thunderbird profile manager icon
    if [ "$replace_tb_pm" -gt "0" ] ; then
    	if [ ! -f $TMP_DIR"mozilla-thunderbird.xpm" ] ; then
    		echo "Cannot continue (unavailable Thunderbird icon file)"
    		rm -rf $TMP_DIR
    		exit 1
    	fi
    
    	#Backup
    	cp -f /usr/share/pixmaps/mozilla-thunderbird-pm-menu.xpm /usr/share/pixmaps/mozilla-thunderbird-pm-menu.old.xpm
    	cp -f /usr/lib/mozilla-thunderbird/chrome/icons/default/default.xpm /usr/lib/mozilla-thunderbird/chrome/icons/default/default.old.xpm
    
    	#Divert
    	if [ "$divert" -gt "0" ] ; then
    		dpkg-divert --rename /usr/share/pixmaps/mozilla-thunderbird-pm-menu.xpm >/dev/null
    		dpkg-divert --rename /usr/lib/mozilla-thunderbird/chrome/icons/default/default.xpm >/dev/null
    	fi
    
    	#Replace icons
    	cp $TMP_DIR"mozilla-thunderbird.xpm" /usr/share/pixmaps/mozilla-thunderbird-pm-menu.xpm
    	cp $TMP_DIR"mozilla-thunderbird.xpm" /usr/lib/mozilla-thunderbird/chrome/icons/default/default.xpm
    	echo -n "."
    fi
    
    
    echo " done !"
    
    
    #Reload gnome-panel
    echo -en "\nShall I reload gnome-panel to apply the changes (y/n)? [y] "
    read input
    if [ -z "$input" ] || [ "$input" == "y" ] || [ "$input" == "yes" ] || [ "$input" == "Y" ] || [ "$input" == "YES" ] ; then
    	killall gnome-panel
    fi
    
    
    rm -rf $TMP_DIR
    exit 0
  • Allow execution:
    Code:
    $ sudo chmod +x /usr/local/bin/restore_mozilla_icons
  • Run the script:
    Code:
    $ sudo restore_mozilla_icons
  • Your icons are back !

Last edited by Sam; August 10th, 2006 at 01:59 AM..
Sam is offline   Reply With Quote
Old May 14th, 2005   #2
spd106
Chocolate Ubuntu Mocha Blend
 
spd106's Avatar
 
Join Date: Mar 2005
Location: York, UK
Beans: 1,813
Re: SCRIPT: Take back the Firefox logo

Hi

Great script!!!

Worked like a charm
spd106 is offline   Reply With Quote
Old May 14th, 2005   #3
Heliode
A Carafe of Ubuntu
 
Heliode's Avatar
 
Join Date: Mar 2005
Beans: 143
Re: SCRIPT: Take back the Firefox logo

I can confirm this also works with the backport of Firefox 1.0.3. Good job.
__________________
"Windows is something to overcome"

Howto's by me:
Tweak firefox! (URL now works..)
Backup/Restore your system!
Avoid having to reboot


Compentux.org
, the Linux Tip & Howto gathering initiative!
Heliode is offline   Reply With Quote
Old May 14th, 2005   #4
RastaMahata
Quad Shot of Ubuntu
 
RastaMahata's Avatar
 
Join Date: Dec 2004
Location: Santiago, Chile
Beans: 427
Ubuntu Breezy 5.10
Send a message via MSN to RastaMahata
Re: SCRIPT: Take back the Firefox logo

if it's not much asking... I would add two things:
1. Ability to not change the document icon
2. Change the thunderbird icons
RastaMahata is offline   Reply With Quote
Old May 14th, 2005   #5
Sam
Dark Roasted Ubuntu
 
Sam's Avatar
 
Join Date: Feb 2005
Location: Geneva, Switzerland
Beans: 1,048
Ubuntu 9.10 Karmic Koala
Send a message via ICQ to Sam
Re: SCRIPT: Take back the Firefox logo

Quote:
Originally Posted by RastaMahata
if it's not much asking... I would add two things:
1. Ability to not change the document icon
2. Change the thunderbird icons
Ok, I'll do this tomorrow !
Sam is offline   Reply With Quote
Old May 14th, 2005   #6
Paul Atreides
First Cup of Ubuntu
 
Join Date: Apr 2005
Beans: 4
Lightbulb Re: SCRIPT: Take back the Firefox logo

After applying the script, you can also type :

Code:
killall gnome-panel
no need to logging out/logging in...
This little additional tip permits to regenerate the panel icons...

Paul
Paul Atreides is offline   Reply With Quote
Old May 14th, 2005   #7
Nu-Buntu
A Carafe of Ubuntu
 
Nu-Buntu's Avatar
 
Join Date: Apr 2005
Location: Colorado
Beans: 91
Ubuntu 7.04 Feisty Fawn
Re: SCRIPT: Take back the Firefox logo

Thanks for the script. Works like a champ.
Nu-Buntu is offline   Reply With Quote
Old May 14th, 2005   #8
harryc
A Carafe of Ubuntu
 
harryc's Avatar
 
Join Date: Jan 2005
Beans: 137
Re: SCRIPT: Take back the Firefox logo

Nice! Thanks!
harryc is offline   Reply With Quote
Old May 14th, 2005   #9
bored2k
Skinny Extra Sweet Ubuntu
 
bored2k's Avatar
 
Join Date: Feb 2005
My beans are hidden!
Re: SCRIPT: Take back the Firefox logo

Cute script
__________________
Sylvia: Look at what you've done to him!
Christof: I have given Truman the chance to lead a normal life. The world, the place you live in, is the sick place.
bored2k is offline   Reply With Quote
Old May 14th, 2005   #10
Ricapar
Just Give Me the Beans!
 
Ricapar's Avatar
 
Join Date: Jan 2005
Location: Old Bridge, New Jersey
Beans: 68
Send a message via AIM to Ricapar
Re: SCRIPT: Take back the Firefox logo

Very helpfull. I did it the manual way from the original topic, but explaining it to friends who aren't too good at following directions isn't easy.
__________________
http://ricapar.ath.cx:89/
Ricapar is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:57 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry