1easybashgui(1)                    EasyBashGUI                   easybashgui(1)
2
3
4

NAME

6       EasyBashGUI  -  a  Bash  functions library to create simple interfaces,
7       using Zenity,  GTKDialog,  KDialog,  XDialog,  Dialog,  Whiptail,  etc,
8       depending on the desktop environment.
9
10

SYNOPSIS

12       source easybashgui
13
14

DESCRIPTION

16       EasyBashGUI  helps you to create an interface for your Bash script. The
17       programmer doesn't have to check if the user is using GNOME or KDE,  or
18       even  if the X.org server is running: EasyBashGUI will do the hard work
19       and choose the type of interface which better integrates with the desk‐
20       top environment.
21
22

FUNCTIONS

24       message, ok_message, alert_message [text]
25              Show a simple message dialog to the user.
26
27
28       question [text]
29              Show  a  question  dialog.  The  user can answer either "yes" or
30              "no".
31              The answer is stored in the ${?} variable  (0  is  "yes",  1  is
32              "no").
33
34
35       text   Receives  text  from stdin and displays it in realtime. The text
36              box will be editable by the user (unless you are using  "dialog"
37              as front-end).
38              The   edited   text   is   stored   in   this   temporary  file:
39              ${dir_tmp}/${file_tmp} (look at the examples).
40
41
42       input [number] ...
43              Displays a text entry. The number sets  the  number  of  entries
44              that  should  be  displayed. If the number is 1, then it must be
45              followed by some text, that will be used as a placeholder in the
46              entry.  If  the number is 2 or 3, then it must be followed twice
47              or three times by a label  and  a  placeholder.  The  output  is
48              stored  in  this temporary file: ${dir_tmp}/${file_tmp} (look at
49              the examples).
50
51
52       menu [items]
53              Shows an exclusive choice list. Use one argument per  item.  The
54              choice  is stored in this temporary file: ${dir_tmp}/${file_tmp}
55              (look at the examples).
56
57
58       list [items]
59              Shows a multiple choice list. Use one argument per item. You can
60              put  a  "+" or a "-" at the beginning of the argument to display
61              the item already selected.  The choice is stored in this  tempo‐
62              rary  file, one choice per line: ${dir_tmp}/${file_tmp} (look at
63              the examples).
64
65
66       fselect, dselect <dir>
67              Shows a file/directory selection dialog. If "dir"  is  provided,
68              the  selector will point to that directory by default; otherwise
69              it will point to the current directory.  The choice is stored in
70              this  temporary  file: ${dir_tmp}/${file_tmp} (look at the exam‐
71              ples).
72
73
74       wait_for [text]
75              Shows a waiting dialog or a notification while some  other  code
76              is  running.  It  runs  on  the background, so other programs of
77              functions might be executed while wait_for is running. It can be
78              stopped using terminate_wait_for.
79
80
81       terminate_wait_for
82              Closes the "wait_for" dialog.
83
84
85       wait_seconds [number]
86              Shows a waiting dialog for number seconds.
87
88
89       progress [text] <n_items>
90              Shows a progress bar. The progress value is taken from stdin. If
91              n_items is provided, then the progress bar percentage  increases
92              only when the program receives PROGRESS from stdin. The percent‐
93              age will be 100% when the number of PROGRESS  received  will  be
94              equal to n_items (look at the examples).
95
96
97       adjust [text] [min] [default] [max]
98              Shows  a  scale  (in percent) with the values taken from command
99              line: "max" is the maximum value, "min" is the minimum value and
100              "default" is the default value. The value is stored in this tem‐
101              porary file: ${dir_tmp}/${file_tmp} (look at the examples).
102
103
104       clean_temp
105              Removes temporary files; it should be run  at  the  end  of  the
106              script  (deprecated  since  6.0.0, because "easybashlib" does it
107              automatically).
108
109
110

ENVIRONMENT

112       supermode
113              Forces EasyBashGUI  to  use  a  custom  program  to  render  the
114              dialogs.  Possible  values  are  "yad",  "gtkdialog", "kdialog",
115              "zenity", "Xdialog", "dialog", "none" and "auto" (default). When
116              set  to "auto", it will choose the program depending on the run‐
117              ning desktop environment and on the availability of  these  pro‐
118              grams.
119
120

