Hi, I just made a patch to add remote control for Dillo. 1. Summary: 1.1 Why? To be able to command Dillo from another process. E.g.: if Dillo is used as a help doc browser of a program, the program can implement context sensitive help and associate to each widget a help URL. The same Dillo instance can then be used to show the differents help docs. Other example, which also was the motivation of this patch: Sylpheed-Claws uses Dillo to render HTML mail, but currently it has to run a new instance each time the user views an HTML mail. Having only one instance is more efficient and improve responsiveness. 1.2. HowTo To be remote controlled, a Dillo instance must be explicitly started with a special command line option (-s, --server NAME), e.g.: dillo -s server A client instance sends commands to this server by referencing it and by using the -c, --command options, e.g.: a. dillo -s server -c "open(http://www.google.com)" -c "new-window(www.av.com)" b. dillo -s server http://www.google.com amounts to: dillo -s server -c "new-window(http://www.google.com)" Hence, running dillo -s server -c "open(URL)" mutliple times will launch only one instance of dillo at the first time, and the subsequent calls will just hand the arguments to the server. This is more practical than Mozilla's current behaviour where the user has to use two different commands to start and to control a server. The list of currently known commands is provided by the -H, --help-commands option: dillo -H Commands that can be used with the -c, --command option: open(URL) Open URL in current window. new-window(URL) Open URL in a new window. Exit() Terminate browsing session and exit. Command names are case insensitive. It is allowed to have more than one command option. New commands can be added, the syntax being: command(.*) 2. Ressources In dillorc: server_socket_path by default, it is "/tmp". It is used to create the socket name which is: $server_socket_path/dillo-$USER-$NAME. where $NAME is the server name from the -s, --server NAME option. E.g.: /tmp/dillo-john-help 3. Caveat If gtk specific command lines arguments are given, arguments are messed around, due to the fact that the patch delays gtk_init() after private arguments parsing, This will be fixed in the next version If a Dillo server does not quit cleanly, the socket corresponding to the server is not removed. Subsequent attempts to run a server with the same name will fail until the socket is removed (by default: /tmp/dillo-$USER-$SERVER_NAME). A solution is currently searched. The -c "exit()" works only when used from the client side The -c commands are currently ignored if no -s option is given. Any comments are welcome. Especially use cases for the remote control. 4. Details 4.1. Becoming a server Communication between server and client is done via UNIX domain socket. The advantage between this and FIFO being that a separate connection is made for each client, so communcation are guaranteed to not mixup. FIFO, on the other hand, can mixup communication of multiple clients if the messages are larger than some value (PIPE_BUF). This patch uses dynamic allocation for the messages received by the server. When the -s, --server NAME option is given, dillo checks wether a socket correspondig to that name is available and responding. If yes, it will hand any -c, --command CMD and any URL|FILE it finds in its command line options to that running server. URL|FILE are interpreted as "-c new-window(URL|FILE)". If no server socket is responding, it turns it self into a server by creating that socket. After that, it handles the -c, --command CMD and the URL|FILE options itself. 4.2. GUI initialisation The gtk_init() function is now called after dillo options parsing to speed up client execution. Indeed, a client instance does not need to initialise the GUI. This introduces the problem of messed up args if gtk args are given. This could affect the URL|FILE arguments. A solution would be to save them in a separate list for later processing. Another solution would be to interprete the URL|FILE arguments as -c open(URL|FILE) at an early stage. This will also help fixing the problem of the -c commands being ignored if no -s option is given. 4.3. Commands Commands are simple of the form: command(arg..). Arguments are parsed by the shell, so the user must take care that the command is interpreted as a single argument by the shell. Arguments should not contain unescaped parenthesis or spaces. Therefore, the following example is incorrect: dillo -s server -c open(file:///home/user/My documents) because: 1. the shell interprets the parenthesis, and 2. there is a space in the argument. This should be escaped in the following manner by using quotes: dillo -s server -c "open(file:///home/user/My documents)" It is easy to add new commands. -- Melvin Hadasht