awesome-client: allow to send multi line code

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2010-12-16 11:55:51 +01:00
parent 9cdbb016f1
commit cdbbac3c6f
1 changed files with 31 additions and 20 deletions

View File

@ -1,25 +1,31 @@
#!/bin/sh #!/bin/sh
# rlwrap provides readline to stuff which doesn't know readline by itself
RLWRAP=$(which rlwrap 2>/dev/null)
READ_OPTIONS="-r" READ_OPTIONS="-r"
if [ "$RLWRAP" != "" ] tty 2>&1 > /dev/null
then ISATTY=$?
if [ "$A_RERUN" = "" ]
then
A_RERUN="no" exec $RLWRAP $0
fi
else
if [ "$BASH" ]
then
READ_OPTIONS=" -e"
fi
fi
if [ $BASH ] if [ "$ISATTY" = 0 ]
then then
READ_OPTIONS="$READ_OPTIONS -p awesome# " # rlwrap provides readline to stuff which doesn't know readline by itself
RLWRAP=$(which rlwrap 2>/dev/null)
if [ "$RLWRAP" != "" ]
then
if [ "$A_RERUN" = "" ]
then
A_RERUN="no" exec $RLWRAP $0
fi
else
if [ "$BASH" ]
then
READ_OPTIONS=" -e"
fi
fi
if [ $BASH ]
then
READ_OPTIONS="$READ_OPTIONS -p awesome# "
fi
fi fi
DBUS_SEND=dbus-send DBUS_SEND=dbus-send
@ -41,7 +47,12 @@ a_dbus_send()
$DBUS_METHOD string:"$1" | tail -n +2 $DBUS_METHOD string:"$1" | tail -n +2
} }
while read ${READ_OPTIONS} line if [ "$ISATTY" = 0 ]
do then
a_dbus_send "$line" while read ${READ_OPTIONS} line
done do
a_dbus_send "$line"
done
else
a_dbus_send "`cat`"
fi