Hello, On Fri, 19 Nov 2010, David C. Rankin wrote:
Stumbling around some more turned up the following list of scriptable text & X GUIs. All basically do the same thing, but the flexibility of some is better than the other. They are all worth a look depending on the project you have in front of you:
dialog cdialog Xdialog gdialog kdialog zenity
And some are also "calling compatible", have a look at texconfig-dialog. IIRC: dialog, kdialog and gdialog have a common basic interface (e.g. the same "yesno" option). So you can often do a test for X ($DISPLAY or more reliably a specific test[1]), set a variable $DIALOG accordingly to "dialog" or e.g. "kdialog" and the just use $DIALOG --yesno "You want fries with that?" 5 30 (just tested the above with $DIALOG being dialog, kdialog and gdialog :) -dnh [1] I've a self-written "Xruns" that tests if X is actually running and not whether just "DISPLAY" is set. ==== Xruns.c ==== /* Copyleft (l) 2003-2010 David Haller <dnh@opensuse.org> compile with e.g.: gcc -O2 -lX11 -o Xruns Xruns.c gcc $CFLAGS -lX11 -o Xruns Xruns.c gcc $(rpm --eval '%{optflags}') -lX11 -o Xruns Xruns.c */ #include <unistd.h> #include <X11/Xlib.h> int main(int argc, char* argv[]) { Display* disp = NULL; if(argc > 2) { write(2, "Usage: Xruns [display]\n", 24); } else if(argc == 2) { disp = XOpenDisplay(argv[1]); } else { disp = XOpenDisplay(NULL); } if( disp != NULL ) { XCloseDisplay(disp); return 0; } return 1; } ==== I use it for several stuff, in above context, I'd use: if Xruns; then DIALOG="gdialog" else DIALOG="dialog" fi ... $DIALOG --yesno ... -- "Now, what was I doing before I so rudely interrupted myself?" -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org