How to quickly change a standard KDE menu logo for Gentoo (or any other distribution) logo.
Many distributions like for example Kubuntu offers their own menu logos, but my Gentoo is using by default, standrad oxygen icon. After few months of using KDE 4 on my computer I got terribly tired of this bit ugly standard icon. I searched the Internet and found realy nicly looking Gentoo Linux SVG Icon which would be perfect for menu icon.
Replacing the old icons would require me to copy the new one over the old ones way to many times. What was even worst if I will be using default oxygen icon theme which comes with KDE, I may loose my changes with every new KDE compilation, and then I need to copy it again. I may also decide to use localy installed icon theme, but still I would like to have easy way to put my beloved Gentoo logo as menu icon.
I solved this problem the Linux way. I spend few minutes to wrote a simple script, which will do the job for me.
ICON=gentoo-start-icon.svg RESOLUTION=(16x16 22x22 32x32 48x48 64x64 128x128 256x256) URL="http://gentoo-art.org/CONTENT/content-files/117383-gentoo-start-icon.svg" WGET=/usr/bin/wget MV=/bin/mv CP=/bin/cp RM=/bin/rm if [ "${1}" = "global" ]; then PATH="/usr/share/icons/" elif [ "${1}" = "local" ]; then PATH=`echo ~/.kde4/share/icons/` else echo echo "Usage ./kde-icon.sh local | global [theme_name] [restore]" echo echo "Examples:" echo "If you want to change the icons just run:" echo "./kde-icon.sh local OxygenRefit2-black-version" echo echo "If you want to restore old icons run:" echo "./kde-icon.sh local OxygenRefit2-black-version restore" echo exit 1 fi if [ "${#}" -eq 1 ]; then echo "You didn't provide a theme_name I'm assuming we are changing the oxygen default icon theme" echo THEME="oxygen" else THEME=${2} fi echo "Checking if full theme path: ${PATH}${THEME} exists" echo if [ -d ${PATH}${THEME} ]; then echo "Path seems ok" echo else echo "Can not find the provided path check script parameters" echo exit 1 fi echo "Checking if you have write access to theme path" echo if [ -w ${PATH}${THEME} ]; then echo "Your rights seems ok" echo else echo "You do not have write access to the theme path you will not be able to change the icons" echo "Maybe you should run the script as root" echo exit 1 fi if [ "${3}" == "restore" ] ; then echo "You requested restoration of previously stored icons" echo echo "Checking if stored copies of old icons are available and performing restore if possible" for i in "${RESOLUTION[@]}"; do echo processing ${PATH}${THEME}/$i/places/start-here-kde.png if [ -w ${PATH}${THEME}/$i/places/start-here-kde.png.bak ]; then if [ -w ${PATH}${THEME}/$i/places/start-here-kde.svg ]; then echo "Removing svg icon: ${PATH}${THEME}/$i/places/start-here-kde.svg" ${RM} ${PATH}${THEME}/$i/places/start-here-kde.svg echo fi echo "Restoring old icons" ${MV} -f ${PATH}${THEME}/$i/places/start-here-kde.png.bak ${PATH}/${THEME}/$i/places/start-here-kde.png echo else echo "Can't find ${PATH}${THEME}/$i/places/start-here-kde.png.bak or you do not have write access to file" echo fi done echo "Finished" echo "To see the changes you need to change the icon set using KDE system settings" echo else echo "Downloading the logo icon" echo ${WGET} --output-document=${ICON} ${URL} || die "downloading of the icon failed" echo "Making backup of existing icons" echo for i in "${RESOLUTION[@]}"; do echo processing ${PATH}${THEME}/$i/places/start-here-kde.png if [ -w ${PATH}${THEME}/$i/places/start-here-kde.png ]; then if (${MV} -f ${PATH}${THEME}/$i/places/start-here-kde.png ${PATH}/${THEME}/$i/places/start-here-kde.png.bak) then echo "Storing ${PATH}${THEME}/$i/places/start-here-kde.png as ${PATH}/${THEME}/$i/places/start-here-kde.png.bak succsesfull" echo else echo "There was error while storing icon ${PATH}${THEME}/$i/places/start-here-kde.png" fi else echo "Icon ${PATH}${THEME}/$i/places/start-here-kde.png dosn't exist or you don't have the write access to it!" echo "I have nothing to do here" echo fi done echo echo "Placing new Icon" echo for i in "${RESOLUTION[@]}"; do echo processing ${PATH}${THEME}/$i/places/start-here-kde.svg if (${CP} ${ICON} ${PATH}${THEME}/$i/places/start-here-kde.svg) then echo "Placing icon ${PATH}${THEME}/$i/places/start-here-kde.svg succsesfull" echo else echo "There was error while placing icon ${PATH}${THEME}/$i/places/start-here-kde.svg" echo fi done echo "I'm Removing the downloaded icon" ${RM} -f ${ICON} echo echo "That's all!" echo "To see the changes you need to change the icon set using KDE system settings" echo fi
I know that this script could be much shorter but I like to know what is going on, thats why I added so many echo commands.
The script will:
The script is accepting 3 parameters:
Of course make sure you make this script executable before using it:
chmod +x kde-icon.sh
Example of usage:
./kde-icon.sh global
./kde-icon.sh local OxygenRefit2-black-version
./kde-icon.sh local OxygenRefit2-black-version restore
The script will report errors if any operation will not be successful.
Exept of running the script you have to also lunch KDE system settings and reset the icon theme in there, without it you will not see the changes. You can consult following screen shot.
And to prove it's working here is my menu before:
And here is after:
Script is also availble on my svn server, you can access it by following this link.
If you have found something wrong with the information provided above or maybe you just want to speak your mind about it, feel free to leave a comment.
All comments will show up on page after being approved. Sorry for such policy but I want to make sure that my site will be free of abusive or vulgar content. I don't mind being criticized just do it using right words.
Processing a comment.