views:

42

answers:

1

I have two files with different names. I have a for-loop to see if one file is there; if it is then it will change a file.

My first thought was to make a list of all the files and what its counterpart is. That would not look nice and I can't cover all possibilities in the script. If this is the only way, how would I do it best?

The script will find if a program has an icon on the desktop. If it has then my script will change the size of that with ImageMagick. My problem is that the name of the program not always is the same as the icon-file. So I am not sure what the best action would be...

I need the "rtcom-call-ui.desktop" to be paired with "general_call.png" so it can be found with my script. The script can't find "general_call.png" cause it is looking for "rtcom-call-ui.png".

for applet in $appletDir*
do
    app=`basename $applet | sed -e 's/.*://g' -e 's/.*osso-//g' -e 's/\.desktop.*//g'`
    find=`find $icoDir64 $icoDirSca | grep .png` 

    for file in $find
    do
        base="`basename ${file}`"

        if [ "${base}" = "${app}.png" -o "${base}" = "tasklaunch_${app}.png" -o "${base}" = "general_${app}.png" ]; then
            echo "WORKING!!!!!!!!!!!!!!!!!! $file" 
        fi
    done
done
A: 

On gnome, a desktop launcher is a .desktop file:

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Name=GIMP Image Editor
GenericName=Image Editor
Comment=Create images and edit photographs
Exec=gimp-2.6 %U
TryExec=gimp-2.6
Icon=gimp
Terminal=false
Categories=Graphics;2DGraphics;RasterGraphics;GTK;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=GIMP
X-GNOME-Bugzilla-Component=General
X-GNOME-Bugzilla-Version=2.6.7
X-GNOME-Bugzilla-OtherBinaries=gimp-2.6
StartupNotify=true
MimeType=application/postscript;application/pdf;image/bmp;image/g3fax;image/gif;image/x-fits;image/pcx;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-psd;image/x-sgi;image/x-tga;image/x-xbitmap;image/x-xwindowdump;image/x-xcf;image/x-compressed-xcf;image/tiff;image/jpeg;image/x-psd;image/png;image/x-icon;image/x-xpixmap;image/svg+xml;image/x-wmf;
X-Ubuntu-Gettext-Domain=gimp20
X-Ubuntu-Gettext-Domain=gimp20

that's a sample, GIMP launcher, is it the type of icon you are having? if it is you can inspect file content to get access to the executable name and icon filename.

aularon
It's not for Gnome but Maemo. I have not been able to find a file like that.
AlMehdi