HOWTO: Mintify Icon Themes

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

HOWTO: Mintify Icon Themes

Postby ranyardm on Wed Apr 16, 2008 11:17 am

Okay, it really bugs me when I'm looking at themes that the Ubuntu icon comes back, so I decided that I'd look at scripting a "fix icon theme" script. I know it's fixed in mintmenu 3.1 but I guess there's other things that will look for start-here.png and novell.png etc. so it may retain usefulness to fix here anyway.

Guess what, it worked! If only text attachments worked in phpBB I'd be able to post it here... and my mintupload isn't working either, *sigh*, http://www.bikerwitch.org.uk/files/mintify-icon-theme.sh

Steps to use :
Download my script above and save somewhere you know where it is (/tmp/ or your home directory is good)
Open up "Appearance" from the Control Center or Preferences in the MintMenu
Drag your icon theme straight from firefox into the window (or download and install etc.)
Apply a theme other than the theme you want fixing and exit Appearance
Open a terminal and run the script mintify-icon-theme.sh themename (you may need sh before if you don't know how to make the script executable)
Re-open "Appearance" and viola, selecting the theme will maintain your mint logo!

What the script does :

Looks at the "Cassandra" icon set that is on Daryna also, copies the .png files to the same place in the user's theme and edits the theme index file to include any missing directory definitions (yes, most themes have wildly different indexes to what is really there!)

I hope this helps someone. Oh, and it's GPL/BSD/Copyleft/Any other reasonable license multi-licensed.
--
Martyn Ranyard
ranyardm
Level 1
Level 1
 
Posts: 48
Joined: Thu Mar 20, 2008 3:40 pm

Linux Mint is funded by ads and donations.
 

Re: HOWTO: Mintify Icon Themes

Postby Husse on Fri Apr 18, 2008 5:33 pm

If only text attachments worked in phpBB I'd be able to post it here

You could include it in a code box such as
Code: Select all
#!/bin/bash

REPLACE_FILES="distributor-logo.png gnome-main-menu.png novell-button.png start-here.png"
SOURCE_THEME=Celena
DESTINATION_THEME=$1

if [ -z $DESTINATION_THEME ] || ! [ -d ~/.icons/$DESTINATION_THEME ]; then
  echo "Usage : [sh] mintify-icon-theme.sh \"[theme name to mintify]\""
  echo ""
  echo "Mintifyable themes : "
  echo ~/.icons/* | sed s/"\/[^ ]*\/"//g
  exit 0
fi

SOURCE_SIZES=/usr/share/icons/$SOURCE_THEME/[0-9]*x[0-9]*
SOURCE_SIZES=`echo $SOURCE_SIZES | sed s/"\/[^ ]*\/"//g | sed s/" "/"\n"/g | sort -r -n`

echo Source Sizes = $SOURCE_SIZES

for s in $SOURCE_SIZES; do
  mkdir -p ~/.icons/$DESTINATION_THEME/$s/places
  for f in $REPLACE_FILES; do
    if [ -e /usr/share/icons/$SOURCE_THEME/$s/places/$f ]; then cp /usr/share/icons/$SOURCE_THEME/$s/places/$f ~/.icons/$DESTINATION_THEME/$s/places/; fi
  done
done

ORIGDIRS=`grep ^Directories ~/.icons/$DESTINATION_THEME/index.theme | sed s/^Directories=//`
for s in $SOURCE_SIZES; do
  if ! echo $ORIGDIRS | grep $s/places > /dev/null; then
    NEWDIRS=$NEWDIRS$s/places,
  fi
done

NEWDIRS=`echo $NEWDIRS | sed s/,\$//`
LINECOUNT=`wc -l ~/.icons/$DESTINATION_THEME/index.theme | sed s/" .*"//`
DIRECTORIES_LINE=`grep -n Directories= ~/.icons/$DESTINATION_THEME/index.theme | sed s/:.*//`

SOURCETHEMEINDEX=~/.icons/$DESTINATION_THEME/index.theme
MINTEDTHEMEINDEX=~/.icons/$DESTINATION_THEME/index.minted
echo Creating minted theme index...
head -n `expr $DIRECTORIES_LINE - 1` $SOURCETHEMEINDEX > $MINTEDTHEMEINDEX
echo "Directories=$ORIGDIRS,$NEWDIRS" | sed s/,\$// >> $MINTEDTHEMEINDEX
tail -n `expr $LINECOUNT - $DIRECTORIES_LINE` $SOURCETHEMEINDEX >> $MINTEDTHEMEINDEX
for s in $SOURCE_SIZES; do
  if ! grep "\[$s\/places\]" $SOURCETHEMEINDEX > /dev/null; then
    echo "" >> $MINTEDTHEMEINDEX
    echo "[$s/places]" >> $MINTEDTHEMEINDEX
    echo "Size="`echo $s | sed s/"x.*"//` >> $MINTEDTHEMEINDEX
    echo "Context=Places" >> $MINTEDTHEMEINDEX
    echo "Type=Scaled" >> $MINTEDTHEMEINDEX
  fi
done
echo Backing up original theme index...
mv ~/.icons/$DESTINATION_THEME/index.theme ~/.icons/$DESTINATION_THEME/index.theme.orig
echo Minting....
mv ~/.icons/$DESTINATION_THEME/index.minted ~/.icons/$DESTINATION_THEME/index.theme
echo Done.
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19703
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden


Return to Tutorials

Who is online

Users browsing this forum: Google [Bot] and 6 guests