Spawning Xdialogs from devd...

Gary Newcombe gary at
Tue Apr 29 06:09:06 UTC 2008


This is an X61 laptop, and I'm trying to use the Fn keys to call scripts to do various jobs, while informing users or getting input using Xdialog popups.

Here's an example case. Rebooting the pc if pressing Fn+F4.

notify 10 {
        match "system"          "ACPI";
        match "subsystem"       "IBM";
        action "/root/bin/ $notify ibm";

NOTIFY=`echo $1`
case ${NOTIFY} in
                /home/rep/bin/ &
                MESSAGE="do script"
                MESSAGE="nothing found"


if [ ! -f /tmp/reboot ] ; then
  touch /tmp/reboot
  title="Reboot computer"
  msg="Laptop is rebooting immediately..."
  Xdialog --title "$title" --beep --ok-label "OK" --infobox "$msg" 5 40 2000  > /dev/null 2>&1
  wavplay /home/rep/sounds/shutdown.wav > /dev/null 2>&1
  shutdown -r now
exit 0

>From a fresh boot and startx, pressing Fn+F4 from the window manager (Window Maker) calls the script and executes, but no Xdialog or sound. If I startx and run devd in the foreground with:

sh /etc/rc.d/devd stop && devd -dD\

all is fine, Xdialogs displayed and sound too. Likewise, if I restart devd from an xterm (sh /etc/rc.d/devd restart), all is fine:

However, if I restart devd from an ssh term or another console, only sound, no Xdialogs.

I'm curious to know what is actually going on here. I wouldn't have thought the context from which devd is restarted would make any difference, but clearly it does. Any clues?

Also, does anyone have any ideas how I can call Xdialog to get the windows displayed?

Many thanks,


More information about the freebsd-questions mailing list