summarylogtreecommitdiffstats
path: root/pharo.sh
blob: 9d7c217c6b56fb5185248ffa2300a98159efa104 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash

# path
DIR=`readlink -f $0` #resolve symlink
ROOT=`dirname $DIR` #obtain dir of the resolved path
LINUX="$ROOT/bin"
RESOURCES="$ROOT/shared"
ICONS="$ROOT/icons"

# 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://$ICONS/Pharo.png" \
		2> /dev/null

# zenity is part of GNOME
image_count=`ls "$RESOURCES"/*.image 2>/dev/null |wc -l`
if [ "$1" == "" ]; then 
	if which zenity &>/dev/null && [ "$image_count"  -ne 1 ]; then
		image=`zenity --title 'Select an image' --file-selection --filename "$RESOURCES/" --file-filter '*.image' --file-filter '*'`
	else
		image="$RESOURCES/Pharo7.0.image"
	fi
else
	image=$*
fi


# execute
exec "$LINUX/pharo" \
	--plugins "$LINUX" \
	--encoding utf8 \
	-vm-display-X11 \
	$image