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