[openbox] How to display an openbox <prompt> box laucnh from batch

Anthony Thyssen A.Thyssen at griffith.edu.au
Thu Sep 9 01:15:10 EDT 2010


On Wed, 8 Sep 2010 20:53:23 +0200
MangezDesChips <mangezdeschips at gmail.com> wrote:
| Hello,
| 
| I love the <prompt> openbox Global action. I have a script that checks if
| some devices are mounted before launching audio calculations. If the devices
| are not mounted I want to display a YES/NO prompt box like openbox one. Do
| you know if openbox permit to launch that event from batch ?
| 
| Thanks for help !!
| 
| Kheraud

You can pop up prompt requests like that (and more) using quite a number
of X window utilities.

   Zenity  is a gnome tool that is very common.

         zenity --question --title "Question" --text 'To be of not to be?'     
         echo "the result was $?"
 
   The return status tell you what was selected.
   Has LOTS more features.


   xprompt       String input entry program
   

   xmenu         popup a menu of choices


   XMessage  is another (older) one that also can be used to display files
   or have multiply answers. I use it for a multi-question logout...

   buttons='Poweroff:14,Reboot:13,Restart:12,Logout:11,Cancle:0'

   xmessage -name xlogout -title xlogout \
      -geometry $logout_geometry -fg Gold -bg Navy  -buttons "$buttons" \
      -xrm '*message.borderWidth: 0' \
      -xrm '*message.scrollVertical: Never' \
      -xrm '*Font: -*-new cent*-bold-r-normal--18-*' \
      'Are You Sure?'

   case $result in
    0) # ---- Cancel the Action ----
       ;;                     # just loop -- do nothing
   11) # User specifically asked to logout
       LOGOUT=true
       break
       ;;
   12) # ---- Restart all Clients ----
       xclosedown             # close all client windows
       killall -q gnome-panel # just in case.
       killall -q gconfd-2    # gnome fails to start if this is running
       # If a client was killed without removing the motif drag property then
       # motif clients on the rerun will Bus Error as property does not point
       # to a vaild window.  Ensure it is removed, so this does not happen.
       xprop -root -remove _MOTIF_DRAG_WINDOW 2>/dev/null
       # Now re-start clients and loop
       clients
       ;;
   13) # logout and reboot machine
       REBOOT=true
       break
       ;;
   14) # logout and poweroff
       POWEROFF=true
       break
       ;;
    *) # ---- ErrorExit (1) ----
       break   # Window or Display was killed
       ;;
   esac


Their are many many many such programs out their!!!
Most I have tried out at some point in time.



  Anthony Thyssen ( System Programmer )    <A.Thyssen at griffith.edu.au>
 --------------------------------------------------------------------------
     The human race will never know happiness, as long as the words
     "If only..." can still be spoken.       -- Unknown
 --------------------------------------------------------------------------
   Anthony's Castle     http://www.cit.griffith.edu.au/~anthony/


More information about the openbox mailing list