Browse files

Use Zenity to provide an image selector on Linux. Use full pathname t…

…o icon for gvfs-set-attribute.
  • Loading branch information...
1 parent d1100ec commit cb3684c7451def120e9ef1bb80bc9039f8b3ce32 @lispnik lispnik committed Nov 7, 2010
Showing with 15 additions and 3 deletions.
  1. +15 −3 oneclick/%{NAME}.sh.template
View
18 oneclick/%{NAME}.sh.template
@@ -1,20 +1,32 @@
#!/bin/sh
# path
-ROOT=`dirname $0`
+ROOT=`readlink -f $(dirname $0)`
LINUX="$ROOT/Contents/Linux"
RESOURCES="$ROOT/Contents/Resources"
-# icon
+# icon (note: gvfs-set-attribute is found in gvfs-bin on Ubuntu
+# systems and it seems to require an absolute filename)
gvfs-set-attribute \
"$0" \
"metadata::custom-icon" \
"file://$RESOURCES/Squeak.png" \
2> /dev/null
+# zenity is part of GNOME
+image_count=`ls "$RESOURCES"/*.image 2>/dev/null |wc -l`
+if which zenity &>/dev/null && [ "$image_count" -ne 1 ]; then
+ olddir=`pwd`
+ cd "$RESOURCES"
+ image=`zenity --title 'Select an image' --file-selection --file-filter '*.image' --file-filter '*'`
+ cd "$olddir"
+else
+ image="$RESOURCES/%{NAME}.image"
+fi
+
# execute
exec "$LINUX/squeak" \
-plugins "$LINUX" \
-encoding latin1 \
-vm-display-X11 \
- "$RESOURCES/%{NAME}.image"
+ "$image"

0 comments on commit cb3684c

Please sign in to comment.