awesome-client: send command line arguments to awesome (#1058)

In some languages, invoking commands with command-line arguments is
significantly simpler than setting up pipes for writing to a command's
standard input.

This adds an additional way for sending commands through awesome-client;
so all of these will be equivalent:

  $ awesome-client 'awesome.restart()'
  $ echo 'awesome.restart()' | awesome-client
  $ awesome-client <<<'awesome.restart()'
  $ awesome-client
  awesome# awesome.restart()
  awesome# ^D
  $

Note that this sends each command line argument as a separate message
over dbus.
This commit is contained in:
Fernando Vezzosi 2016-08-30 12:58:54 +02:00 committed by Daniel Hahler
parent 83e0423e89
commit f0f31bc305
1 changed files with 7 additions and 2 deletions

View File

@ -17,7 +17,7 @@ then
then then
if [ "$A_RERUN" = "" ] if [ "$A_RERUN" = "" ]
then then
A_RERUN="no" exec $RLWRAP $0 A_RERUN="no" exec $RLWRAP $0 "$@"
fi fi
READ_CMD="read" READ_CMD="read"
else else
@ -50,7 +50,12 @@ a_dbus_send()
fi fi
} }
if [ "$ISATTY" = 0 ] if [ $# -ne 0 ]
then
for arg in "$@" ; do
a_dbus_send "$arg"
done
elif [ "$ISATTY" = 0 ]
then then
while $READ_CMD -p "awesome# " -r line while $READ_CMD -p "awesome# " -r line
do do