NOTES

122       Note that ${dir_tmp}/${file_tmp} is not a simple variable, but a tempo‐
123       rary file. Functions that need to store more than one choice (like list
124       and input ) put one choice per line.
125       You  should  use  cat  or similars to get or display the content of the
126       file.
127
128

EXAMPLES

130       message
131              message "This is a sample message"
132              ok_message "This is a success message"
133              alert_message "This is an alert message"
134
135
136       question
137              question "Do you like open-source software?"
138              answer="${?}"
139              if [ ${answer} -eq 0 ]
140                  then
141                  ok_message "You do like it :)"
142              elif [ ${answer} -eq 1 ]
143                  then
144                  alert_message "You don't like it :("
145              else
146                  ok_message "Why didn't you answer?\nSee you..."
147                  exit 0
148              fi
149
150
151       text   echo -e "This is a sample text\nwith more  than  one  line.\nYou
152              can write here whatever you want." | text
153              edited_text="$(0< "${dir_tmp}/${file_tmp}" )"
154
155
156       input (1)
157              input 1 "Write here an IP address"
158              ip_address="$(0< "${dir_tmp}/${file_tmp}" )"
159
160
161       input (2)
162              input  3  "Username" "root" "IP address" "192.168.1.1" "Destina‐
163              tion directory" "/tmp"
164              choices=( $(0< "${dir_tmp}/${file_tmp}" ) )
165              user="${choices[0]}"
166              ip="${choices[1]}"
167              dir="${choices[2]}"
168
169
170       menu
171              menu "Item 1" "Item 2" "Item3"
172              choice="$(0< "${dir_tmp}/${file_tmp}" )"
173
174
175       list
176              list "+Selected item" "-Unselected item" "+Selected item 2"
177              choices="$(0< "$dir_tmp/$file_tmp" )"
178              message "Choices:\n${choices}"
179
180
181       fselect, dselect
182              fselect ~/Desktop
183              file="$(0< "${dir_tmp}/${file_tmp}" )"
184              dselect ~/Documents
185              directory="$(0< "${dir_tmp}/${file_tmp}" )"
186
187
188       wait_for, terminate_wait_for
189              wait_for "Downloading file, please wait..."
190              wget http://www.myfile.com/big_file.tar.gz
191              terminate_wait_for
192              message "Download complete."
193
194
195       wait_seconds
196              echo "Waiting for 10 seconds..."
197              wait_seconds 10
198
199
200       progress (1)
201              for i in 13 27 31 35 40 53 57 63 70 82 83 96 100
202                  do
203                  echo "${i}"
204                  sleep 1
205              done | progress "This is a test progress that shows the percent‐
206              age received from stdin."
207
208
209       progress (2)
210              for char in A B C D E F
211                  do
212                  echo "PROGRESS"
213                  sleep 2
214              done  |  progress  "This test progress calculates the percentage
215              depending on the number of items received  from  stdin  and  the
216              total number passed as an argument."  "6"
217
218
219       adjust
220              adjust "Please set the volume" 30 75 140
221              volume_to_set="$(0< "${dir_tmp}/${file_tmp}" )"
222
223

AUTHOR

225       Written by Vittorio Cagnetta <vaisarger@gmail.com>.
226       This     manpage     has     been     written     by    Davide    Depau
227       <david.dep.1996@gmail.com>.
228
229

REPORTING BUGS

231       If you notice misbehaviors  or  bugs,  please  report  them  to  <vais‐
232       arger@gmail.com>.
233
234
236       Copyright © Vittorio Cagnetta 2010-2013. This program is licensed under
237       a      GNU      GPL      version      3      license      or      later
238       <http://gnu.org/licenses/gpl.html>.
239       This  is  free  software:  you  are free to change and redistribute it.
240       There is NO WARRANTY, to the extent permitted by law.
241
242

SEE ALSO

244       You can find the list of the functions and some  examples  by  visiting
245       EasyBashGUI website <http://sites.google.com/site/easybashgui/>.
246
247
248
249                                 March 1, 2013                  easybashgui(1)
Impressum