#!/bin/sh # Merge KDE's icon with another default dir # You may want to edit function msize() manually # # You SHOULD MAKE SURE these basic icons exist # (compliants with KDE's icons) # # Desktop icons # ------------------ # filesystems/home # filesystems/network # filesystems/folder_open # devices/cdrom_mount # devices/cdwriter_mount # devices/dvd_mount # devices/usbpendrive_mount # devices/modem # devices/scanner # devices/printer # devices/camera # apps/browser # apps/ftp # apps/email # apps/p2p # apps/gaim # apps/chat # apps/vector # apps/vasm # apps/vecpkg # apps/vlapt # # Generic Apps # ----------------- # apps/console # apps/editor # apps/editor-web # apps/development # apps/java # apps/ # apps/math # apps/plot # apps/ # apps/games # apps/games-puzzle # apps/games-action # apps/viewer # apps/graphics # apps/drawing # apps/audio # apps/audio-editor # apps/video # apps/video-editor # apps/multimedia # apps/office # apps/word # apps/spreadsheet # apps/database # apps/presentation # apps/accounting # apps/project # apps/collection # apps/style # apps/icons # apps/background # apps/config # apps/admin # apps/password usage() { echo << _EOF_ Substitute icons in the merged_dir with the default_dir merge_dir and default_dir must be a valid KDE icons theme Usage: iconmerge [default_dir] Example mergeicon merge all $BASEDIR/* with $DEFAULT mergeicon Noia merge $BASEDIR/Noia with $DEFAULT mergeicon Noia Crystal merge $BASEDIR/Noia with $BASEDIR/Crystal mergeicon ~/.icons/Mine merge Mine with $DEFAULT _EOF_ exit 0 } # Global variables if [ "$UID" = "0" ]; then BASEDIR="/usr/share/icons" else BASEDIR="$HOME/.icons" fi DEFAULT="/usr/share/icons/basic" SIZES="16x16 22x22 32x32 48x48" # current dirs CWD=`pwd` CICON="" CDEFAULT="" # merge standard # usage: micon the_icon subs1 [subs2 [ ...] ] # -- = subtitute icons from default dir # vars: CICON CDEFAULT # this one does not replace symlinks mstandard() { ICON="$1.png" # don't do anything if already there if [ -f $ICON ]; then # echo $ICON = original echo -n "*" return 0 fi # try substitutions shift while [ "$1" ]; do if [ "$1" = "--" ]; then # replace with the default if [ -f $CDEFAULT/$ICON ]; then cp $CDEFAULT/$ICON $ICON echo -n "-" #echo $ICON = default return 0 fi else SUBS=$1.png if [ -f $SUBS ]; then if [ -L $SUBS ]; then SUBS=`readlink $SUBS` fi ln -sf $SUBS $ICON echo -n "+" return 0 fi fi shift done # unsuccess # Try the last attemp if [ -f $CDEFAULT/$ICON ]; then ln -sf $CDEFAULT/$ICON $ICON # echo $ICON = default echo "-" return 0 fi echo -n "?" echo =$ICON return 1 } # merge icons # usage: micon the_icon subs1 [subs2 [ ...] ] # -- = subtitute icons from default dir # vars: CICON CDEFAULT micon() { ICON="$1.png" # delete softlink if [ -L "$ICON" ]; then rm $ICON fi mstandard "$@" } # Substitute icons under a size (48x48, 32x32, ...) # Manual LOL, you need to edit it a LOT # vars: THEMEDIR, DEFAULT, SIZE # msize() { CICON=$THEMEDIR/$SIZE/filesystems CDEFAULT=$DEFAULT/$SIZE/filesystems if ! cd $CICON &> /dev/null ; then echo ERROR: $CICON is not exist return 1 fi mstandard folder_home mstandard folder_open mstandard network mstandard network_local CICON=$THEMEDIR/$SIZE/devices CDEFAULT=$DEFAULT/$SIZE/devices if ! cd $CICON &> /dev/null ; then echo ERROR: $CICON is not exist return 1 fi mstandard floppy_mount 3floppy_mount 2floppy_mount mstandard floppy_unmount 3floppy_unmount 2floppy_unmount mstandard cdrom_mount 3cdrom_mount mstandard cdrom_unmount 3cdrom_unmount mstandard cdwriter_mount 3cdwriter_mount mstandard cdwriter_unmount 3cdwriter_unmount mstandard dvd_mount mstandard dvd_unmount mstandard usbpendrive_mount mstandard usbpendrive_unmount mstandard camera mstandard printer printer1 printer2 mstandard scanner mstandard modem CICON=$THEMEDIR/$SIZE/apps CDEFAULT=$DEFAULT/$SIZE/apps if ! cd $CICON &> /dev/null ; then echo ERROR: $CICON is not exist return 1 fi ## Generic applications mstandard vector mstandard kmenu vector mstandard vasm package_settings mstandard vecpkg mstandard vlapt vecpkg # Generic Apps # ----------------- mstandard package_editors kate mstandard html mstandard package_development mstandard java mstandard package_edutainment mstandard edu_mathematics mstandard edu_science mstandard edu_languages mstandard edu_plot kmplot mstandard package_games mstandard package_games_arcade mstandard package_games_board mstandard package_games_strategy mstandard package_graphics mstandard viewer xmag kview mstandard lineart krita mstandard diagram kfig kig mstandard cad designer mstandard package_multimedia mstandard audio arts kcmsound mstandard audio-editor artsbuilder mstandard video kaboodle #mstandard video-editor mstandard package_network mstandard browser ../filesystems/www mstandard ftp kget mstandard email kmail mstandard p2p ../filesystems/network mstandard gaim kopete mstandard chat mstandard news knewsticker mstandard package_office mstandard word kword mstandard spreadsheet kchart mstandard presentation kpresenter mstandard database package mstandard accounting kpercentage mstandard project korganizer mstandard collection bookcase mstandard package_settings mstandard style mstandard icons mstandard background mstandard package_system mstandard config kcontrol mstandard admin personal mstandard password mstandard package_utilities mstandard explorer kdisknav kfm ../filesystems/folder_open mstandard console display mstandard rconsole krfb mstandard backup mstandard partition kcmpartitions mstandard security agent mstandard network_tools mstandard multimedia_tools artscontrol ## Applications specific micon aterm terminal console micon xterm terminal console micon rox ../filesystems/folder_penguin ../filesystems/folder_crystal explorer micon xfe kdisknav explorer micon gentoo kdisknav explorer micon xnc kdisknav explorer micon xfsamba samba ../filesystems/network_local micon LinNeighborhood samba ../filesystems/network_local # Editor micon scite kate editor micon beaver kate editor micon bluefish html micon quanta html micon cssed stylesheet # Edutainment micon octave edu_mathematics micon gnuplot edu_plot micon geg edu_plot micon galculator kcalc # Games micon ltris package_games micon vexed package_games_strategy package_games micon rocksndiamonds package_games_strategy package_games micon lbreakout2 package_games micon icebreaker package_games micon alienblaster package_games_arcade package_games micon kobo-deluxe package_games_arcade package_games micon pingus package_games_strategy package_games micon powermanga package_games_arcade package_games micon supertux package_games_arcade package_games micon enigma package_games_strategy package_games micon frozen-buble package_games_arcade package_games micon digger package_games_arcade package_games # Graphics micon gqview viewer micon gimp package_graphics micon sodipodi kontour lineart micon inkscape kontour lineart micon dia diagram micon qcad cad micon xsane ../devices/scanner micon flphoto camera ../devices/camera micon digikam camera ../devices/camera micon gwenview viewer micon blender package_graphics micon fyre package_graphics micon kalbum fsview micon xsane ../devices/scanner # Multimedia micon audacity audio-editor micon mplayer multimedia video micon xine video multimedia micon xmms audio multimedia micon ripperx kaudiocreator kscd ../devices/cdaudio_mount micon xcdroast cdbakeoven ../devices/cdwriter_mount micon k3b cdbakeoven ../devices/cdwriter_mount micon realplayer multimedia micon freevo multimedia micon divx multimedia # Network micon opera browser micon dillo browser micon firefox mozilla-firefox browser micon thunderbird mozilla-thunderbird email micon evolution email micon sylpheed email micon gftp ftp micon kasablanca ftp micon kbear ftp micon d4x ftp micon gaim micon xchat chat micon gfax ../devices/fax ../devices/modem micon gkdial ../devices/modem micon xisp kppp ../devices/modem micon adsl ../filesystems/socket ../devices/modem micon gtk-knocker network_tools # Office micon xpdf kpdf acroread micon gv kghostview kpdf acroread micon blackbook kaddressbook micon openoffice ooo_gulls micon abiword wp word micon gnumeric spreadsheet micon oleo xcalc kcalc spreadsheet micon gnucash accounting micon scribus word micon qhacc accounting micon khacc accounting micon kmymoney2 accounting micon tellico bookcase collection micon plan project # Utilities micon gkrellm hwinfo micon xscreensaver kscreensaver background micon cups ../devices/printer micon qtparted partition micon putty rconsole micon gamix multimedia_tools micon switch style micon switch2 style micon gxset style micon menueditor kmenuedit micon gtklp ../devices/printer micon xcdroast ../devices/cdwriter_mount micon k3b ../devices/cdwriter_mount micon guarddog security micon guidedog security micon konserve backup cd $CWD } # substitute a theme # vars: THEMEDIR, DEFAULT, SIZES mtheme() { BASENAME=`basename $THEMEDIR` if [ -L $THEMEDIR -a "$BASENAME" = "default" ]; then echo Skipping default return 1 fi for SIZE in $SIZES ; do echo echo Merging $THEMEDIR/$SIZE ... (msize $SIZE) echo done } ###################################################################### # Main program [ -z "$1" ] && usage [ "$1" == "-h" ] && usage [ "$1" == "--help" ] && usage if [ "$1" ]; then if [ -d $1 ]; then THEMEDIR=$PWD/$1 elif [ -d $BASEDIR/$1 ]; then THEMEDIR=$BASEDIR/$1 else echo "Cannot find icons $1" exit 1 fi for SIZE in $SIZES ; do if [ ! -d $THEMEDIR/$SIZE ]; then echo "Excuse me, $THEMEDIR/$SIZE is not exist" exit 1 fi done if [ "$2" ]; then if [ -d $2 ]; then DEFAULT=$PWD/$2 elif [ -d $BASEDIR/$2 ]; then DEFAULT=$BASEDIR/$2 else echo "Cannot find $2" exit 1 fi for SIZE in $SIZES ; do if [ ! -d $DEFAULT/$SIZE ]; then echo "Excuse me, $DEFAULT/$SIZE is not exist" exit 1 fi done fi mtheme exit 0 fi