Gentoo Logo in KDE menu
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:
- download logo from internet (you can change the URL variable to pull different logo)
- check the user access rights to icons path
- beckup previous menu icons that were part of an icon set
- place the new icon in place of old ones
- restore old icons (if the user will add a resotore parameter)
The script is accepting 3 parameters:
- local | global - required to perform changes for globaly or localy installed icons
- theme_name - optional the name of the theme this should be the name of the main catalog of icon theme, if no name is specified the script will use default oxygen folder name
- replace - optional used a long side with theme_name parameter to restore previously backed up icons
Of course make sure you make this script executable before using it:
chmod +x kde-icon.sh
Example of usage:
- To change menu icon for default icon set (requires super user access rights)
./kde-icon.sh global
- To change menu icon for localy installed icon set named OxygenRefit2-black-version
./kde-icon.sh local OxygenRefit2-black-version
- To restore menu icons from previously stored backups
./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.
GNU Free Documentation License or Creative Commons Share Alike
- Posted on:
- Comment:
- 24.12.2012
- "@Alex":@Alex To tell you the truth - I no longer use KDE on any actively used computers so currently I do not have any place to test the script. As you can see this is quite an old post. From what I recall any update to oxygen Icon theme would make the default icons back, but running the script again should fix it.
- 23.12.2012
- "Alex":Hi, I was using this script for a while and its work very well, but for some reason after some updates on Gentoo ~amd64 the KDE icon back to figure on menu. I believe if the icons are not .png it back to the original. I need to make some tests. Thank you!
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.