<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hey everyone, I have made a little script to convert the icons to a
specific size.<br>
It also makes a backup of your current xpm files.<br>
I am no Bash programmer, but it works.... so I would suggest
someone who is knowledgeable about it look at my file and see if
there is some better programming that can be done to make this
nicer, and if any of the devs are around (after the holidays of
course) I'd like to know if this can be adapted to be used in the
menu updating script.<br>
You can tweak this to make different sizes...<br>
This is something that requires SUDO.<br>
Please make sure you are comfortable running potentially dangerous
commands before testing this out. I have tested it on my computer,
and it works for me. I'll attach the file, and put it into the
e-mail so it is available to look at before you download it or run
it. If anything about it needs to be explained I'd be glad to
explain what I did, though if you are good a shell scripting, I am
sure you can think of a better way of doing this.<br>
<br>
the things you can edit are <tt><br>
</tt><tt>size=24x24</tt><tt> </tt><font face="serif">make this
whatever size you like... I find 24x24 is good for the menu...<br>
</font><br>
<font face="serif">I have 2 backup directories.... if you try it
once backup is created. if backup exists extraBackup is created.</font><br>
If you keep trying it you will get an error that extraBackup already
exists.<br>
<tt>backup=/usr/share/pixmaps/backup/</tt><tt><br>
</tt><tt>extraBackup=/usr/share/pixmaps/extraBackup/</tt><tt><br>
</tt><br>
You will not be prompted for anything except your password at the
beginning.<br>
Here it is:<br>
<br>
<tt><br>
</tt><tt>#!/bin/bash</tt><tt><br>
</tt><tt>shopt -s nullglob</tt><tt><br>
</tt><tt>iconDir=/usr/share/pixmaps/</tt><tt><br>
</tt><tt>backup=/usr/share/pixmaps/backup/</tt><tt><br>
</tt><tt>extraBackup=/usr/share/pixmaps/extraBackup/</tt><tt><br>
</tt><tt>cd "$iconDir"</tt><tt><br>
</tt><tt>putfiles=(*.xpm)</tt><tt><br>
</tt><tt>size=24x24</tt><tt><br>
</tt><tt>echo "This will require a password to backup and convert
your icons"</tt><tt><br>
</tt><tt>if [ ! -d "$backup" ]; then</tt><tt><br>
</tt><tt>echo "Making a backup of $iconDir"</tt><tt><br>
</tt><tt>sudo mkdir ${backup}</tt><tt><br>
</tt><tt>for file in "${putfiles[@]}"; do</tt><tt><br>
</tt><tt> sudo cp ${file} ${backup}</tt><tt><br>
</tt><tt> echo "$file has been saved to $backup"</tt><tt><br>
</tt><tt>done</tt><tt><br>
</tt><tt>fi</tt><tt><br>
</tt><tt>if [ -d "$backup" ]; then</tt><tt><br>
</tt><tt>echo "You have already backed up your files once... I'll
make another directory called $extraBackup"</tt><tt><br>
</tt><tt>sudo mkdir ${extraBackup}</tt><tt><br>
</tt><tt>for file in "${putfiles[@]}"; do</tt><tt><br>
</tt><tt> sudo cp ${file} ${extraBackup}</tt><tt><br>
</tt><tt> echo "$file has been saved to $extraBackup"</tt><tt><br>
</tt><tt>done</tt><tt><br>
</tt><tt>fi</tt><tt><br>
</tt><tt><br>
</tt><tt>echo "This will convert the xpm files to $size"</tt><tt><br>
</tt><tt>for file in "${putfiles[@]}"; do</tt><tt><br>
</tt><tt> echo "Processing $file"</tt><tt><br>
</tt><tt> sudo convert ${file} -scale $size ${iconDir}${file}</tt><tt><br>
</tt><tt> echo "Saved to $iconDir $file"</tt><tt><br>
</tt><tt>done</tt><tt><br>
</tt><tt><br>
</tt><tt>echo "Done!"</tt><br>
<pre class="moz-signature" cols="72">--
Regards</pre>
</body>
</html>