A script to convert .eap files to .desktop files, putting the icon in
authorDavid Walter Seikel <onefang@gmail.com>
Thu, 14 Sep 2006 20:14:50 +0000 (20:14 +0000)
committerDavid Walter Seikel <onefang@gmail.com>
Thu, 14 Sep 2006 20:14:50 +0000 (20:14 +0000)
~/.e/e/icons.

This uncovered a problem, menus can't seem to handle the resulting icon, but
ibar and other things can.  To be investigated later, I need sleep.

SVN revision: 25845

Makefile.am
eap_to_desktop [new file with mode: 0755]

index 70f9951..423f94f 100644 (file)
@@ -6,7 +6,7 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \
                       stamp-h.in acconfig.h debian/changelog \
                       enlightenment.spec
 
-bin_SCRIPTS = enlightenment-config
+bin_SCRIPTS = enlightenment-config eap_to_desktop
 
 EXTRA_DIST = README AUTHORS COPYING COPYING-PLAIN \
              enlightenment.spec.in enlightenment.spec \
diff --git a/eap_to_desktop b/eap_to_desktop
new file mode 100755 (executable)
index 0000000..cc9880b
--- /dev/null
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+# Change to a directory full of .eaps, ~/.e/e/applications/all for instance,
+# Then run this command -
+# find *.eap -maxdepth 1 -type f -print0 | xargs -0 -n 1 eap_to_desktop
+
+# WARNING - this can make E unresponsive for a few minutes.  Have patience.
+# Don't use this on module.eaps, as the icon ends up in the wrong place.
+
+
+
+WD=`pwd`
+FILENAME=`basename $@ .eap`
+
+if [ -e "$FILENAME.eap" ]; then
+    rm -fr /tmp/convert.eap/$FILENAME
+    mkdir -p /tmp/convert.eap/$FILENAME
+    cp $FILENAME.eap /tmp/convert.eap/$FILENAME
+    pushd /tmp/convert.eap/$FILENAME >/dev/null
+
+    eet -d $FILENAME.eap >/dev/null
+    NAME=`cat app/info/name 2>/dev/null`
+    GENERIC=`cat app/info/generic 2>/dev/null`
+    COMMENT=`cat app/info/comment 2>/dev/null`
+    EXEC=`cat app/info/exe 2>/dev/null`
+    STARTUP=`cat app/info/startup_notify 2>/dev/null | tr "\000\001" "01"`
+    WAIT=`cat app/info/wait_exit 2>/dev/null | tr "\000\001" "01"`
+    WNAME=`cat app/window/name 2>/dev/null`
+    WCLASS=`cat app/window/class 2>/dev/null`
+    WZTITLE=`cat app/window/title 2>/dev/null`
+    WZROLE=`cat app/window/role 2>/dev/null`
+    ICLASS=`cat app/icon/class 2>/dev/null`
+
+    echo "[Desktop Entry]" >$FILENAME.desktop
+    if [ "$NAME" ]; then
+       echo "Name=$NAME" >>$FILENAME.desktop
+    fi
+    if [ "$GENERIC" ]; then
+       echo "GenericName=$GENERIC" >>$FILENAME.desktop
+    fi
+    if [ "$COMMENT" ]; then
+       echo "Comment=$COMMENT" >>$FILENAME.desktop
+    fi
+    if [ "$EXEC" ]; then
+       echo "Exec=$EXEC" >>$FILENAME.desktop
+    fi
+    if [ "$STARTUP" == "0" ]; then
+       echo "StartupNotify=false" >>$FILENAME.desktop
+    fi
+    if [ "$STARTUP" == "1" ]; then
+       echo "StartupNotify=true" >>$FILENAME.desktop
+    fi
+    if [ "$WAIT" == "0" ]; then
+       echo "X-Enlightenment-WaitExit=false" >>$FILENAME.desktop
+    fi
+    if [ "$WAIT" == "1" ]; then
+       echo "X-Enlightenment-WaitExit=true" >>$FILENAME.desktop
+    fi
+    if [ "$WNAME" ]; then
+       echo "X-Enlightenment-WIndowName=$WNAME" >>$FILENAME.desktop
+    fi
+    if [ "$WCLASS" ]; then
+       echo "StartupWMClass=$WCLASS" >>$FILENAME.desktop
+    fi
+    if [ "$WTITLE" ]; then
+       echo "X-Enlightenment-WindowTitle=$WTITLE" >>$FILENAME.desktop
+    fi
+    if [ "$WROLE" ]; then
+       echo "X-Enlightenment-WindowRole=$WROLE" >>$FILENAME.desktop
+    fi
+    if [ "$ICLASS" ]; then
+       echo "X-Enlightenment-IconClass=$ICLASS" >>$FILENAME.desktop
+    fi
+    echo "Icon=$FILENAME.edj" >>$FILENAME.desktop
+
+    cp -f $FILENAME.desktop $WD
+
+    popd >/dev/null
+
+    mv $FILENAME.eap ~/.e/e/icons/$FILENAME.edj
+    rm -fr /tmp/convert.eap/$FILENAME
+else
+    echo "Not a .eap file."
+fi