2009-05-09 21:11:29 +02:00
|
|
|
#!/bin/sh
|
2009-04-08 17:30:18 +02:00
|
|
|
|
2009-04-18 12:26:31 +02:00
|
|
|
# rlwrap provides readline to stuff which doesn't know readline by itself
|
2009-06-12 09:14:29 +02:00
|
|
|
RLWRAP=$(which rlwrap 2>/dev/null)
|
|
|
|
READ_OPTIONS="-r"
|
2009-04-18 12:26:31 +02:00
|
|
|
|
2009-04-30 00:27:03 +02:00
|
|
|
if [ "$RLWRAP" != "" ]
|
2009-04-18 12:26:31 +02:00
|
|
|
then
|
2009-04-30 00:27:03 +02:00
|
|
|
if [ "$A_RERUN" = "" ]
|
|
|
|
then
|
|
|
|
A_RERUN="no" exec $RLWRAP $0
|
|
|
|
fi
|
|
|
|
else
|
2009-06-12 09:14:29 +02:00
|
|
|
if [ "$BASH" ]
|
|
|
|
then
|
|
|
|
READ_PARAMETERS=" -e"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $BASH ]
|
|
|
|
then
|
|
|
|
READ_OPTIONS="$READ_OPTIONS -p awesome# "
|
2009-04-18 12:26:31 +02:00
|
|
|
fi
|
|
|
|
|
2009-04-08 17:30:18 +02:00
|
|
|
DBUS_SEND=dbus-send
|
|
|
|
|
2009-05-09 21:11:06 +02:00
|
|
|
which ${DBUS_SEND} > /dev/null
|
|
|
|
if test $? = 1
|
2009-04-08 17:30:18 +02:00
|
|
|
then
|
|
|
|
echo "E: Unable to find" ${DBUS_SEND}
|
2009-05-09 21:10:24 +02:00
|
|
|
exit 1
|
2009-04-08 17:30:18 +02:00
|
|
|
fi
|
|
|
|
|
2009-05-16 12:22:20 +02:00
|
|
|
DBUS_METHOD=org.naquadah.awesome.Remote.Eval
|
2009-04-08 17:30:18 +02:00
|
|
|
DBUS_PATH=/
|
2009-05-16 12:22:20 +02:00
|
|
|
DBUS_DEST=org.naquadah.awesome
|
2009-04-08 17:30:18 +02:00
|
|
|
|
|
|
|
a_dbus_send()
|
|
|
|
{
|
|
|
|
$DBUS_SEND --dest=$DBUS_DEST --type=method_call --print-reply $DBUS_PATH \
|
|
|
|
$DBUS_METHOD string:"$1" | tail -n +2
|
|
|
|
}
|
|
|
|
|
2009-06-12 09:14:29 +02:00
|
|
|
while read ${USE_READLINE} ${READ_OPTIONS} line
|
2009-04-08 17:30:18 +02:00
|
|
|
do
|
|
|
|
a_dbus_send "$line"
|
|
|
|
done
|