Thursday, July 19, 2007

Simple script to add icons to idesktop

#!/bin/bash
cd ~/.idesktop
command=""
icon=""
caption=""
####using function#####
message=""
input=""
function requestUserInput() {
while true; do
echo $message
read input

if [ -z $input ] 2> /dev/null
then
continue
else

echo "You entered \"$input\" "
echo "Continue? [y/n]: "
read ans
if expr $ans = y > /dev/null
then
break
else
continue
fi
fi
done
}

#request caption
if [ $# -eq 0 ]; then
message="Caption: "
requestUserInput
caption=$input
else
caption=$1
fi


#request command
message="Command: "
requestUserInput
command=$input

#request icon
#rox icons&
message="Icon: "
icon=$( zenity --entry --text "Drag and Drop the Image here:" --title Image);
#requestUserInput
#icon=$input

echo "table Icon
Caption: $caption
Command: $command
Icon: $icon
Width: 48
Height: 48
X: 0
Y: 0
end" > $caption.lnk

No comments:

Post a Comment