LeoNerd.org.uk

askuser

This program first occured to me while I was working with acpid. The problem with it is that it doesn't have a terminal or an X11 connection. As such, it cannot directly ask the user any questions, or otherwise interact with them. I came upon the rather simple but effective idea of having a daemon listening on a UNIX local socket, to take questions and return answers to the script. A user running X11 then runs an agent of their choosing, to interact with the user.This has several advantages:

That said, the code is still in quite an early version, as it stands. It supports only one agent. The eventual design is to allow multiple agents registered, each one for some given virtual terminal (VT). Depending on the active VT, a different agent will be invoked. Currently only a GTK2-based agent is provided, but others can easily be implemented, notably in QT, and a plain-text one for console use.

A sample screenshot of the GTK2 dialog:

Download source in tarball from: