File: xgetfile.man

package info (click to toggle)
mctools-lite 970129-14
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,680 kB
  • ctags: 1,659
  • sloc: ansic: 16,036; sh: 167; makefile: 69
file content (332 lines) | stat: -rw-r--r-- 8,971 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
.TH XGetfile 1 "24 Aug 1995"
.UC 4
.SH NAME
xgetfile \- X based versatile file requester
.SH SYNOPSIS
.B xgetfile
[
.B -title
.I title
] [
.B -path
.I path
] [
.B -pattern
.I pattern
] [
.B -file
.I file
] [
.B -popup
] [
.B -quote
] [
.B -exec
.I "command"
] [
.B -format
.I "format-string"
] [
.B -queue
]

.SH DESCRIPTION
.I XGetfile
is a versatile file requester. It pops up a window and lets the user
chose a file with the mouse or the keyboard. When the user selects a
file, several actions are possible. Please see also the
.B EXAMPLES
section below.

By default,
.I XGetfile
sends the selected filename with the complete path to stdout and exits.
This makes the program very useful for shell-scripts.

In addition, you can specify a command which
.I XGetfile
should execute whenever a file is selected. In that case, two modes are
possible. In normal mode, the command is executed with the filename anywhere
in its argument list, and the user will have to wait until the command
finishes before a new filename can be selected.
In queued mode, the user can select several files one after the other without
delay, while
.I XGetfile
will queue them up in a list. Each time a command finishes, the next file
in the list is taken and fed to a new command until the list is empty.
Queued mode is much fun when browsing through a list of audio files (:

.SH OPTIONS
Options offered by
.I XGetfile
are the following:
.TP 0.6i
.B -display \<display\>
Show the control window on the given display.
.TP 0.6i
.B -fn \<font\>
Use this font rather than the default. The given font should be about the
same size like the default font. If not, the window may look ugly.
.TP 0.6i
.B -title \<title\>
Display the given title in the windows title bar instead of just
.I XGetfile.
.TP 0.6i
.B -path \<path\>
Start up with \<path\> as the default search path.
.TP 0.6i
.B -pattern \<pattern\>
Display only files which match \<pattern\>. Usual shell pattern matching
is used. The pattern string may hold several patterns separated by spaces.
Be sure to place the pattern string in double quotes on the commandline to
prevent the shell from parsing them.
.TP 0.6i
.B -file \<file\>
Offer \<file\> to the user as the default selection. The user may still select
another file of course.
.TP 0.6i
.B -popup
Tells
.I XGetfile
to pop up as a transient window directly under the pointer. Depending on your
window manager setup, this means that the requester pops up immediately
instead of letting the user pick a place for the window first. In addition,
the window manager may chose to decorate the window in a different way to
tell the user that the window is not going to live very long.
 However, the actual difference between using -popup or not depends heavily
on your windowmanager.
.TP 0.6i
.B -quote
Print the selected filename in single quotes on exit. This is useful for
filenames which contain weird characters. This option is useless if
.B -exec
is given.
.TP 0.6i
.B -exec \<command\>
Execute command whenever the user selects a file.
.I XPlaycd
won't quit after the user made a selection, but will continue running until
the user selects
.B Cancel
or the program gets otherwise killed.
Up to eight occurances of
.B %s
in \<command\> will be replaced by the selected file. Be sure to place the
command in double quotes on the command line if it contains tabs or spaces.
.TP 0.6i
.B -queue
This option is only useful if a command was specified with the -exec option.
.I XPlaycd
will run in queued mode and won't wait until a command finishes before the
user can select a new file. See examples below.
.TP 0.6i
.B -format \<format-string\>
Allows to format the appearance of each file in the list.
.I \<format-string\>
may be an arbitrary string. The following character sequences are understood:
.TP 0.8i
.B %p
Permissions (e.g. -rw-rw-rw). Default size 10 characters.
.TP 0.8i
.B %n
Filename, default size is rest of the default window width of 40 characters.
If the window is too small to display everything it is expanded and the
default size of %n is set to 20.
.TP 0.8i
.B %s
File size in bytes or <DIR> for directories and <UP-DIR> for parent directory.
Default size 8 characters.
.TP 0.8i
.B %o
The owner of the file. Default size 8 characters.
.TP 0.8i
.B %g
The group of the file. Default size 8 characters.
.TP 0.8i
.B %h
The number of hardlinks of the file. Default size 3 characters.
.TP 0.8i
.B %tm
The file creation time. Default size 12 characters.
.TP 0.8i
.B %tc
The file change time. Default size 12 characters.
.TP 0.8i
.B %ta
The file access time. Default size 12 characters.
.TP 0.6i
\ 
Any other characters are printed as is. It is possible to change the default
size of the above control sequences by putting the size behind the % sign
(e.g. %12n).

A special case is the format string "ll" which is an abbreviation for
"%p\ %h\ %o\ %g\ %s\ %tm\ %n". This is the default format used by ls -l.

Be sure to quote the format string when used on the commandline or in
a shell-script.

The default format string is "%p\ %n\ %s".

.SH "RESOURCES"
.I XGetfile
understands a large number of
.I X11
resources which are listed below. These system wide resources usually sit in
a file called
.B /etc/X11/app-defaults/XGetfile.
Personal resources reside either in 
.B ~/.Xdefaults
or
.B ~/.Xresources
depending on your installation. To put an
.I XGetfile
resource into your personal resource file, prefix it with the word
.B xgetfile.
After editing your personal file, be sure to run
.B xrdb ~/.Xresources
or
.B xrdb ~/.Xdefaults
to make them work. There is no need for a prefix or an invocation of
.I xrdb
if you change the system wide file.

.SH "STANDARD RESOURCES"
Standard
.I X11
resources with their defaults are shown here. For an explanation of the
standard resources please see the
.I X11
dcumentation.

Standard resources are:

.TP 0.6i
.B *title: XGetfile
.TP 0.6i
.B *geometry: 312x300
.TP 0.6i
.B *iconic: off
.TP 0.6i
.B *background: gray80
.TP 0.6i
.B *foreground: black
.TP 0.6i
.B *font: -b&h-lucida-medium-r-normal-sans-*-120-*-*-p-*-*-*
.TP 0.6i
.B *reverseVideo: off
.TP 0.6i
.B *synchronize: off


.SH "SPECIAL RESOURCES"
Special
.I XGetfile
resources are:

.TP 0.6i
.B *brightBorder: gray94
.TP 0.6i
.B *darkBorder: gray40
.TP 0.6i
.B *hilightColor: gray72
These settings are responsible for the 3D-look-and-feel of the program.
Just play with the values to see what they do.
.TP 0.6i
.B *dirFormat: %p %n %s
Directory list format. See -format commandline option for description.

.SH "EXAMPLES"
Here are a few examples for the use of XGetfile.

In a shell script:
.nf
.sp
 SELECTION=`xgetfile -title "Please select a file to load" -path "/tmp"`
.fi

.I XGetfile
will prompt the user for a file and will print it to stdout. The
calling shell will take
.I XGetfile's
output and assign it to the environment variable
.B SELECTION
for further processing.
  If you want to use XGetfile in a script which may be used from graphic
and text based terminals, you should check for the
.B DISPLAY
environment variable and you should provide a text based way to select
a file if
.B DISPLAY
is not set. I find the
.I dialog(1)
program useful for that purpose.


As a versatile frontend to an audio file player with the assumed command
name
.B play
:
.nf
.sp
 xgetfile -title "Please select a file to play" -exec "play %s" -queue"
.fi

.I XGetfile
will take each selected file and execute
.B play \<filename\>
which will play it throught the sound hardware. If the user selects
more than one file, the next sample is played as soon as the previous one
ends.
If you give the command without the
.B -queue
option, the user
.B must
wait until the
.B play
command finishes.
  To understand the difference between queued and normal mode, try something
like this example with and without the
.B -queue
option.


I like it to browse through my selection of samples with the following
short script:
.nf
.sp
 #!/bin/sh
 exec xgetfile -title "Please select a file to play" \\
               -path "/usr/local/lib/sound/fx" -exec "play %s" -queue
.fi


.SH BUGS
This manpage is
.B really
confusing.

.SH "SEE ALSO"
xmixer(1), xplaycd(1)

.SH AUTHOR
Olav Woelfelschneider
   (wosch@rbg.informatik.th-darmstadt.de)

.SH COPYING
Copyright (C) 1994 
 Olav Woelfelschneider
 (wosch@rbg.informatik.th-darmstadt.de)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
 This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.