How can a script ask for user input under X?
January 23, 2009 2:18 AM Subscribe
What's a good way to make a script pop up an input box under X? Bonus points for blind password entry support and visual integration with XFCE.
I want to make a shell script that requires a small amount of user input --- a username/password pair for an openvpn connection --- that will be launched from a pannel button in XFCE.
I'm looking for a way to pop up an input box, collect the input and return it to my script without going to the trouble of writing a full-blown X application.
I know there are graphical openvpn front-ends out there, as well as ways to store the login credentials, but I keep coming accross this question from time to time and would like to find an reusable solution.
I want to make a shell script that requires a small amount of user input --- a username/password pair for an openvpn connection --- that will be launched from a pannel button in XFCE.
I'm looking for a way to pop up an input box, collect the input and return it to my script without going to the trouble of writing a full-blown X application.
I know there are graphical openvpn front-ends out there, as well as ways to store the login credentials, but I keep coming accross this question from time to time and would like to find an reusable solution.
Oh, and for password entry you would need to use "zenity --entry --hide-text".
posted by DecemberBoy at 2:39 AM on January 23, 2009
posted by DecemberBoy at 2:39 AM on January 23, 2009
Response by poster: Zenity won't do it for me, as it's a Gnome app --- compiling all the gnome dependencies would be almost as much work as rewritting the thing from scratch, not to mention the bloat.
It has however led me to Xdialog, which looks like it will do the trick.
posted by ghost of a past number at 2:43 AM on January 23, 2009
It has however led me to Xdialog, which looks like it will do the trick.
posted by ghost of a past number at 2:43 AM on January 23, 2009
This thread is closed to new comments.
#!/bin/bash
TEXT_ENTRY=`zenity --entry`
echo "You entered $TEXT_ENTRY"
This should be what you need.
posted by DecemberBoy at 2:29 AM on January 23, 2009