1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
This is the description of the protocol used by slrnface and the parent
process. It is provided to save you from looking at the source in case
you want to write your own scripts for communication. However, the
protocol is unstable and subject to change in the future releases. That's
why it's not in the man page.
1. Setup
The last parameter passed to the slrnface should be the name of the
FIFO which the parent has created.
If it's not passed slrnface will create the FIFO, but this can work
reliably only if slrnface was started by a fork/exec sequence. If it
has been started by a system() call, slrnface has no way of knowing
that its parent process is a shell and not the actual parent process.
FIFO name constructed by slrnface is:
$HOME/.slrnfaces/$nodename.$ppid
where:
$HOME is the value of HOME environment variable
$nodename is the nodename member of struct utsname returned by uname(2)
$ppid is the parent proces id
Once the FIFO has been opened by both parties slrnface will wait until
the parent writes a short string. The string will be discarded and can
be anything. The length must be less than PIPE_BUF, as defined in
<limits.h>.
2. Commands
All commands are terminated by a newline character. Unrecognized
commands are discarded. Slrnface understands the following commands:
- clear
causes slrnface to clear X-Face window
- xface argument
causes slrnface to prepare the new image as specified by the
argument and map the X-Face window. The argument needs to be 48x48x1
image in the format produced by the compface(1) command. It can
contain whitespace at arbitrary positions between non-whitespace
characters. If the argument is longer than 2000 bytes, the command
is discarded.
- suppress
causes slrnface to temporarily remove X-Face window. It can be shown
again by using "show" command or by supplying a new X-Face with
"xface" command.
- show
the action depends on whether "clear" or "xface" command preceded
this one. If it was "clear", nothing happens. If it was "xface", the
X-Face window will appear on the screen, containing the last image
sent with the "xface" command. In case one of the below commands was
specified between "suppress" and "show", the new X-Face window will
reflect changes they were asking for.
- ink argument
causes slrnface to change X-Face foreground color to the one
specified in the argument. The argument must be in the format
recognized by XParseColor().
- paper argument
causes slrnface to change X-Face background color to the one
specified in the argument. The argument must be in the format
recognized by XParseColor().
- padcolor argument
causes slrnface to change X-Face pad color to the one specified in
the argument. The argument must be in the format recognized by
XParseColor().
- xoffsetchar number
- xoffsetpix number
- yoffsetchar number
- yoffsetpix number
cause slrnface to move X-Face window to the location specified with
these commands. If any of the arguments is negative, greater than
INT_MAX or not a number, it is ignored. If one of these commands is
not specified when moving the window, previously specified value is
used. This can cause unwanted effects if the user has moved the
window manually.
There is no way for slrnface to notify the parent about successful or
unsuccessful completion of the command.
3. Shutdown
Slrnface will exit in case of a fatal error or when it detects that the
parent process has closed the FIFO. For the list of exit codes refer to
the slrnface man page.
|