Merge branch 'fix-ldoc-set-spacing' of git://github.com/actionless/awesome
[awesome.git] / utils / awesome-client
blob658787d8fefb4957f68372fa635294848deb73a1
1 #!/bin/sh
3 READ_OPTIONS="-r"
5 tty 2>&1 > /dev/null
6 ISATTY=$?
8 if [ "$ISATTY" = 0 ]
9 then
10 # rlwrap provides readline to stuff which doesn't know readline by itself
11 RLWRAP=$(which rlwrap 2>/dev/null)
12 if [ "$RLWRAP" != "" ]
13 then
14 if [ "$A_RERUN" = "" ]
15 then
16 A_RERUN="no" exec $RLWRAP $0
18 else
19 if [ "$BASH" ]
20 then
21 READ_OPTIONS=" -e"
25 if [ $BASH ]
26 then
27 READ_OPTIONS="$READ_OPTIONS -p awesome# "
31 DBUS_SEND=dbus-send
33 which ${DBUS_SEND} > /dev/null
34 if test $? = 1
35 then
36 echo "E: Unable to find" ${DBUS_SEND}
37 exit 1
40 DBUS_PATH=/
41 DBUS_DEST=org.naquadah.awesome.awful
42 DBUS_METHOD=${DBUS_DEST}.Remote.Eval
44 a_dbus_send()
46 $DBUS_SEND --dest=$DBUS_DEST --type=method_call --print-reply $DBUS_PATH \
47 $DBUS_METHOD string:"$1" | tail -n +2
50 if [ "$ISATTY" = 0 ]
51 then
52 while read ${READ_OPTIONS} line
54 a_dbus_send "$line"
55 done
56 else
57 a_dbus_send "`cat`"