Rework pseudo-transparency by changing the background grabbing mechanism
[adesklets.git] / doc / adesklets_en.texi
blob963a3f8db84c32828bb480985769973b15ab61f8
1 \input texinfo   @c -*-texinfo-*-
2 @comment %**start of header
3 @setfilename adesklets_en.info
4 @include version_en.texi
5 @settitle adesklets @value{VERSION}
6 @c @syncodeindex pg cp
7 @comment %**end of header
8 @copying
9 This manual is for adesklets (version @value{VERSION}, @value{UPDATED}).
11 Copyright @copyright{} 2004, 2005, 2006 Sylvain Fourmanoit
12 @email{syfou@@users.sourceforge.net}.
14 Various corrections and updates by Mike Pirnat
15 @email{exilejedi@@users.sourceforge.net}.
17 @quotation
18 Permission is granted to copy, distribute and/or modify this document
19 under the terms of the GNU General Public License, Version 2 or
20 any later version published by the Free Software Foundation. 
21 A copy of the license is included in the appendix entitled 
22 ``Copying This Manual''.
24 @end quotation
25 @end copying
27 @c Define useful weblink macro
28 @macro weblink{link}
29 @html
30 <a href="
31 @end html
32 \link\
33 @html
34 ">\link\</a>
35 @end html
36 @end macro
38 @c Define weblink2 macro: a variation on the previous one
39 @macro weblink2{desk,link}
40 @html
41 <a href="\link\">
42 @end html
43 \desk\
44 @html
45 </a>
46 @end html
47 @end macro
49 @dircategory Graphics
50 @direntry
51 * adesklets: (adesklets).      Another desklets container.
52 @end direntry
54 @titlepage
55 @title adesklets
56 @subtitle for version @value{VERSION}, @value{UPDATED}
57 @author Sylvain Fourmanoit (@email{syfou@@users.sourceforge.net})
58 @author Mike Pirnat (@email{exilejedi@@users.sourceforge.net})
59 @page
60 @vskip 0pt plus 1filll
61 @insertcopying
62 @end titlepage
64 @contents
66 @ifnottex
67 @node Top
68 @top adesklets
70 @ifnothtml
71 Follow those links for documentation in other languages
72 (@xref{Top,French version, About adesklets, adesklets_fr,}.).
73 @end ifnothtml
74 @ifhtml
75 @weblink2{[French version],../fr/index.html}
76 @end ifhtml
78 @insertcopying
79 @end ifnottex
81 @menu
82 * About adesklets::
83 * What's new?::
84 * Installing adesklets::
85 * Using adesklets::
86 * Programming adesklets::
87 * Extending adesklets::
88 * Help wanted!::
89 * Frequently asked questions::
90 @ifhtml
91 * Python package documentation::
92 * Perl package documentation::
93 @end ifhtml
94 * Imlib2 documentation::
95 * Packaging GNU Makefile for desklets::
96 * Submitting a desklet::
97 * Copying This Manual::
98 * Open PGP Public Key::
99 @end menu
101 @noindent The latest version of this document can be found online at
102 @weblink{http://adesklets.sf.net/doc/en/}.
104 @noindent Screenshots, source tarballs, downloadable web documentation tarballs, 
105 etc. can also be found on the project home page: @weblink{http://sf.net/projects/adesklets/}.
107 @node About adesklets
108 @chapter What is adesklets?
110 @section Short answer
112 @command{adesklets} is an interactive
113 @weblink2{Imlib2,http://www.enlightenment.org/} console
114 for the X Window System. It provides scripted languages with a clean and 
115 simple way to write great looking, mildly interactive desktop integrated
116 graphic applets (aka ``desklets'').
118 It can also be used as a command line oriented graphic editor, a bit similar
119 to @weblink2{ImageMagick,http://www.imagemagick.org/}, but with different
120 functionality.
122 @section Long answer
124 @command{adesklets} stands for ``another desklets [container]''. It was
125 written as an alternative to other programs such as:
127 @enumerate
128 @item
129 gDesklets (@weblink{http://gdesklets.org/})
130 @item
131 SuperKaramba (@weblink{http://netdragon.sourceforge.net/}).
132 @item
133 GKrellM (@weblink{http://www.gkrellm.net/})
134 @end enumerate
136 Since this is 'a'desklets, others still have plenty of space to start similar
137 projets, from 'b'desklets to 'z', excluding 'g', which is already taken.
139 Seriously though, all those packages are nice. Nevertheless, the first two
140 have very heavy requirements in terms of library dependencies; basically,
141 gDesklets still requires a fair part of the GNOME environment to be installed 
142 (plus specialized libraries such as gnome-python@footnote{A report on this has 
143 been produced; you may find it online in PDF format at 
144 @weblink{http://adesklets.sf.net/verbatim/gdesklets.pdf}.}), while 
145 SuperKaramba needs almost all of the KDE libraries and base environment.
146 This also reflects on performance for the task at hand@footnote{Of course, this
147 is only the author's opinion--and both applications are making big progress on
148 resource efficiency from version to version.}. On the other hand, while GKrellM
149 is significantly lighter (it still depends on GTK+ though), it does not deliver
150 the same experience in terms of ``eye-candiness'' (to the author's taste, of
151 course) or ``scriptability'' than the other two.
153 Thus, @command{adesklets} was born. It provides:
155 @itemize
156 @item
157 a minimal, reliable framework for X Window desklets seamlessly integrated into
158 the desktop, with an easy to use central management for starting, positioning
159 and stopping them.
160 @item
161 a generic, rich and easy to use drawing API similar to gDesklets and
162 SuperKaramba regarding its high visual quality, thanks to the Imlib2 library.
163 @item
164 very limited library dependencies: uses the very good (and lightning fast)
165 Imlib2 library for all graphic-related operations. No window toolkit used
166 whatsoever; the program relies directly on xlib.
167 @item
168 a light, robust, small and portable interpreter potentially usable with all 
169 sorts of scripting languages thanks to a clean, limited and homogenous syntax.
170 As on version @value{VERSION}, support for Python and Perl is provided out of the
171 box. Future support for Ruby would be fairly possible. Feel free to contribute
172 support for your favorite language (@xref{Extending adesklets}.)!
173 @item
174 Minimal disk space, memory footprint and CPU usage. Typically, on glibc 2.3.4
175 Linux 2.6 x86, a unique executable is less than 130 KB on disk, takes less than
176 3 MB of virtual memory per desklet right after initialization, and almost no
177 processor cycles (including cycles from a Python script) when idle; in most cases,
178 it is even slightly less with a Perl script.
179 @end itemize
181 It DOES NOT provide:
183 @itemize
184 @item
185 A sophisticated window API, or even access to widgets besides bare, ugly grey
186 menus.  You clearly cannot write any GUI application with this--only
187 ``desklets''.
188 @item
189 Convoluted mechanisms for
190 script configuration. Script developers are free (or doomed, depending on how
191 you see things) to do whatever they see fit, although default helper routines 
192 are available for Python.
193 @item
194 Support for everything that is not a truly POSIX compliant system. For
195 instance, it would be very surprising if this would ever compile on Cygwin.
196 @item
197 Feature-rich management of user events. @command{adesklets} aims at low
198 resource consumption and reliability; only a small set of events, mainly 
199 pointer-related, are exposed through its API. Do not ask for keyboard events 
200 support or toolkit integration -- it goes against the project goals.
201 @end itemize
203 @node What's new?
204 @chapter What's new?
206 @heading What's new in version 0.6.2
208 This is a bug fix release. It reverts to always using the real root
209 for extracting the background, and it makes the Python module able to
210 recover from commands errors.
212 @heading What's new in version 0.6.1
214 This is a bug fix release. adesklets now compiles without warnings on
215 all gcc 4.x releases, while retaining compatibility with all previous
216 versions of the GNU C compiler. A new test/timing.py framework was
217 also added to help the diagnostic of potential timing issues.
219 @heading What's new in version 0.6.0
221 This is a new minor version release. adesklets now includes support for writing
222 desklets in Perl: many thanks to Lucas Brutschy
223 @email{lbrutschy@@users.sourceforge.net} for his work!
225 @heading What's new in version 0.5.1
226 This is a bug fix release. adesklets now compiles and run on OpenBSD 3.8, 
227 automated FIFO cleanup in case of broken session was added to the frontend, 
228 as well as support of the newest version of e16. The adesklets installer script
229 automated UI fallback was also fixed.
231 @heading What's new in version 0.5.0
232 This is new minor version and bug fix release. It extends the documentation
233 and FAQ on many topics, includes many fixes to the autotools scripts (special 
234 thanks to Steve Langasek  @email{vorlon@@debian.org}), regularises a few 
235 exceptions in the interpreter, adds support to WM-specific contextual menu, 
236 adds a few use cases scripts under @command{test/}, 
237 and adds a brand new adesklets installer (@command{adesklets_installer}) for 
238 automated download and unpacking of desklets.
240 @heading What's new in version 0.4.12
241 This is a bug fix release. It corrects an error with the new distributed 
242 documentation makefile that prevented info files and manual pages from
243 installing right on arbitrary, empty directory trees (thanks to 
244 Bart Kreska for the patch). It also add support for nautilus and KDE >=3.4.1,
245 as well as preliminary support for xffm-desktop and ROX-Filer. It 
246 should rectify a long-standing issue with some desklets failing to
247 complete their initial display. Finally, the documentation FAQ also 
248 got slightly expanded.
250 @heading What's new in version 0.4.11
251 This is a bug fix release. Documentation wize, it brings the french 
252 documentation up to speed with the english version (thanks to Martin 
253 Kirchgessner @email{martin.kirch@@gmail.com} for all his work), and take 
254 the whole documentation source and html 
255 version out of the main package (thanks to this, adesklets is now about 300 KB 
256 lighter). Code wize, this version includes many small fixes for various platforms 
257 -- FreeBSD 7 should hopefully be supported unpatched, manuals have been added 
258 for desklets submission script to please Debian. Yet, the biggest change is 
259 probably the inclusion of an optional shell driver to the interpreter, that
260 ease up the administration of adesklets and the quick adaptation of the code
261 to new windows managers.
263 @heading What's new in version 0.4.10
264 This is a bug fix release. An unwanted partial new feature made is way 
265 into previous release: it caused the contextual menu to stop working 
266 the advertised way (the control key needed to be pressed for the menu to
267 get fired). This release just revert back the change, and add a 
268 configuration-time option, --enable-control-on-context-menu, for
269 those who really wants this behavior.
271 @heading What's new in version 0.4.9
272 This is a bug fix release. It changes the global macro definitions for
273 adesklets to compile without problems on FreeBSD 6.x, corrects an error
274 with debugging flag stripping from the C compiler, and adds a new demo 
275 program about threading.
277 @heading What's new in version 0.4.8
278 This is a bug fix release. It changes the global macro definitions for
279 adesklets to compile without problems on FreeBSD 5.x, and it also adds
280 fake root window detection for KDE, thanks to yogi77, from the forum.
282 @heading What's new in version 0.4.7
283 This is a bug fix release. It removes calls to some C99 math routines not
284 available in earlier BSD's, making the code more portable. It also adds 
285 two new commands to the API for handling the image caching mechanism better.
287 @heading What's new in version 0.4.6
288 This is a bug fix and documentation update release. It corrects many small
289 bugs inside the desklets submission process scripts, makes portability changes
290 to the autoconf structure, adds a new demo scripts in test (widget.py), corrects
291 the xwindow_move_window routine for a small placement bugs on the screen (thanks
292 to man1ed from the forum from providing the patch), and finally adds a new
293 appendix containing a handy online version of the Imlib2 documentation.
295 @heading What's new in version 0.4.5
296 This is a bug fix and documentation update release. It improves the desklets
297 submission process by releasing the full check-in script used by the maintainer.
298 It also solves a bug with window refresh when using user-defined background
299 image and menus; thanks to ZeroDivide for reporting this. Various updates and
300 corrections have also been made to the documentation.
301       
302 @heading What's new in version 0.4.4
303 This is a documentation update release, principally aimed at desklet 
304 authors. It basically includes a new appendix on how to submit a desklet 
305 (including scripted support), and a new subsection on system-wide font
306 detection as well. The FAQ was also expanded to cover this topic.
308 @heading What's new in version 0.4.3
309 This is a documentation update release. Most of the work here was made by 
310 Mike Pirnat @email{exilejedi@@users.sourceforge.net}, who was kind enough 
311 to rectify the base author's deficient english by proofreading this manual 
312 from cover to cover. Thanks Mike! The FAQ was also slightly expanded, and 
313 a new appendix for desklets writer created.
315 @heading What's new in version 0.4.2
316 This is a new bug fix release. It corrects a bug within the Python package
317 that made it not compile on all versions of Python prior to 2.4.0. Thanks to 
318 nucular, from the adesklets forum, for reporting this. It also corrects another
319 minor mmap-related issue in the same package.
321 @heading What's new in version 0.4.1
322 This is a new bug fix release. It secures the use of the optional 
323 @code{adesklets.ConfigFile} class by completely changing 
324 the way config files are imported, thus removing a potential 
325 security exploit. Thanks to Mike Pirnat @email{exilejedi@@users.sourceforge.net}
326 for sharing his concerns on this issue.
328 @heading What's new in version 0.4.0
329 This is a new minor version release. The interpreter now supports
330 internationalization. It can now dynamically work with different
331 character sets on platforms supporting iconv (as standardized in UNIX98), and
332 display them in the right fashion. The Python package was also extended
333 to include an (optional) generic configuration class, hopefully useful
334 to desklets authors.
336 @heading What's new in version 0.3.2
337 This is a documentation update release. Documentation was added for Python
338 programmers, and the FAQ was slightly expanded.
340 @heading What's new in version 0.3.1
341 This is new bug fix release. It just adds support for interruption of time gates
342 by events. This is a feature absolutely required to make some timed effects 
343 possible.
345 @heading What's new in version 0.3.0
346 This is a new minor version release. Portability has been a big concern for us
347 since the beginning; with this version, the package compiles and runs flawlessly
348 on FreeBSD and NetBSD (@xref{Portability}.). Event handling has also been 
349 internally streamlined, and the Python binding was extended to support 
350 dynamic modification of caught events (see @file{test/test_events.py}).
352 The interpreter API now exposes everything the author wanted, 
353 and will probably not be expanded much further; everything is pretty much
354 in place to write any desklet, including animations.
356 @heading What's new in version 0.2.1
357 This is a minor bug fix release which removes a compatibility bug within
358 the GNU history library usage. Thanks to Mike Pirnat 
359 @email{exilejedi@@users.sourceforge.net} for reporting this.
361 @heading What's new in version 0.2.0
362 This is a new minor version release. Support was added for textual variables
363 (string substitution, in fact), and execution of timed preregistered
364 sequences of commands to the interpreter (indirect mode of execution).
365 This gives desklets a way to perform fluid animations. Run the demo script
366 @file{test/fading.py} from the source package to see those features in action.
368 For developers, this version also includes a rewritten, dynamically
369 configurable debug interface to the interpreter able to generate complete 
370 logs on any session.
372 @heading Details
373 See @file{Changelog} for all details.
375 @ifplaintext
376 @c Sets up a marker for automated INSTALL file generation
377 INSTALL_BEG
378 @node Installing adesklets
379 @unnumbered Installing adesklets
380 @end ifplaintext
381 @ifnotplaintext
382 @node Installing adesklets
383 @chapter Installing adesklets
384 @end ifnotplaintext
386 @section Compilation Requirements
388 To compile adesklets from source, you will need:
390 @itemize
391 @item
392 A compiler supporting ANSI C plus variadic macros (about every version
393 of @weblink2{gcc,http://gcc.gnu.org} from 2.7.0 will do - or about
394 everything else published in the last ten years, for that matter)
395 @item
396 @weblink2{X11,http://www.x.org/} libraries and
397 headers@footnote{Except for headless builds, useful
398 for server environments and such; read further for details.}
399 @item
400 Imlib2 1.1.2 and up (the more recent the better; go and fetch it from
401 @weblink{http://sourceforge.net/projects/enlightenment/}); support for
402 PNG is needed by most desklets.
403 @item
404 @weblink2{GNU readline,http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html}
405 @item
406 A reasonably POSIX-compliant system
407 @end itemize
409 @noindent It can also use, if present in the system:
411 @itemize
412 @item
413 @weblink2{fontconfig,http://www.fontconfig.org/}, for automated detection of
414 all usable fonts present in the system
415 @item
416 @weblink2{GNU history,http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html},
417 the faithful complement to GNU readline for command history support: @emph{it is 
418 required to have it for all the desklets using interactive mode of execution}
419 @item
420 iconv library and headers (such
421 as @weblink2{libiconv,http://www.gnu.org/software/libiconv/}), for 
422 internationalization support (dynamic support of extended character sets)
423 @item
424 @weblink2{Python,http://www.python.org} 2.3 and up, if you want Python support
425 (you most probably do -- most desklets are written in this language for now)
426 @item
427 @weblink2{Perl,http://www.perl.org} 5.8.2 and up@footnote{Some older versions
428 carry a version of makemaker that has broken DESTDIR support.}, if you want
429 Perl support (some desklets will be written in Perl)
430 @end itemize
432 Many systems routinely package ``development'' versions of libraries and tools
433 separately (@command{imlib2-devel}, @command{readline-devel},
434 @command{fontconfig-devel}, @command{python-devel}, etc); if this is the case
435 for the target system, those have to be chosen over the ``regular'' versions;
436 you do not need anything but the runtime for Perl though, since the enclosed 
437 package is pure Perl.
439 @section Runtime requirements
441 In addition to the compilation requirements, the optional adesklets 
442 shell frontend, installed by default, will itself 
443 need a few utilities, all expected to minimally comply with POSIX 1003.2 and 
444 1003.2a specifications:
446 @itemize
447 @item a sh-compatible @command{/bin/sh} shell
448 @item a Streaming EDitor (sed)
449 @item test, mkdir, rmdir, sleep, kill and ls
450 @end itemize
452 The @command{xwininfo} and @command{xprop} programs can also be used 
453 by this frontend, if a given fake-root window detection routine 
454 is explicitely invoked. Both XFree86 and X.org (R6 and R7) implementations 
455 of these utilities have been tested. Other programs will eventually be used
456 by specific detection routine: see the frontend source for details.
458 @section Portability Notice
459 @anchor{Portability}
460 This package was built with portability in mind: all vendor-specific
461 extensions were avoided, and specs (ANSI, SVID 3, BSD 4.3, POSIX) were followed
462 in a conservative way. Nevertheless, original development took place on a single
463 Linux system; it is quite probable that adesklets will not compile or work as 
464 expected in some cases. Fixing portability issues is an important concern for us.
466 adesklets has been ported and successfully tested by the developers on many
467 systems. As of version @value{VERSION}, it has been verified to compile and run
468 out of the box on a variety of:
470 @itemize 
471 @item @strong{Kernels/Systems}: Linux (2.2, 2.4, 2.6 series), FreeBSD
472       (4.10, 5, 6 and 7), NetBSD (1.6), OpenBSD (3.8)
473 @item @strong{C Libraries}: (when applicable): glibc (2.1.3 and up), 
474       uclibc (0.9.28)
475 @item @strong{Compilers}: gcc (2.95.2, whole 3 serie, 4.0.2, 4.1.0)
476 @end itemize
478 Moreover, adesklets itself is fully architecture independent, although 
479 Imlib2 is further optimized for the x86 and amd64. It is routinely used on 
480 x86, amd64 and ppc machines by the author.
482 At the time of writing, adesklets is already integrated in ports collections of
483 many BSD and software libraries of linux distributions. For reference, let's 
484 mention:
486 @itemize
487 @item Debian package: @weblink{http://packages.debian.org/unstable/x11/adesklets},
488 maintained by Bartosz Fenski @email{fenio@@debian.org} (also in testing 
489 and stable branches).
490 @item FreeBSD port: @weblink{http://www.freshports.org/deskutils/adesklets/},
491 maintained by Roman Bogorodskiy @email{novel@@freebsd.org}.
492 @end itemize
494 Did you try to run the package on something not listed here?
495 Let us know, especially if it did not work.
497 @section Software download
499 The current version of the software (as a source bzip'ed tarball) can be found
500 on the SourceForge project page: @weblink{http://sf.net/projects/adesklets/}
502 You can extract it from the console with @command{tar}. As of version
503 @value{VERSION}, the command line would be:
505 @example
506 tar xvjf adesklets-@value{VERSION}.tar.bz2
507 @end example
509 or, if your installed version of @command{tar} does not support
510 filtering archives through bzip2:
512 @example
513 bzcat adesklets-@value{VERSION}.tar.bz2 | tar xv
514 @end example
516 @section Verifying Software Integrity (optional)
518 As of adesklets @value{VERSION},  you can also
519 download from @weblink2{SourceForge,http://sf.net/projects/adesklets/} an 
520 ascii-armored detached signature named 
521 @command{adesklets-@value{VERSION}.tar.bz2.asc}, that you can match
522 against the author's Open PGP public key (@pxref{Open PGP Public Key},
523 in appendix) to assert the package integrity. For instance, with
524 @command{GnuPG} (@weblink{http://www.gnupg.org/}), you would use:
526 @example
527 gpg --verify adesklets-@value{VERSION}.tar.bz2.asc adesklets-@value{VERSION}.tar.bz2
528 @end example
530 You can also get the public key for @email{syfou@@users.sourceforge.net}
531 from various public key servers such as @weblink{http://www.keyserver.net/} or
532 @weblink{http://pgp.mit.edu/}. Feel free to contact the author directly if you
533 want to authenticate the key further.
535 @section Compilation and Installation:
537 adesklets provides the usual autoconf/automake scripts of GNU packages.
539 Therefore, in most cases, installation follows the normal three steps:
541 @enumerate
542 @item
543 `cd' to the directory containing the package's source code and type
544 `./configure' to configure the package for your system.  If you're
545 using `csh' on an old version of System V, you might need to type
546 `sh ./configure' instead to prevent `csh' from trying to execute
547 `configure' itself.
549 Running `configure' takes awhile.  While running, it prints some
550 messages describing which features it is checking for.
551 @item
552 Type `make' to compile the package.
553 @item
554 Type `make install' to install the programs and any data files and
555 documentation.
556 @end enumerate
558 You can remove the program binaries and object files from the
559 source code directory by typing `make clean'.  To also remove the
560 files that `configure' created (so you can compile the package for
561 a different kind of computer), type `make distclean'.
563 @section Compilers and Options:
565 Some systems require unusual options for compilation or linking that
566 the `configure' script does not know about.  You can give `configure'
567 initial values for variables by setting them in the environment.  Using
568 a Bourne-compatible shell, you can do that on the command line like
569 this:
571 @example
572 CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
573 @end example
575 @noindent Or on systems that have the `env' program, you can do it like this:
577 @example
578 env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
579 @end example
581 @section Optional Features:
583 adesklets comes with a few optional features you can select or not
584 from the `configure' script. Type:
586 @example
587 ./configure --help
588 @end example
590 @noindent for a complete, short description. Here are a few interesting ones:
592 @itemize
593 @item
594 You may choose to compile adesklets without X support at all
595 (@command{--without-x}).
596 You will get a version that is obviously not suited for
597 desklets rendering, but still good for command line image manipulation
598 @item
599 You can remove support for some others packages as well:
600 @command{--without-history}, @command{--without-fontconfig}
601 @item
602 The shell frontend can be avoided altogether using:
603 @command{--disable-frontend-shell-driver}
604 @end itemize
606 @node Using adesklets
608 @chapter Using adesklets
610 @ifplaintext 
611 INSTALL_END
612 @end ifplaintext
614 @section ... As a desklets container
616 By itself, adesklets does little: it only provides what is needed to
617 do more! You either need to tell it what to do by passing it commands
618 (see the next section) or you need other scripts (the desklets)
619 that will drive it for you.
621 @noindent Right now, many desklets exist: 
622 you may find them on adesklets web page as separate downloads:
623 @weblink{http://adesklets.sf.net/desklets.html}.
625 @subsection Add a new desklet to your X display
626 To add a new desklet script, simply:
628 @enumerate
629 @item
630 Download its tarball and unpack it somewhere in your home directory.
631 @item
632 Look at the included README file; special requirements or instructions
633 will be given. Usually, all you have to do is to get adesklets installed,
634 your X server running, then launch the executable script file from the
635 base directory.
636 @end enumerate
638 From adesklets 0.4.11, Python-based desklets will ask you explicitely if you
639 want to register or to test them. They will also support a @command{--help}
640 switch, that you can use to know the useful options you can pass to the
641 adesklets interpreter when testing (fake root window detection, etc.). Same goes
642 for Perl-based desklets.
644 @noindent Please note that:
646 @itemize
647 @item
648 Launching the same desklet script more than once will start multiple instances 
649 of it.
650 @item
651 On multi-head displays, scripts will be launched on their inherited default 
652 screen.  (For instance, if you do nothing special, calling a script from an
653 xterm on screen 1 will launch the desklet on screen 1).
654 @end itemize
656 @noindent Most of the time, desklets scripts are made to run as long as you
657 do not tell them to quit. The user has total control of starting, stopping,
658 restarting (when possible), and positionning the desklet (using the context menu, 
659 always available by right-clicking on the desklet). The desklet has 
660 no control over those operations.
662 @noindent Those few user settings are stored in the @file{$HOME/.adesklets}
663 file. Usually, you do not want to edit this file yourself.
664 If you do, make sure no instances of @command{adesklets} are running at
665 the same time.
667 @unnumberedsubsubsec Alternative to manually downloading the desklets
669 Since adesklets 0.5.0, you have a new @command{adesklets_installer}
670 script available if you installed the package with Python support: it provides
671 you with automated management of your desklets under @file{$HOME/.desklets} 
672 through a simple interactive interface. From a real or pseudo-terminal, 
673 invoke:
675 @example
676 adesklets_installer
677 @end example
679 Or, if you have the adesklets shell frontend:
681 @example
682 adesklets -i
683 @end example
685 It is able to detect what desklets you have, and to download, check integrity and
686 unpack new ones based on the information contained in 
687 the official desklets atom feed (@weblink{http://adesklets.sf.net/desklets.atom}).
688 Of course, it is still your duty to manually configure and launch them from there.
690 The @command{adesklets_installer} script comes with three user interfaces:
691 a Tk interface (the default, based on the Tkinter module), a curses interface as
692 well as a raw interface, that just assumes a trivial terminal is present 
693 (characters-based @file{stdin} and @file{stdout} streams). By default, the script
694 will try to present to the user the first it can in the given order, then fallback
695 to the next if it doesn't work @footnote{The raw interface should always work at the end of the day.},
696 but you can select one as well from the command line. See:
698 @example
699 adesklets_installer --help
700 @end example
702 for the invocation details.
704 @unnumberedsubsubsec Special notes on system fonts
706 @emph{You may safely skip this section if you do not intend to use
707 non-supplied fonts with adesklets.}
709 Provided your system supports fontconfig (@weblink{http://www.fontconfig.org/})
710 and adesklets was compiled without using @code{--without-fontconfig} (compiling
711 with fontconfig support is the default; @xref{Installing adesklets}.), all the
712 TrueType fonts present in your system are available for use with adesklets.
713 At initialization time, adesklets with fontconfig support compiled in will go
714 through all the fonts detected on your system to identify all the TrueType 
715 fonts. See your fontconfig documentation on how to set up your application
716 fonts access properly (@xref{Frequently asked questions}, for some fontconfig
717 debugging hints). It's also good to know that adesklets' package includes a
718 copy of Bitstream's Vera font; all users can rely on @command{adesklets} 
719 having at least this font available at all time.
721 @unnumberedsubsubsec Special notes on internationalization
723 @emph{You may safely skip this section if you do not intend to use
724 extended charaters within your desklets.}
726 If your system includes @command{iconv} support (@xref{Installing adesklets}.),
727 you should be able to use any character from any charsets your system 
728 knows about for displaying text, either inside a desklet or in its menus,
729 provided you have appropriate TrueType fonts (i.e. TrueType fonts containing
730 those character representations)@footnote{For instance, Bitstream's Vera font 
731 included with @command{adesklets} contains glyphs for practically all Latin-1
732 (ISO-8859-1) characters.}. 
734 Nevertheless, when using extended (outside 7-bit @code{ASCII}) characters, 
735 you need to make sure your local GNU readline settings do not interfere. These
736 three parameters should be set as indicated below in the appropriate 
737 @file{initrc} file@footnote{Please refer to your GNU readline documentation}:
739 @example
740 set input-meta on
741 set convert-meta off
742 output-meta on
743 @end example
745 If you do not want to adapt your GNU readline settings, you can also pass the
746 @code{--enable-force-extended-characters-input} switch to the @code{configure}
747 script when configuring the package from source, which will cause those three
748 variables to always be appropriately overriden internally by the interpreter.
750 Of course, you will also need desklets built to use those extended characters.
751 At the time of writing, all non-contributed Python desklets support them; for 
752 those, the charset can be set by the user in the configuration file, when it 
753 exists@footnote{When it does not exist, it means the desklet does not need 
754 internationalization anyway}; users merely have to set the 'coding' line 
755 appropriately@footnote{See @weblink{http://python.fyxm.net/peps/pep-0263.html}
756 if you need details.}.
758 For instance, for using ISO Latin-1 characters, one should use something 
759 similar to:
761 @example
762 # -*- coding: ISO-8859-1 -*-
763 @end example
765 as the first or second line in the Python desklet configuration file@footnote{
766 Obviously, such a configuration file needs to be saved using ISO Latin-1 
767 encoding or any subset of it, such as @code{ASCII}.}. 
769 Finally, please note that if your platform does not support iconv,
770 you should always leave the coding parameter to @code{ASCII}, otherwise
771 you will get fatal errors such as @code{charset conversion not compiled in}
772 from the desklets.
774 @subsection Restore previously running desklets on new X session
775 Invoking @command{adesklets} without any arguments@footnote{A word of warning: 
776 by default on adesklets 0.4.11 and up, you @emph{need} to employ some flags if 
777 your Window Manager uses a fake root window. @xref{Frequently asked questions}.}:
779 @example
780 adesklets
781 @end example
783 @noindent is enough to restart all desklets that were running the
784 last time you killed the X server (in this mode, @command{adesklets}
785 will exit quickly by itself: there is no need to run it in the
786 background. adesklets does not use a daemon; each applet will fork a 
787 standalone @command{adesklets} interpreter as a child process). 
788 Invoking @command{adesklets} when desklets are already running
789 will cause them to be killed before the creation of new 
790 instances@footnote{Both @command{adesklets} process and their immediate parents
791 will be sent a @command{SIGKILL} signal.}.
793 @noindent If you plan on using desklets on a regular basis, you should put
794 the previous @code{adesklets} command somewhere in your X session
795 initialization.  I cannot tell you where with precision, as it varies greatly
796 from system to system. Have a look at: 
797 @weblink{http://www.google.ca/search?q=''x window''+startup} for general help.
799 Since adesklets 0.4.11, a more complete shell based frontend is available
800 to you, if you installed it (which is the default). It gives you a more
801 feature-complete set of options. Run
803 @example
804 adesklets --help
805 @end example
807 To see what is at your fingertips. Please note that since adesklets 0.4.11, you 
808 usually @strong{must} specify on the command line proper flags if you need 
809 fake root window detection (@xref{Frequently asked questions}.).
811 @section ... As a command-line graphic editor
813 You can also use adesklets as a command-oriented graphic editor.
814 If you type, in a console:
816 @example
817 adesklets :
818 @end example
820 @noindent You will get something similar to:
822 @anchor{prompt}
823 @example
824 adesklets 0.1.0 (Fri Jan 28 19:09:13 EST 2005), on Linux 2.6.10
825 [gcc 3.4.3 20041125 (Gentoo Linux 3.4.3-r1, ssp-3.4.3-0, pie-8.7.7)]
826 Press TAB for hints.
827 0 >>> _
828 @end example
830 @noindent The last line is a prompt. It tells you you are ready
831 to enter command number 0. As of adesklets @value{VERSION}, you have around
832 150 commands at your fingertips. Thanks to GNU readline, a lot of
833 autocompletion hooks are present, giving you an easy way to look around. 
834 Press TAB while typing a  command name or a command's first argument, and 
835 useful information will be displayed. @xref{primer,,an adesklets's primer}, 
836 for more info.
838 @node Programming adesklets
839 @chapter Programming adesklets
840 @section An adesklets' primer
841 @anchor{primer}
843 As previously stated (@xref{About adesklets}.), adesklets is basically an
844 interactive Imlib2 console, with one or two aditionnal features:
846 @itemize
847 @item
848 When an X display is present, automated management of a single window
849 @item
850 Automated support for pseudo-transparency
851 @item
852 Management of long-running applets
853 @end itemize
855 @noindent So let's start a typical interactive session to see what
856 happens. Under X, open a terminal, and type:
858 @example
859 adesklets :
860 @end example
862 @noindent As in last section (@xref{prompt,,'Using adesklets as a command-line
863 graphic editor'}.),
864 you will get a prompt. Now, enter the command '@code{images_info}'. You should
865 get on stdout:
867 @example
868 2 images
869 id 0 width 1 height 1 alpha 1 filename (null)
870 id 1 width 1 height 1 alpha 1 filename (null)
871 command 0 ok: images_info
872 @end example
874 @noindent This tells you that you have two images: image 0 and image 1, each
875 1x1 pixels. Those are the only images you can never destroy nor do any
876 operations you want with (resize them independently, flip them diagonaly, etc.)
877 Why is that?
879 @itemize
880 @item
881 Image 0 is the foreground image. By default, it is the only image that is
882 displayed on the single window that @command{adesklets} manages.
883 @item
884 Image 1 is the background image. By default, it always contains the content
885 of the root window (the desktop) directly below the window.  Unless we set it
886 to be otherwise, it is always updated when the user moves it, when you resize
887 it, when your wallpaper changes, etc.
888 @end itemize
890 @noindent But where is this window? Well, right know, it is only 1x1 pixels,
891 and it is not shown@footnote{``Mapped'' in X Window lingo} on the screen.
892 So let's resize it to 100x100 pixels: type '@code{window_resize 100 100}'.
893 Now, if you re-enter the command '@code{images_info}', you will get:
895 @example
896 2 images
897 id 0 width 100 height 100 alpha 1 filename (null)
898 id 1 width 100 height 100 alpha 1 filename (null)
899 command 2 ok: images_info
900 @end example
902 @noindent The foreground and background images have been resized to
903 100x100 pixels.  Moreover, the background image has been updated to contain
904 a new image of the background. Now, let's make this window visible. Type two 
905 commands: '@code{window_reset managed}' and then '@code{window_show}'.
907 @noindent The first command tell adesklets to let your window manager
908 ``manage'' your window (the default is not to); it means the window gets
909 decorated, and you can interactively change its visibility@footnote{An
910 ``unmanaged'' window is very useful for scripted desklets: it looks like
911 it is part of the root window as it can be made to never go on top, and to stay
912 mapped when workspaces are switched.}. The second command shows our 100x100 
913 window. So far, it's nothing too impressive--just a black 100x100 square with a
914 titlebar and fixed-size borders.
916 @noindent As mentioned above, only image 0 (the foreground) is displayed by
917 default. Now, type: '@code{window_set_transparency 1}'. Wow! We see the
918 root window below! With ``window transparency'' on, the image 1 (background)
919 is first copied onto the window, then image 0 (foreground) which is purely
920 transparent black, is blended onto it@footnote{Well...Not quite. Actually,
921 there is a buffer involved for performance, but the operation is logically
922 equivalent to this description.}.
924 @noindent It is time to say a word about colors. Remember, adesklets is an 
925 Imlib2 console. Thus, as with Imlib2@footnote{Keep your Imlib2 documentation 
926 nearby; it is very handy! @xref{Imlib2 documentation}.}, colors are 
927 always true 32 colors, RGBA encoded, with eight bits (0 to 255) per channel,
928 including an alpha channel for transparency. Palette conversion and such will 
929 automatically take place if your screen depth is less than that, so you do not
930 need to bother with that. If you type: '@code{context_get_color}', you will get:
932 @example
933 command 0 ok: context color 255 255 255 255
934 @end example
936 @noindent Imlib2 is a kind of state machine; as such, it comes with a
937 ``context'' that remembers a series of attributes it will use in its future 
938 operations. For instance, we now know the color it will use as long as we do not
939 modify it is opaque pure white (red=255, blue=255, green=255, alpha=255). 
940 If we type: '@code{context_get_image}', it returns:
942 @example
943 command 0 ok: context image 0
944 @end example
946 @noindent Which means all window operations we perform are made directly on
947 the forgeground image. So, let's draw a filled semi-transparent magenta 
948 rectangle on the foreground. Commands could be: 
949 '@code{context_set_color 255 0 0 200}' and 
950 '@code{image_fill_rectangle 25 25 50 50}'. Neat, isn't it?
952 @noindent If you are used to Imlib2 programming, you will have noticed
953 by now those last few commands look quite familiar. This is pretty normal;
954 most of Imlib2 C functions are presented as corresponding 'commands' in
955 adesklets. This way, adesklets' command '@code{image_fill_rectangle}'
956 follows the same semantic as Imlib2's '@code{imlib_image_fill_rectangle()}'
957 function, the command '@code{context_set_color}' functions just like
958 '@code{imlib_context_set_color()}', etc. The only two significant (and
959 systematic) differences are that whenever you would use an 
960 '@code{Imlib_Something}' object in C, you use an integer ID with adesklets,
961 and on the semantic of the '@code{imlib_free_something()}' functions that need
962 to be given an ID instead of freeing the context selected object of this type.
964 @noindent This is pretty easy to illustrate. Let's load the ``Vera'' font 
965 included with adesklets at a 20pt size, set it as default font, and write in 
966 pure opaque white ``Hello'' diagonally on the foreground image from the top left
967 corner before unloading the font. It would look like:
969 @example
970 6 >>> load_font Vera/20
971 command 6 ok: new font 0
972 7 >>> context_set_font 0
973 command 7 ok: context_set_font 0
974 8 >>> context_set_direction text_to_angle
975 command 8 ok: context_set_direction text_to_angle
976 9 >>> context_set_angle 45
977 command 9 ok: context_set_angle 45
978 10 >>> context_set_color 255 255 255 255
979 command 10 ok: context_set_color 255 255 255 255
980 11 >>> text_draw 0 0 Hello
981 command 11 ok: text_draw 0 0 Hello
982 12 >>> free_font 0
983 command 12 ok: free_font 0
984 @end example
986 @noindent If you look at your imlib2 documentation, you will immediatly notice
987 the two differences we just talked about:  all references to the font Vera/20
988 are made through an integer ID (0 here), and the '@code{free_font}' command, 
989 unlike the corresponding '@code{imlib_free_font()}' function, is called with
990 the font ID as an argument instead of the context font.
992 @noindent Now let's say you want to save you resulting image; not a problem!
993 Let us type: '@code{save_image out.png}', and the foreground is saved in the
994 file ``out.png'' in the current working directory@footnote{For this to work, 
995 you need to have your Imlib2 installation properly configured for using libpng,
996 or you could receive a ``no loader for file format'' error.}. Now, just for 
997 the sake of it, let us exit adesklets, and start another interactive session
998 to see if we can reload this image. Just type in the ``@code{quit}'' command or
999 press ^D (Control D: end of file). Then your new session should look 
1000 something like:
1002 @example
1003 0 >>> window_resize 100 100
1004 command 0 ok: window_resize 100 100
1005 1 >>> window_reset managed
1006 command 1 ok: window_reset managed
1007 2 >>> window_set_transparency 1
1008 command 2 ok: window_set_transparency 1
1009 3 >>> load_image out.png
1010 command 3 ok: new image 2
1011 4 >>> blend_image_onto_image 2 1 0 0 100 100 0 0 100 100
1012 command 4 ok: blend_image_onto_image 2 1 0 0 100 100 0 0 100 100
1013 5 >>> window_show
1014 command 5 ok: window_show
1015 6 >>> free_image 2
1016 command 6 ok: free_image 2
1017 @end example
1019 @noindent Of course, we wanted to visualize the result; this is why we
1020 emitted commands '@code{window_reset}', '@code{window_set_transparency}'
1021 and '@code{window_show}'; they are not otherwise useful. The command
1022 '@code{blend_image_onto_image}' comes straight from Imlib2 once again;
1023 it takes the newly created image 2 from the third command and blends it
1024 onto the context image (image 0, foreground by default), for its coordinates
1025 (0,0) to 100x100 pixels farther, and puts it on the rectangle starting at (0,0)
1026 of size 100x100 pixels of image 0. It is finally good to note that, with
1027 adesklets, there is always an image in Imlib2 context: whenever you try to
1028 free the current image, the image context is always reset to the foreground 
1029 image.
1031 @noindent OK, so it is almost the end of this primer... From there you should
1032 play around with adesklets.  It is pretty straightforward to use if you are 
1033 already familiar with Imlib2. If you are not, your best resource is certainly 
1034 having Imlib2 documentation not far away. :-)
1036 @noindent Some last tips:
1038 @itemize
1039 @item
1040 If you get tired of typing, and typing, do not forget you have autocompletion:
1041 'TAB' your problems away!
1042 @item
1043 If you want to have hints on how to do something, you have a built-in
1044 '@code{help}' command.
1045 @item
1046 If you are working out a series of commands, things are not working
1047 and all this interactive usage it getting tiresome:
1048 @enumerate
1049 @item
1050 Use the '@code{history}' command to output your current session to a
1051 file@footnote{For this to work, you need to have GNU history when
1052 building adesklets.}.
1053 @item
1054 Use the '-f' switch with adesklets to get commands from a file instead
1055 of the console tty.
1056 @item
1057 If you try to visualise something, insert a '@code{pause}' command at the
1058 end of the script to freeze the interpreter.
1059 @item
1060 All strings from a pound sign '#' to the end of a line will get discarded,
1061 allowing you to write comments.
1062 @end enumerate
1063 @end itemize
1065 @noindent Here is an example:
1067 @example
1068 #!/usr/bin/env adesklets -f
1070 # Make the window 'managed'
1072 window_reset managed
1074 # Resize the window to 100x100 pixels
1076 window_resize 100 100
1078 # Show the window, then freeze for 10 seconds before exiting
1080 window_show
1081 pause 10
1082 @end example
1084 @noindent You will just have to make this script executable and run it. As
1085 usual, output from the commands will get printed to stdout.
1087 @itemize
1088 @item You could also use the @code{play} command. This two-arguments command
1089 gives you a way to replay any sequence of commands from history, using the 
1090 command number of the first and last command as parameters.
1091 @end itemize
1093 @section Real programming with adesklets: writing desklet scripts
1095 When you are ready for real work@footnote{:-)}, you might want to use a real
1096 scripted language instead of the raw @command{adesklets} interpreter we used in
1097 the primer; you never know when just having variables could come in handy. At
1098 the time of this writing (@value{UPDATED}), Python and Perl 5 support is
1099 included in adesklets package @footnote{adesklets was written to be easily used
1100 from a variety of interpreted languages -- do not hesitate to propose your help
1101 if you want to bring support for your language of choice!}.
1103 @subsection General tips for programmers
1104 @anchor{generaltips}
1105 A really useful feature of the @command{adesklets} interpreter 
1106 is its ability to produce a full trace of its session (commands, events and
1107 special messages), either on @code{stdeerr} or as a log file, independently
1108 of what is driving it. To have access to this feature, one must:
1110 @enumerate
1111 @item Configure the package from source, passing along the @code{--enable-debug}
1112 switch to @code{configure}.
1113 @item Export the @code{ADESKLETS_LOG} variable in the environment if 
1114 the session's output should to be stored in files instead of printed
1115 to @code{stderr}@footnote{Printing to @code{stderr} will break most bindings, 
1116 and should therefore be used mainly when invoking the interpreter directly 
1117 from the console.}. It should be an absolute filename prefix which the
1118 interpreter, inheriting from the environment, can use to create complete file
1119 names to write to.
1120 @end enumerate
1121 From there, it is possible to read complete chronological session logs; used
1122 correcly, it is very useful for debugging purposes. You can use it in
1123 conjunction with the @code{echo} command to set easy to find log
1124 points@footnote{A few packaging systems, such as the ebuilds in Portage through
1125 the @code{debug} USE flag, does support this feature automatically.}.
1127 @subsection adesklets and Python 
1128 @unnumberedsubsubsec Python usage example
1129 From Python, things are not very different than from the interpreter.
1130 Commands have been wrapped into Python functions, and an @code{Events_handler} 
1131 class has been made public to handle asynchronous feedback from the
1132 interpreter.  Let's have a look at the @file{test/test.py} script from the
1133 source tarball of version @value{VERSION}:
1135 @verbatiminclude ../test/test.py
1137 That's it! Twenty-six lines of Python code, and we have a perfectly functionnal
1138 desklet. I think things are pretty self-explanatory; have a look at the
1139 Python online help for @code{adesklets}, @code{adesklets.commands} and 
1140 @code{adesklets.Events_handler} for a good, complete explanation
1141 @ifhtml
1142 (@xref{Python package documentation}.)
1143 @end ifhtml
1144 .  All we do here is:
1146 @enumerate
1147 @item
1148 Import the @code{adesklets} package:
1149 this automatically instantiates a child @command{adesklets} process and sets up
1150 all communications.  When the package initialization returns without raising
1151 any exception, it means the interpreter is up and ready to accept commands.
1152 @item
1153 Subclass @code{adesklets.Events_handler} and redefine the methods invoked
1154 for the events we are interested in (all other events are not just ignored,
1155 they are not generated).
1156 @item
1157 Instantiate an object of this class, and put it on hold indefinitely
1158 @footnote{This last step is not mandatory; the script may very well continue,
1159 but it should be written so that it supports signal interruptions. See
1160 @code{help(adesklets.Events_handler)} for further explanations}.
1161 @end enumerate 
1163 @unnumberedsubsubsec Gotchas: a bit more about object IDs
1164 @anchor{objectids}
1165 All adesklets objects (fonts, images, color ranges, polygons, etc), are stored 
1166 in stacks (one stack per object type). Python's ID's are nothing more than the 
1167 initial position of given objects inside the relevant stack, and therefore 
1168 will become invalid if an object of the same type below them gets freed.
1170 For instance, if we start with a clean state, all we have in the stack of 
1171 images is the window's foreground (ID 0) and background (ID 1). 
1172 When someone creates two other images from Python like so: 
1173 @example
1174 im_1 = adesklets.create_image(10,10)
1175 im_2 = adesklets.create_image(10,10)
1176 @end example
1177 @noindent We get @code{im_1==2}, and @code{im_2==3}. Whenever someones does:
1178 @example
1179 adesklets.free_image(im_1) 
1180 @end example
1181 @noindent The stack starts collapsing, and what was once image 3 (@code{im_2}) 
1182 is now image 2, and @code{im_2} is now an invalid reference. This clearly means 
1183 that invoking:
1184 @example
1185 adesklets.free_image(im_2) 
1186 @end example
1187 @noindent would generate an @code{image out of range} error message.
1189 @unnumberedsubsubsec Special subject: animations
1190 @anchor{animations}
1192 @command{adesklets} now includes an indirect mode of execution and textual 
1193 variables (non-recursive textual replacements, to be precise) as well. 
1194 This means desklets writers have what is needed to create precisely-timed
1195 animations. You can find an easy-to-follow example in @file{test/fading.py}.
1196 A somewhat more involved use of these features is also made in the @code{yab}
1197 desklet. To realize an animation from Python, one should:
1199 @enumerate
1200 @item @strong{Record} a sequence of commands 
1201 (we will call it a macro command, or macro for now on). From Python, this
1202 involves toggling on indirect mode using the @code{adesklets.start_recording()}
1203 function, emitting an undetermined number of @command{adesklets} commands,
1204 then toggling back into normal mode (direct execution) with 
1205 @code{adesklets.stop_recording()}. Of course, no command is ever evaluated
1206 while the interpreter is in indirect mode; commands are only stored in the
1207 history for future replay.
1208 @item @strong{Set up} whether the to-be-replayed sequence of commands can be
1209 interrupted by events or not, using the @code{adesklets.play_set_abort_on_events()}
1210 function. The high-level @code{adesklets.Events_handler::set_events()} method
1211 can also be used to dynamicaly change what events are caught. See 
1212 @file{test/test_events.py} for an example.
1213 @item @strong{Set up} the variables used within the recorded macro using the 
1214 @code{adesklets.set()} function, very similar to its Bourne shell homonym.
1215 @item @strong{Play} the macro using the @code{adesklets.play()} function.
1216 @end enumerate
1218 Here are a few additional remarks:
1219 @itemize
1220 @item Precise timing during replay is achieved through the @code{time_gate}
1221 command. This works very simply: every time a macro replays, adesklets
1222 records its starting time, and whenever a @code{time_gate} command is
1223 encountered during the replay, it waits for the number of seconds given as
1224 an argument to @code{time_gate} to run out. For instance, specifing
1225 @code{time_gate 0.1} in a macro will make any subsequent commands within the
1226 macro not execute before the macro has run for at least a tenth of second.
1227 @item Variable expansion always occurs just before command execution, regardless
1228 of current interpreter mode (direct or indirect). All sequences of characters
1229 not containing spaces directly following a single '$' will get replaced with
1230 the corresponding variable content (previously configured using @code{set}).
1231 If no matching variable is found, the sequence is simply discarded.
1232 @item All macro commands replayed through the @code{play} command are always 
1233 atomic for the driving desklet, as are any other non-macro commands. 
1234 Simply put, it means no event will ever get generated while a macro is replayed;
1235 they will all get issued right after the @code{play} command returns.
1236 @item As usual, the adesklets interpreter is stateful for indirect mode related 
1237 states and variables. You do not have to set up the @code{set_abort_on_events}
1238 flags or variable every time you want to call a macro, only if something
1239 needs to be changed since the last call.
1240 @item The main use of high-level @code{adesklets.Events_handler::set_events()}
1241 is to stop the catching of specific events during macro playback, so the macro
1242 can be interrupted only in specific circumstances. Of course, all events
1243 generated before the call to the method will not be lost but queued, and
1244 appropriate event methods will be called later, provided the handlers are set 
1245 back once the macro playback completes.
1246 @item Did we mention that it is a bad idea to do any of this from an unprotected
1247 place? Well, it is. Don't forget to use @code{adesklets.Events_handler::block()}
1248 and @code{adesklets.Events_handler::unblock()} around all animation-related code
1249 if you have an object of a child class of @code{adesklets.Events_handler}
1250 instantiated.
1251 @end itemize
1253 @unnumberedsubsubsec Configuration and internationalization
1255 Let us just mention here that from @command{adesklets} 0.4.0, the
1256 @code{adesklets.utils} module now includes an optional 
1257 @code{ConfigFile} class that can be easily reused by desklets authors 
1258 to add an easily extendable configuration facility to their 
1259 code@footnote{You can look at any non-contributed configurable desklet for 
1260 example usage.}
1261 @ifhtml
1262 (@xref{Python package documentation}.)
1263 @end ifhtml
1264 . The class also handles internationalization automatically by default, 
1265 setting the charsets according to users' needs. Charset usage can of course 
1266 be determined or changed at any time using the @code{adesklets.get_charset()}
1267 and  @code{adesklets.set_charset()} functions. The 
1268 @code{adesklets.utils.ConfigFile} class also has a @code{charset} attribute one
1269 can examine to determine the user's preference. When using this class, one
1270 should  note that an 'ASCII' charset is considered the default, and will not 
1271 toggle any conversion. This way, users on platforms not supporting iconv will 
1272 always be able to use @command{adesklets} without internationalization support.
1274 @unnumberedsubsubsec Final words
1276 @noindent Finally, let us mention you may want to take a look at the 
1277 @file{weather} desklet source code from the
1278 @weblink2{SourceForge project web site,http://sourceforge.net/projects/adesklets/} for 
1279 a more substantial piece of Python code using adesklets. There are also a 
1280 few other test desklets under @file{test/} that may give you some ideas.
1281 @ifhtml
1282 You could also have a look at pydoc's autogenerated
1283 @command{adesklets} package help, included with this document
1284 (@xref{Python package documentation}.). Whenever you are happy enough with 
1285 your desklet, feel free to share it with the rest of us (this would be 
1286 much appreciated)--package it (@xref{Packaging GNU Makefile for desklets}.), 
1287 and then submit it (@xref{Submitting a desklet}.).
1288 @end ifhtml
1290 @subsection adesklets and Perl 
1292 From adesklets 0.6.0, adesklets can now be scripted out of the box from Perl,
1293 thanks to the work of @weblink2{Lucas
1294 Brutschy,mailto:lbrutschy@@users.sourceforge.net}. Of course, the Perl bindings
1295 are completely orthogonal from Python, and only needs a Perl 5 environment
1296 in addition to the core adesklets interpreter, written in C.
1298 @unnumberedsubsubsec Perl usage example
1300 As with the Python package, commands were wrapped into Perl subroutines, and an
1301 event loop can then be triggered, automatically registering and calling the
1302 given callbacks (@code{BackgroundGrab}, @code{ButtonRelease},
1303 @code{LeaveNotify}, @code{MotionNotify}, @code{ButtonPress}, @code{EnterNotify},
1304 @code{MenuFire}) as appropriate. @code{adesklets::event_loop} only returns when
1305 the driven adesklets interpreter dies. Here is the @file{test/test.pl} script
1306 from the source tarball of version @value{VERSION}:
1308 @verbatiminclude ../test/test.pl
1310 Merely twenty lines of code, and as previously, we already have a functionnal
1311 desklet. It should be pretty straighforward to understand, but here are a few
1312 general indications on what it does:
1314 @enumerate
1315 @item First, it imports the adesklets Perl module (@code{use adesklets}), 
1316 and instanciate the adesklets interpreter 
1317 calling @code{adesklets::open_stream()}. Once the subroutine returns, 
1318 the command line is already processed and the interpreter is ready 
1319 to accept commands.
1320 @item From there, we simply initialized an unmanaged 100x100 window, fill it 
1321 with a translucent white background, and show it.
1322 @item Finally, we fire up an event loop, registering a callback subroutine
1323 to take action when the user click on it (here, the action is to draw a 3x3 
1324 red square under the pointer). This event loop runs as long as 
1325 the adesklets interpreter is not killed 
1326 (either manually or because of the end of the X11 session). When it returns, 
1327 the cleanup subroutine @code{adesklets::close_streams()} is called.
1328 @end enumerate
1330 @unnumberedsubsubsec Catching errors
1332 When an adesklets command returns an error, the Perl script will die. You can
1333 recuperate the original error message like this:
1335 @example
1336 eval @{ my $image = adesklets::load_image("aaarrhg"); @};
1337 if($@@) @{ print $@@; @}
1338 @end example
1340 @xref{generaltips,General tips for programmers}, for an alternative.
1342 @unnumberedsubsubsec Configuration
1344 You can very well keep around multiple, differenly configured instances of the
1345 same Perl-based desklet; it is simply a matter of using the return value of
1346 @code{adesklets::get_id()} to uniquely identify the running instance; the way
1347 you choose to use this unique integer id to select configuration parameters is
1348 entirely up to you.
1350 @unnumberedsubsubsec Final words
1352 You might want to look at previous subsections concerning
1353 object IDs (@xref{objectids, Gotchas: a bit more about object IDs}.) and
1354 animations (@xref{animations,Special subject: animations}.), that still holds 
1355 for Perl.
1357 @ifhtml
1358 You could also have a look at the plain old documentation (POD) of the Perl
1359 package, included with this document (@xref{Perl package documentation}.). As
1360 mentionned previously, whenever you are happy enough with your desklet, feel
1361 free to share it with the rest of us (this would be much appreciated)--package
1362 it (@xref{Packaging GNU Makefile for desklets}.), and then submit it
1363 (@xref{Submitting a desklet}.).
1364 @end ifhtml
1366 @node Extending adesklets
1367 @chapter Using adesklets from other language environments
1369 adesklets was made to be easily usable from a variety of langage
1370 environments@footnote{We use the term ``langage environment'' because the 
1371 problem is not the syntax or the paradigm used (should it be imperative, 
1372 functional, or anything else); it is the way you can handle basic POSIX-related
1373 operations with files, signals, etc. (@xref{Requirements}.). Thus, a BASH
1374 user should use adesklets easily, while a Linux JDK user would probably 
1375 encounter more difficulties (no flames intended).}. This chapter explains 
1376 to programmers how the adesklets interpreter hooks itself into the system 
1377 in a language-neutral fashion.
1379 @noindent If you are not minimally used to POSIX systems or do not have basic 
1380 notions on operating system programming, this chapter is probably of no
1381 interest to you.
1383 @noindent Please note that the Python package under 
1384 @file{scripting/python/adesklets} 
1385 is a good complement for what you are about to read.
1387 @section Requirements 
1388 @anchor{Requirements}
1389 If you want to use the adesklets interpreter from your favorite language
1390 but it is not supported out of the box@footnote{As of adesklets
1391 @value{VERSION}, both Python and Perl are supported out of the box.}, 
1392 you can still do it, provided your langague supports one of these features:
1394 @itemize
1395 @item Reading and writing in pipes; or
1396 @item Reading and writing from/to files unbuffered 
1397 @end itemize
1399 @noindent It should also be able to either@footnote{This said, having both IPC
1400 support and poll/select will make things both simplier and cleaner. Being able 
1401 to block signals is also very useful.}:
1403 @itemize
1404 @item Catch IPC reliable signals; or
1405 @item Read files in non-blocking mode; or
1406 @item Be able to perform a poll/select on files
1407 @end itemize
1409 @noindent Finally, it should also be able to start a child process. 
1411 @noindent Those a pretty light requirements from a POSIX point of view, but let
1412 us mention for the sake of completeness that if your language environment does
1413 not meet these requirements, you could still use it provided you can get your
1414 application to talk reliably with another program@footnote{This would be a
1415 wrapper, basically.} that meets them. Of course, this is not an ideal situation
1416 and it should be avoided as much as possible.
1418 @section Initialization mechanism
1420 As you probably know (@xref{Using adesklets}.), there are two modes of operation
1421 for @command{adesklets}, as it can be called:
1423 @enumerate
1424 @item as a desklets launcher--whenever you call @command{adesklets} without 
1425 arguments.
1426 @item as an interpreter--in all other cases (interactive command line use
1427 or a child process from a desklet).
1428 @end enumerate
1430 @subsection adesklets called as a desklets launcher - restarting all desklets 
1431 @noindent On a new X session, the typical startup sequence is:
1433 @enumerate
1434 @item @command{adesklets} gets called without arguments, somewhere 
1435 from the X session initialization scripts.
1436 @item From there, the new adesklets instance acts as a desklets launcher. 
1437 It parses the @file{$HOME/.adesklets file}, then forks as many times as there 
1438 are desklets to start.  The original launcher process then exits as there is
1439 no need for a daemon here.
1440 @item All forked processes set up the @code{ADESKLETS_ID} environment variable
1441 with a string representation of the proper integer ID, then execute
1442 @footnote{With a call from the execve* family; see @code{man 2 execve}.} 
1443 the associated script.
1444 @item Each desklet launches itself an @command{adesklets} instance as a child
1445 process, passing along the @code{ADESKLETS_ID} variable without altering it. 
1446 It is the desklet's duty to make sure that:
1447 @itemize
1448 @item the adesklets interpreter standard streams, 
1449 @code{stdin}, @code{stdout} and @code{stderr}, get separately redirected, 
1450 in a way that parent process can easily write to adesklets' @code{stdin}, 
1451 and read from @code{stdout} and @code{stderr}. Use of pipes, FIFOs or event
1452 regular files are all possible.
1453 @item the writes to @code{stdin} and reads to the two other streams are 
1454 all unbuffered.
1455 @item the first command argument given to @command{adesklets} is the absolute
1456 file name of the desklet script.
1457 @end itemize
1458 @item Each newly created @command{adesklets} interpreter process initializes 
1459 itself using the environment @code{ADESKLETS_ID} variable and the command
1460 line absolute desklet name given as its first argument to lookup its 
1461 unscriptable characteristics@footnote{They are, namely, its screen and 
1462 coordinates.} from @file{$HOME/.adesklets}. When this operation is over, 
1463 the @code{ready!} event is generated (@xref{Events}.), and the interpreter is 
1464 ready to process commands.
1465 @end enumerate
1467 @subsection adesklets called as an interpreter - registration of a new desklet
1469 When a new desklet gets called directly, the startup sequence described in
1470 the previous subsection is the same, except for the first, second and third
1471 steps which simply don't occur. This means that the environment 
1472 @code{ADESKLETS_ID} is not set; the new @command{adesklets} interpreter uses 
1473 this fact to detect this is a new desklet, parse the @file{$HOME/.adesklets}
1474 configuration file and allocate the first free ID to the desklet.
1476 @noindent It should be noted that if the desklet file name given as the first 
1477 argument to the child @command{adesklets} instance is relative or is not both
1478 readable and executable by the current user, the desklet will not get registered
1479 in @file{$HOME/.adesklets}, and therefore not automatically restarted in 
1480 subsequent new X sessions by the launcher. In case @code{stdin} is a 
1481 terminal@footnote{Which means the session is interactive}, the registration
1482 does not take place either.
1484 @subsection Consequences
1485 This way, from the scripted desklet perspective, both cases are identical, and
1486 no conditionnal treatment is needed. All the desklet initialization job 
1487 is synthesized in the fourth point in the subsection above.
1489 @noindent If needed later on, the desklet can use the @code{get_id} command 
1490 to determine its ID.
1492 @section Using streams
1494 As explained previously, a desklet communicates with its private adesklets 
1495 interpreter via redirected unbuffered streams. Here, let us see what information
1496 they convey.
1498 @subsection stdin: the commands
1500 On the interpreter's @code{stdin}, the desklet outputs the commands it wants to
1501 execute in the order in which it wants them to be executed, one command per 
1502 line@footnote{A '\n' character should be emitted after each command.}. Since 
1503 reading this stream is suspended while a command is processed, a desklet should
1504 generally wait for a command to be processed before emitting 
1505 another@footnote{This is to avoid process blocking by overflowing the stream 
1506 with arbitrarily long commands; of course, there is no problem sending three
1507 commands of a few hundred bytes in one shot!} (See the next section).
1509 @noindent The command format is pretty simple: it is a command name, followed 
1510 by arguments separated by spaces, all in plain text representation, including 
1511 numbers. adesklets does not care about the number of spaces between arguments,
1512 as long as there is at least one. In the special case of commands where the
1513 last argument is a string (@code{text_draw}, for instance), adesklets will
1514 choose its first non-space characters to be its beginning; the rest of the
1515 line, including spaces, are considered to be part of the string.
1517 @noindent Two files, automatically kept in sync with the source 
1518 (@file{scripting/prototypes} and  @file{scripting/enums}) from the base source
1519 distribution, provide in tab-separated plain text format the description of all
1520 the commands and numeric constants that can be made available to the 
1521 desklets@footnote{See @file{scripting/protoize.sh.in} and 
1522 @file{scripting/enums.sh} for details on the format of the two files.}. A good 
1523 binding for a specific language should come with some automation to
1524 auto-generate pertinent parts of its own codebase based on those files; for
1525 instance, the Python binding adds a @code{protoize} action to its 
1526 @file{setup.py} @code{distutils} script to do so. Ideally, this automation code
1527 should be redacted in the target language with a reasonable set of 
1528 libraries@footnote{The key idea being that most users of your binding should be
1529 able to run it more or less from their base installation of the language.}; 
1530 if it is not well suited to this task, you need to limit yourself to use:
1532 @itemize
1533 @item Portable Bourne shell, conforming to POSIX 1003.2 and 1003.2a, scripts
1534 @item A recent sed (Streaming Editor), compatible with GNU
1535 sed@footnote{Nowadays, there is no problem running GNU sed on practically any
1536 POSIX system.}
1537 @item Portable use of any bc for arithmetic
1538 @end itemize
1540 @noindent if you want your work to become part of the official package.
1542 @subsection stdout: the command results
1544 The @command{adesklets} interpreter frequently polls its @code{stdin} 
1545 for new characters, and reads from it as needed. Whenever it receives an
1546 End-Of-Line ('\n'), it stops reading from it and tries executing the command. 
1547 Once the command has been carried out (possibly emitting a few lines on
1548 @code{stdout}), it sends as its last entry on it a status message of the form:
1550 @example
1551 command RANK ok: MESSAGE_STRING
1552 @end example
1554 @noindent if the command was successful, or:
1556 @example
1557 command RANK error: ERROR_STRING
1558 @end example
1560 @noindent if an error occurred.
1562 @noindent @code{RANK} is the numerical ID of the command (an unsigned integer)
1563 that starts at zero when the interpreter is created, and then is automatically
1564 incremented by one for every subsquent line it receives. All commands are 
1565 guaranteed to be processed in the order they were submitted. 
1566 @code{ERROR_STRING} is a free-form message in human-readable form explaining the
1567 source of the error. @code{MESSAGE_STRING} is also in human-readable form, but
1568 is formatted in such a way that it can be used to retrieve algorithmically
1569 useful return values for any commands. Those return values can be:
1571 @enumerate
1572 @item an integer--the return value ID (@code{create_image} and such)
1573 @item a tuple of integers--the numerical command output 
1574 (for @code{context_get_color} and the like)
1575 @item a list of strings--the ordered list of output strings 
1576 (for @code{images_info} and the like) for commands that output multiple lines
1577 on @code{stdout}, with the last line being the status message 
1578 @item a description string--a one-line textual answer from the command
1579 @item nothing at all
1580 @end enumerate
1582 @noindent Algorithmically, your "return value retrieving routine" should first
1583 try to retrieve integers from 
1584 @code{MESSAGE_STRING}@footnote{All parameters from the @code{MESSAGE_STRING}
1585 are separated by single spaces.}. If there is one or more integers present, 
1586 it should verify that the message is not a mere copy of an emitted command;
1587 if it is, the return value follows the fifth case (see above); otherwise, 
1588 if only one integer is found, this is the first case; if more than one is
1589 found, the second one.  If no integers are found and there was a list of lines 
1590 sent to stdout before the status message of the command, and after the status
1591 message of the previous command, it then returns according to third case.
1592 In what's left, if the status message is different from the emitted command, it
1593 is the fourth case. All remaining conditions should be mapped to the fifth
1594 case. This retrieving algorithm is working for all commands listed in
1595 @file{scripting/prototypes}.
1597 @subsection stderr: the events
1598 @anchor{Events}
1600 All remaining asynchronous event reports are sent to the interpreter's
1601 @code{stderr}. They are asynchronous regarding the processing of commands;
1602 if they will never occur while a command is processed (in the time interval
1603 between the submission of the complete command on @code{stdin} and the output
1604 of its message status line on @code{stdout}), they can be sent at any other
1605 time@footnote{No event is ever lost anyway; its report is only delayed.}.
1607 @noindent Event reports are single lines of the form@footnote{All other outputs
1608 on @code{stderr} can safely be discarded.}:
1610 @example
1611 event: EVENT_MESSAGE
1612 @end example
1614 @noindent In a stylized Backus Naur form, the grammar for EVENT_MESSAGE would 
1617 @verbatim
1618 EVENT_MESSAGE :: ready! |
1619                  backgroundgrab |
1620                  menufire MENU_ID MENU_STR |
1621                  motionnotify X Y |
1622                  enternotify X Y | 
1623                  leavenotify X Y |
1624                  buttonpress X Y BUTTON_ID |
1625                  buttonrelease X Y BUTTON_ID
1627 @end verbatim
1629 @noindent where @code{MENU_ID}, @code{X}, @code{Y}, and @code{BUTTON_ID} are
1630 all integers greater than or equal to zero, and @code{MENU_STR} is a string of
1631 characters, possibly including spaces. Let us detail things a bit further:
1633 @itemize
1634 @item Ready event: sent only once, whenever the @command{adesklets} interpreter
1635 becomes ready to process commands.
1636 @item BackgroundGrab event: sent every time the background image (image 1) gets 
1637 regenerated.
1638 @item MenuFire event: sent every time the user select an item in a menu not
1639 managed internally by adesklets.
1640 @item MotionNotify event: sent whenever the pointer moves inside the adesklets 
1641 window.
1642 @item EnterNotify, LeaveNotify: sent whenever the cursor passes over a visible
1643 border of the interpreter window, either going in or out.
1644 @item ButtonPress, ButtonRelease: sent when a pointer button is clicked inside 
1645 the interpreter window.
1646 @end itemize
1648 @noindent All events but Ready! (namely: MotionNotify, EnterNotify, 
1649 LeaveNotify, ButtonPress, ButtonRelease, BackgroundGrab and MenuFire) are
1650 masquable by the desklet. In fact, @command{adesklets} provides the desklet
1651 with commands for specifically handling the generation and output of events.
1652 They are: 
1653 @code{event_catch}, @code{events_get_send_sigusr1}, @code{events_reset_all},
1654 @code{event_uncatch}, @code{events_info}, @code{events_set_echo}, 
1655 @code{events_get_echo}, @code{events_purge} and @code{events_set_send_sigusr1}.
1656 It should be noted that those functions are not listed in
1657 @file{scripting/prototypes} as you most probably do not want your users having
1658 access to them. You should probably start an interactive session and play with
1659 them to make sure you fully understand this. This is also the right time to
1660 mention the @file{src/adesklets_debug.sh} script, which comes in handy when
1661 interactively experimenting with events.
1663 @noindent Two last things are worth mentionning about events:
1665 @enumerate
1666 @item By default, events are not echoed, but stored internally, waiting 
1667 to be purged with @code{events_purge}. You can change this with
1668 @code{events_set_echo}.
1669 @item You can set the adesklet interpreter to send a SIGUSR1 signal every time
1670 an event is printed out to its parent process (the desklet). It is a very
1671 useful IPC, since the signal can be trapped, allowing the event management
1672 routine to run only when necessary. This is what the Python package uses within
1673 its @code{Events_handler} class.
1674 @end enumerate
1676 @section SIGCHLD signal handler
1678 Whenever your language allows it, you should install some kind of SIGCHILD
1679 handler, so you can at least be notified if the adesklets interpreter ever
1680 exists without a reason (child zombies notwithstanding)@footnote{@code{man 2
1681 signal} is a very good reference on signals.}.
1683 @section Textual variables
1685 @command{adesklets} also supports differed execution (indirect mode)
1686 and textual replacement of variables. Here how variables work in indirect mode:
1688 @enumerate
1689 @item Once a command is entered, it is stored untouched into the commands
1690 history list, if applicable (in non-interactive usage of the interpreter,
1691 when the command lies bethween calls to @code{start_recording} 
1692 and @code{stop_recording})
1693 @item When a macro command is played back (using the @code{play} command,
1694 @xref{Programming adesklets}.), variables get expanded in a single pass, and no
1695 indirect reference is possible.  Expansion is pretty straightforward. The stored
1696 command line is scanned for any non-empty sequence of non-space characters
1697 beginning with a single '$'.  Each such sequence is replaced with the 
1698 corresponding @code{$variable} value, or removed if no variable is found.
1699 @item Expanded command get executed.
1700 @end enumerate
1702 The same expansion mechanism also applies to the direct mode of execution. All
1703 this leads to the fact that, using the Python package for instance, these two
1704 code snippets are equivalent:
1706 @example
1707 adesklets.window_resize(100,100)
1708 @end example
1710 and:
1712 @example
1713 adesklets.set('dim',100)
1714 adesklets.window_resize('$dim','$dim')
1715 @end example
1717 This did not require any alteration of our Python code, since Python is a
1718 dynamic language, but some other languages will require further thinking.
1720 @section Final words
1722 You should now know pretty much everything needed for integrating adesklets with
1723 your language environment. It may appear to be a daunting task, but a very
1724 clean binding can be produced by one programmer in only a few days. Once again,
1725 have a look at @file{src/adesklets_debug.sh}; it is a (very lame) Bourne shell 
1726 binding for adesklets written in only fifty lines, including comments.
1728 If you ever need assistance, you are encouraged to post on the 
1729 @weblink2{adesklets-devel mailing list,https://lists.sourceforge.net/lists/listinfo/adesklets-devel}...
1731 Happy coding!
1733 @noindent 
1734 @node Help wanted!
1735 @chapter Contributing to adesklets
1737 Your help is wanted! You can valuably contribute to adesklets by:
1739 @itemize
1740 @item
1741 @strong{Posting your adesklets screenshots online}. You use adesklets and think
1742 you have a pretty cool desktop? Share it with the world by posting it online,
1743 and send us a link! This way, you will help people learn about the project.
1744 @item
1745 @strong{Contribute to the documentation}. You have very good written
1746 knowledge of German, Spanish, Portugese, Arab or Swahili? Translators are always 
1747 welcomed, proofreaders too, for all languages.
1748 @item
1749 @strong{Writing new desklets}. adesklets is still young: we crave
1750 talented desklets writers, and we would be more than willing to post or link
1751 to your work. Do not worry too much about interface changes; the author spent
1752 considerable effort to ensure that the interface would be fairly stable even
1753 in the earliest releases.  It's not frozen forever, but it shouldn't break your
1754 desklets without some warning.  At this point, the API is predominantly getting
1755 internal bug fixes and portability improvements.
1756 @item
1757 @strong{Adding bindings for your language of choice}. Contact the developers 
1758 beforehand so that you don't waste time on something that is already written;
1759 they will be glad to share code.  Subscribe to the
1760 @weblink2{adesklets-devel mailing
1761 list,https://lists.sourceforge.net/lists/listinfo/adesklets-devel} on
1762 SourceForge for quick access to them.
1763 @end itemize
1765 @noindent Contact me by email at @email{syfou@@users.sourceforge.net}.
1767 @node Frequently asked questions
1768 @appendix Frequently asked questions
1770 Last update: @value{UPDATED}
1771 @appendixsection Compiling adesklets
1773 @subheading The adesklets configure script says my Python install is too old, but it's not. What's the problem?
1775 Some platforms (NetBSD, Ubuntu Linux, probably others too) sometimes alter 
1776 the Python version, appending letters, prefixing minor numbers, etc., thus 
1777 preventing the configuration script from detecting it properly. If you know 
1778 @strong{for sure} that what you have installed is at least 2.3.0,
1779 you can pass the @code{--with-python-force-detection} switch to 
1780 @code{configure}; this will make the configuration script skip the version 
1781 detection.
1783 @appendixsection Installing desklets
1785 @subheading I find the default desklets installation method tedious: it there a simpler way to install them?
1787 From adesklets 0.5.0, you have a new @command{adesklets_installer} 
1788 script (@xref{Using adesklets}.). It can
1789 help you download and unpack new or updated desklets. 
1791 @subheading Well, that's kinda better, but it is still not fully automated (I hate reading and understanding new things, you know)...
1793 True. @command{adesklets_installer} just notify you of updates, download, 
1794 check and unpack desklets, but it is still your duty to see their README, 
1795 fulfill their requirements, start, stop and configure them.
1797 But frankly, it is @emph{that} difficult? Most people does not change their
1798 desklets settings very often anyway. This is was deliberate choice from our
1799 part: the goal of adesklets has always been to minimize overall code 
1800 complexity, leading to a leaner, tighter, more consistent package. Why solving
1801 in a long, tedious, hard to write and maintain software all the corner cases a 
1802 smart user can figure out in minutes with proper documentation?
1804 If full automation is what you crave, have a look at the alternatives 
1805 to adesklets (@xref{About adesklets}.).
1806 @appendixsection Starting and stopping desklets
1808 @subheading When I try to start a new desklet, I get an @code{ImportError: No module named adesklets} error from the Python interpreter. What's happening?
1810 It means what is written: @command{python} cannot find the @code{adesklets}
1811 package; maybe it did not get installed, or it did get installed in the wrong
1812 place.
1814 @itemize
1815 @item Restart from the beginning the installation procedure
1816 (@xref{Installing adesklets}.). Make sure you @strong{do not} select
1817 the @code{--without-python-support} configuration option.
1818 @item Retry starting the desklet. If it still does not work, verify that the
1819 installation directory, given by:@example
1820 sed -n '/PYTHON_SITE_PKG/p' Makefile
1821 @end example
1822 @noindent is included in :@example
1823 echo 'import sys; print sys.path' | python
1824 @end example
1826 @noindent If not, you can still manually move the adesklets directory 
1827 from @code{PYTHON_SITE_PKG} to any path displayed by this last command.
1828 @end itemize
1830 @subheading When I try to start a new desklet, I get an @code{ADESKLETSError: adesklets process exited} error from the Python interpreter. What is this?
1832 This is a generic error telling you something is off with the low-level 
1833 interpreter, critical enough to cause it to exit. If  you are lucky, 
1834 you will have at the end of the line a dash, followed by 
1835 a descriptive message telling you what went wrong. In that case, if you have 
1836 difficulty understanding it, just seek help online. If no clue is given to you regarding the error origin, try this from a pseudo-terminal under X:
1837 @example
1838 echo x_status | adesklets :
1839 @end example
1840 You should normally get something similar to:
1841 @example
1842 event: ready!
1843 command 0 ok: x_status 1 (connected to ':0.0')
1844 @end example
1846 If you do, you are probably using a system
1847 (@weblink2{archlinux,http://www.archlinux.org/} for instance),
1848 on which the @code{PATH} variable for the Python interpreter differs from
1849 what is inherited from standard environment, which causes the Python package to
1850 fail to launch adesklets as a child process. On such systems, make sure
1851 to install @command{adesklets} using an appropriate @code{--prefix} switch at
1852 the configuration stage. For instance, on most recent Linux platforms, you 
1853 should use:
1855 @example
1856 ./configure --prefix=/usr
1857 @end example
1860 @subheading When I try to start a new desklet, I get an @code{desklets command error - could not load image 'image_name' - no loader for file format} error from the Python interpreter. Why?
1862 It means that your installment of Imlib2 does not support the file
1863 format of @code{image_name} (most of the time, the unsupported format
1864 will be PNG). The solution is to replace (by reinstalling or
1865 recompiling) Imlib2 with a version which supports the image format
1866 @code{image_name} is in.
1868 @subheading I cannot run any Python-based desklet: I get garbage collection errors!
1869 If you get errors similar to:
1871 @example
1872 python: Modules/gcmodule.c:275: visit_decref: Assertion `gc->gc.gc_refs != 0' failed.
1873 Aborted 
1874 @end example
1876 It means your installment of Python has a corrupted garbage collector; it is 
1877 often caused by incorrect or aggressive optimization during the compilation. 
1878 Just recompiling a stock python environment from 
1879 @weblink{http://python.org/} usually solves this.
1881 @subheading Desklets start fine as root, or as local user account, but just freeze or exit on NFS-mounted accounts
1883 adesklets needs to be able to lock some files under @code{$HOME} for working 
1884 reliably: most problems with network file systems are due to semi-functionning 
1885 installment failing to honour such locks. You have a short script under 
1886 @code{test/flock.py} in adesklets source tarball that provides a simple test 
1887 of fcntl locks; its normal behavior is to acquire a lock in the current working 
1888 directory, wait for the user to press a key, then release it and exit. 
1889 You can launch multiple instances of the script from the same directory to 
1890 verify that the locking is indeed working. If not, making it work will very likely
1891 make adesklets work too.
1893 @subheading Everything worked fine but then I tried upgrading a desklet, and I couldn't ever see the new one. What is wrong?
1895 There is a built-in lock mechanism in the interpreter that prevents a user from
1896 simultaneously running more than one desklet with the same @code{ID} and name,
1897 regardless of version.  Whenever you upgrade a given desklet, you should first
1898 cleanly quit the desklet (by using @code{Quit} from the context menu), then
1899 install the updated desklet by following the instructions provided in the 
1900 @file{README} file.
1902 @subheading Gosh! The desklet X is working, but does not remember its settings, or it always starts on the top left corner of screen 0 on a new X session. What is that? It sucks!
1904 This is most probably related to the way you started the desklet
1905 (Please @pxref{Using adesklets}.). You need to invoke the desklet script
1906 @strong{only once}. Afterwards you just need to run the command:
1908 @example
1909 @command{adesklets}
1910 @end example
1912 and it will remember where you placed your desklets and which desklets 
1913 you had running. Do not forget the pass flags to @command{adesklets}, 
1914 as appropriate.
1916 @subheading This is exactly what I did, but the darn thing wouldn't restart anyway.
1918 Did you store the desklets under a @file{$HOME/.adesklets} directory?
1919 Please don't.
1920 @command{adesklets} need a @file{$HOME/.adesklets} file to store the various
1921 user settings on running desklets; setting up a directory of the same name 
1922 prevents it from doing its job right, so just move your directory some place 
1923 else (@file{$HOME/.desklets}, for instance).
1925 @subheading Starting the desklets works fine, but they continue running when I terminate the X session.
1927 Normally, the desklets are supposed to be automatically terminated on the dead of
1928 the session. If you have the frontend shell server installed (the default), 
1929 you can also kill them manually by invoking the 
1931 @example
1932 adesklets --killall
1933 @end example
1935 command somewhere from the session exit.
1937 @appendixsec Displaying desklets
1939 @subheading Where are my desklets? @command{adesklets} interpreters seem to be running fine, but I just cannot see anything on my desktop (the so-called flickering problem)!
1941 Try the command:
1943 @example
1944 python test/test.py
1945 @end example
1947 @noindent from the base source directory. If a 100x100 window appears when 
1948 testing the desklet, it most probably means you are using a window manager 
1949 that draws a big window (so called ``fake'' root window) over the root window; 
1950 your desklets are just drawn below it. Such window managers include Nautilus, 
1951 KDE, Xfce4, CDE, e16 version 0.16.8 and later, or e17. As on adesklets 
1952 @value{VERSION}, supported window managers in that category are:
1954 @itemize
1955 @item @strong{e16}: only needed for stable version >= 0.16.8, and similarly 
1956 dated pre-releases.
1957 @item @strong{KDE}: for versions >= 3.4.1 (earlier versions untested). 
1958 You need to turn on ``Control Center -> Desktop -> Show icons on desktop -> 
1959 Allow programs in desktop window'', or to turn off the ``Show icons on desktop'' 
1960 altogether@footnote{Thanks to Stefan Jungcurt for the hint.}.
1961 @item @strong{Nautilus}
1962 @item @strong{ROX-Filer}: only preliminary support for now
1963 @item @strong{Xfce4}
1964 @item @strong{xffm-desktop}: only preliminary support for now
1965 @end itemize
1967 From adesklets 0.4.11 and onward, the fake root window detection method had 
1968 changed: it is no longer part of the C code by 
1969 default@footnote{Although you can get back
1970 the old behavior if you wish by using
1971 @command{--enable-legacy-fake-root-window-detection} at configuration time.
1972 @xref{Installing adesklets}.}. The interpreter now expects 
1973 the ADESKLETS_ROOT environment variable to contain the correct fake root
1974 window hexadecimal ID, if any. You can of course set it manually, 
1975 but a shell frontend will be handling most common window managers for you 
1976 (see list above), as long as you instruct it to. Try invoking:
1978 @example
1979 adesklets --help
1980 @end example
1982 If the shell frontend is installed, you will get many options, including how to
1983 trigger window managers specific fake root window detection routines.
1984 You also have a ``generic'' fake root window detection under 
1985 the switch @command{--user}: it could work (or not) for you, depending on 
1986 the structure of your window manager. Finally, please note the frontend 
1987 is a simple sh-compatible script, installed by default under 
1988 @command{$prefix/share/adesklets} -- it should be pretty
1989 straighforward to modify by anyone wishing to implement other detection schemes.
1991 It is also good to remember that fake root window detection obviously requires
1992 such windows to exist. It is therefore important to invoke 
1993 @command{adesklets} @emph{after} 
1994 the window manager is reasonably initialized. To help you do this, you have at
1995 your disposal a @command{-w progname} switch in the shell frontend.
1997 @subheading What about enlightenment?
1998 adesklets works as expected with e16 as long as you do not enable features
1999 causing the use of fake root windows (see previous question -- you need to use
2000 the --e16 switch for e16 version 0.16.8 and later), hiding in some circumstances
2001 the desklets behind the Window Manager structure. In the author experimentation
2002 with versions 0.16.7.2 and 0.16.8, it is only possible to see the desklets in
2003 the first virtual desktop. This said, in enlightenment lingo, virtual desktops
2004 can span on many ``screens'' (four, horizontally aligned by default), making
2005 perfectly possible multiple workspaces usage while keeping adesklets' desklets
2006 in sight.
2008 As for e17, it is unsupported. If you insist, you can find more hints on this in 
2009 @weblink2{enlightenment FAQ, http://www.get-e.org/Main/FAQs/#48}. This said, 
2010 e17 comes with something called ``e17 modules'' (engage, etc.), that work 
2011 great under this WM and fill the same niche.
2013 @subheading Now I see the desklets, but the transparency is screwed!
2015 Proper pseudo-transparency relies on the capacity to grab the background image 
2016 as well as getting notified when it changes. There is no entirely reliable 
2017 or even well established method to do this on anything but the real
2018 root window using the core X11 protocol (please read from the beginning of this 
2019 ``Displaying desklets'' section to full understand what follows). 
2021 Hence, even when using a fake root window, adesklets always grabs 
2022 the background from the real root window, no matter what: some windows managers
2023 are careful enough to ensure the synchronisation of the fake root window and 
2024 the real root window at all time, but not too many. adesklets does its best, 
2025 when portably possible, to synchronize @emph{on initial load} the background 
2026 of the real root window with the one of the fake root window, but in some 
2027 supported cases (ROX-Filer, xffm-desktop), this is not even possible. 
2028 Therefore, if you experience screwed-up backgrounds (no background at all, 
2029 incorrect backgroud or background not reflecting the latest change you made, 
2030 while you effectively see the new wallpaper in a fake root window), all you 
2031 need to do is to duplicate the wallpaper set on the real root window, preferably 
2032 using a wallpaper setter supporting the ad-hoc, widely supported
2033 @weblink2{enlightenment mechanism,http://gershwin.ens.fr/vdaniel/Doc-Locale/Outils-Gnu-Linux/Eterm-0.9/#trans} for wallpaper change notification -- any of 
2034 @command{Esetroot}, @command{wmsetbg}, @command{feh}, @command{hsetroot}, 
2035 @command{chbg} or @command{xsri} 
2036 should work fine. In fact, you can even use any wallpaper setter 
2037 to change the real root, but then you could have to rerun the adesklets 
2038 launcher afterwards to take advantage of a correct initial background grab 
2039 if no notification was sent.
2041 @subheading What have you done? Transparency worked before, but now it's screwed!
2043 The default scheme for grabbing the content of the root window changed
2044 after adesklets 0.6.1 to match what seems the current @emph{ad hoc}
2045 consensus of relying on the content of the _XROOTPMAP_ID pixmap. On
2046 the bright side, it means that adesklets pseudo-transparency will work
2047 on most up-to-date windows managers, even when compositing is
2048 involved. Unfortunately, it also means there is a chance it won't work
2049 on some non-composited WM that did just fine before: you can still get
2050 the old behavior back by specifying
2051 @command{--enable-legacy-pseudo-transparency} at configuration time.
2053 @subheading I cannot see smaller desklets such as xmms_bar or asimpleclock, while others work. What gives?
2055 New desklets are always started in the leftmost, upper corner of the screen, at
2056 the very bottom of the windows stack. Make sure you do not have some elements 
2057 (gnomebar, engage, etc) already masking this zone of the screen. Beware! Some 
2058 applications use pseudo-transparency, and can mask the root window seamlessly.
2060 @subheading I am running Fvwm as my window manager. Why can't I keep the desklets below all my other windows? They keep popping on top!
2062 Go see the Fvwm faq: @weblink{http://www.fvwm.org/documentation/faq/#5.11}.
2063 This @code{BugOpts RaiseOverUnmanaged on} option was reported to work for many 
2064 Fvwm users.
2066 @subheading I am so tired of hitting the desklets context menu when all I want is my windows manager's! Can I do something about it?
2068 Invoke the @command{--enable-control-on-context-menu} switch at configuration 
2069 time. This way, normal left click on a desklet should trigger your windows manager
2070 menu in most cases (tested on Xfce4 and *box derivatives). In all cases, you will 
2071 need to press control at the same time to trigger the desklet context menu.
2073 @section Running desklets
2074 @subheading The 'Configure' item from the context menu of many desklets doesn't work!
2075 For this to work--at least for all the demo desklets--you need to have
2076 @command{xterm} installed, and the @code{EDITOR} variable properly set in 
2077 your environment, as it is customary in UNIX. Please note this only launches a 
2078 text editor in a terminal. Editing the desklet's configuration file
2079 (usually @file{config.txt} from base desklet directory) has the same effect.
2081 @subheading Can the 'Configure' item from the context menu invoke a non console-based editor?
2083 Yes, why not? Since adesklets 0.5.0, there is a facilitating wrapper to 
2084 automate this in the shell frontend: see the @command{adesklets -e} (editor)
2085 switch.
2087 @subheading Do you plan including SVG support? I would like to use a SVG image in one of my desklets.
2088 No we do not, sorry. It is not
2089 that @weblink2{SVG,http://www.w3.org/Graphics/SVG/} is a bad format; in fact 
2090 it is quite good. But it is also a vector-oriented one (and rather complex), 
2091 while Imlib2, on which @command{adesklets} relies heavily, is completely 
2092 raster-oriented, and using Imlib2 is the main reason for @command{adesklets}'
2093 simplicity, relatively good speed and low resource usage. 
2095 That said, there is no reason for you not using SVG's with desklets, since 
2096 it is quite easy to convert images in SVG to high quality PNG's, 
2097 using programs such as @weblink2{sodipodi,http://www.sodipodi.com/}, 
2098 @weblink2{inkscape,http://www.inkscape.org/} or @weblink2{xsvg,http://xsvg.org/}. 
2099 In a directory full of SVG's, on a GNU system you can use a command such as:
2100 @example
2101 ls *.svg | sed 's/\(.*\).svg/-z --file=& --export-png=\1.png --export-width=128 --export-height=128/' | xargs --max-lines=1 sodipodi
2102 @end example
2103 to convert them all to 128x128 semi-transparent PNG's.
2105 @subheading I would like to use some of my system's fonts with adesklets, but I cannot get my desklets to find them. What should I do?
2107 First, you need to have fontconfig support enabled in adesklets. See the
2108 config.log from the configuration phase to verify it. If you did not keep the
2109 log, you can also look at the dynamic libraries linked against the interpreter.
2110 On a system with GNU binutils, you can do something like:
2111 @example
2112 ldd `which adesklets` | grep fontconfig
2113 @end example
2114 If you get output similar to:
2115 @example
2116  libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x45c75000)
2117 @end example
2118 it means everything is fine. Otherwise, you should recompile 
2119 @command{adesklets} from source. From there, you can use the line:
2120 @example
2121 echo 'list_font_path' | adesklets :
2122 @end example
2123 to see all the font directories that adesklets will into look for TrueType
2124 fonts.  Consult your fontconfig documentation to learn how to change this
2125 (on up-to-date systems, @code{man 5 fonts-conf} is a good starting point).
2126 Similarily:
2127 @example
2128 echo 'list_fonts' | adesklets :
2129 @end example
2130 Will give you all the fonts that are currently found... Keep in mind when
2131 typing them that font names are case-sensitive.
2133 Alternatively, if you just cannot get fontconfig to work, a way to get around
2134 the problem would be to create symbolic links to the fonts you want to use
2135 inside any absolute font paths listed by the command
2136 @code{echo 'list_font_path' ...} above.
2137 @ifhtml
2138 @node Python package documentation
2139 @appendix Python package documentation
2141 Here are links to significant sections of the Python package documentation:
2143 @itemize
2144 @item @weblink2{adesklets,../pydoc/adesklets.html}
2145 @item @weblink2{adesklets.events_handler,../pydoc/adesklets.events_handler.html}
2146 @item @weblink2{adesklets.commands,../pydoc/adesklets.commands.html}
2147 @item @weblink2{adesklets.utils,../pydoc/adesklets.utils.html}
2148 @item @weblink2{adesklets.configfile,../pydoc/adesklets.configfile.html}
2149 @end itemize
2151 @node Perl package documentation
2152 @appendix Perl package documentation
2154 Minimal POD (plain old documentation) is included with the package; here is a
2155 @weblink2{link to the html-formatted version,../pod/adesklets.pm.html}.
2157 @end ifhtml
2159 @node Imlib2 documentation
2160 @appendix Imlib2 documentation
2162 Carsten Haitzler (@email{raster@@rasterman.com}) took the time to produce very
2163 nice cross-referenced documentation for Imlib2, but for some reason (size
2164 considerations most probably), it is not included in the Imlib2 source
2165 tarball@footnote{Although it can be quite easily regenerated using doxygen.}.
2166 You can
2167 @ifhtml
2168 have it @weblink2{here,../imlib2}.
2169 @end ifhtml
2171 @ifnothtml
2172 find it online at @weblink{http://adesklets.sf.net/doc/imlib2/}.
2173 @end ifnothtml
2175 Most functions of the Imlib2 API have corresponding, homonymic commands
2176 in @command{adesklets}. @xref{Programming adesklets}, for specific details
2177 on the transition from direct Imlib2 programming in C to adesklets.
2179 @node Packaging GNU Makefile for desklets
2180 @appendix Packaging GNU Makefile for desklets
2182 Here is a convenient Makefile that automates the packaging of new or 
2183 existing desklets on a GNU system. Just copy the Makefile below 
2184 into @file{GNUmakefile} from your base desklet directory to use it. 
2185 There is nothing at all to edit, provided you named your base directory
2186 in a proper 'NAME-MAJOR.MINOR.REVISION' fashion, such as @code{beast-0.666.0}.
2188 @verbatiminclude ../utils/GNUmakefile.desklet
2190 @node Submitting a desklet
2192 @appendix Submitting a desklet
2194 @section Desklet package requirements
2195 Requirements for ``official'' desklets packages are scarce; authors are free to
2196 do as they wish. There are only two things that should be enforced:
2197 @enumerate
2198 @item A meaningful @file{README} file should exist in the base source directory 
2199 of the desklet archive and be kept up to date. It should at least contain:
2200 @itemize
2201 @item the name and contact email adress of the author@footnote{It is probably 
2202 not a good idea to give away your private email adress here; 
2203 for spam-related reasons, you should probably open an account 
2204 on @weblink2{SourceForge,http://sourceforge.net/}, or at another similar place 
2205 with a serious spam containment infrastructure.}
2206 @item a short description of the desklet
2207 @item the requirements for running it
2208 @item how to run it
2209 @end itemize
2210 @item The package should be a bzip'ed tarball containing a single source
2211 directory of the form @code{NAME-MAJOR.MINOR.REVISION}, where @code{NAME} is 
2212 the desklet base name, and @code{MAJOR.MINOR.REVISION} the version. Please note
2213 that a makefile (@xref{Packaging GNU Makefile for desklets}.) is also provided
2214 to automate creation of such an archive on GNU systems.
2215 @end enumerate
2217 @section The @command{adesklets_submit} script
2219 Starting in @command{adesklets} 0.4.4, desklet authors are provided with a 
2220 Python script to automate the submission of their desklets: 
2221 @file{utils/adesklets_submit} from the source package. Use the 
2222 @code{--with-python-install-submission-scripts} option at configuration time
2223 to place it in your @code{bindir} directory upon installation.
2225 @file{adesklets_submit} can be used to:
2226 @itemize
2227 @item Submit a new or updated desklet description for inclusion on the
2228 @weblink2{adesklets web site,http://adesklets.sf.net/desklets.html};
2229 @item Submit a bzip'ed desklet archive for inclusion in SourceForge's desklets
2230 package (this is optional--you may choose to host it yourself).
2231 @end itemize
2233 @section Invoking @command{adesklets_submit}
2234 Desklet submission is initiated by sending a specially crafted email to 
2235 @email{adesklets@@mailworks.org}@footnote{It is useless to send anything else 
2236 to this address; all messages that cannot be parsed by the automatic reception
2237 script are just silently dropped. Write to @email{syfou@@users.sourceforge.net}
2238 instead if you want to get in touch with the maintainer.}.
2239 The @command{adesklets_submit} script assits you in the construction of
2240 such an email using the user configuration file @file{$HOME/.adesklets_submit}
2241 and the command line switches. Here is an example of a valid
2242 @file{$HOME/.adesklets_submit} configuration:
2244 @verbatiminclude ../utils/adesklets_submit.example
2246 This is pretty self-explanatory, but here are a few less obvious points:
2248 @itemize
2249 @item
2250 Try to avoid using pseudonyms and nicknames for the @code{author_name} as much
2251 as possible, unless, of course, you already have a pretty well-established
2252 online identity under this name.
2253 @item
2254 @code{send_confirmation} specifies if an email should be sent back to your 
2255 @code{author_email} address whenever your desklet is succesfully published. 
2256 If the submitted entry is rejected, you will always be written back anyway
2257 with an explanation. Usually, the maintainer will not try to make changes to
2258 problematic entries; it will only summarize back to the author what was not OK.
2259 @item
2260 @emph{Double check} your @code{author_email} address, since this is the only
2261 one the maintainer will try to use when contacting you, regardless of what 
2262 the headers say. Failing to supply a valid address will cause all messages to
2263 fail to be sent to you, and all new desklet entries will be rejected.
2264 @item
2265 You can very well use adesklets_submit without any prior contact with the adesklets
2266 maintainer (either via email, within the forum using this adress for
2267 registration, or through the mailing list), but some back and forth will be
2268 needed before publication just to assert your identity and its effective
2269 relation to the provided email address.
2270 @item
2271 @code{desklets} is a dictionary of dictionaries (one dictionary per desklet, 
2272 desklets' names being the keys); all the items referring to files (thumbnail,
2273 screenshot and download) could either be publicly accessible URI's (this is the
2274 preferred method), or local files, either absolute or relative to your $HOME
2275 directory. In that case, needed files will be attached to the generated
2276 multipart email.
2277 @item
2278 All images will always be fetched and integrated on the adesklets.sf.net
2279 web site; you can safely remove them from your online location afterwards 
2280 if you provided live URI's.
2281 @item
2282 When updating already included desklets, there is no need to submit back
2283 the @code{thumbnail} or @code{screenshot} images if they did not change;
2284 you can just as easily reference the already installed images on SourceForge:
2285 @itemize
2286 @item The @code{thumbnail} is always stored under 
2287 @code{http://adesklets.sf.net/images/NAME_thumb.[jpg|png]}
2288 @item The @code{screenshot} is always stored under 
2289 @code{http://adesklets.sf.net/images/NAME_screen.[jpg|png]}
2290 where @code{NAME} is the name of the desklet.
2291 @end itemize
2292 @item
2293 Using the @code{host_on_sourceforge} value, you can choose to have 
2294 your desklet package either hosted on SourceForge or just referenced 
2295 on your site if you provided a URI. Of course, choosing this last 
2296 alternative also means you will need to keep it in place.
2297 @item
2298 The @code{thumbnail} image should be a JPG (preferably) or PNG (if you 
2299 @emph{really} need higher resolutions) of dimensions lying between 190x35 and 
2300 230x110 pixels.
2301 @item
2302 The @code{screenshot} image should be a 640x480 JPG (preferably) or PNG.
2303 It should put your desklet in evidence, and thus contain no other ones.  
2304 @item
2305 You can choose not to submit thumbnails and/or screenshots. In that case,
2306 default, generic images will be used instead.
2307 @item
2308 @code{Category} is unused for now, and just ignored.
2309 @item
2310 All emails weighing more than 300 KB will be rejected by the maintainer's
2311 email server; thus, adesklets_submit will refuse to generate them. Instead of
2312 submitting such big entries, use the URI facility described above to trim
2313 them down.
2314 @item @command{adesklets_submit} does not enforce the requirements above; it only
2315 checks what is strictly required to build a compliant submission email:
2316 the existence of dictionary entries, availability of files, the validity 
2317 of file types if they are local... It is your duty to make sure the entries
2318 meet the other requirements if you want to avoid rejection.
2319 @end itemize
2321 For example, Belial Leviathan would fisrt check his @code{beast} desklet's
2322 entry by doing something similar to:
2323 @example
2324 adesklets_submit beast
2325 @end example
2327 If everything goes fine, it will output the resulting submission email 
2328 on @code{stdout}. From there, Belial can either:
2329 @itemize
2330 @item Pipe it to his favorite MTA (mail transfert agent) to send it to
2331 @email{adesklets@@mailworks.org}.
2332 @item Make @command{adesklets_submit} send it itself by SMTP, using the
2333 @code{smtp_host} and @code{smtp_port} parameters in its 
2334 @file{$HOME/.adesklets_submit}. For this, Belial would use:
2335 @end itemize
2336 @example
2337 adesklets_submit --send beast
2338 @end example
2340 One last thing: you should try to avoid sending minor corrections multiple
2341 times, especially if you use local files.  It both adds to the workload of the
2342 maintainer's email server and to the management work. Please try to create a
2343 valid entry @emph{then} send it, not the other way around.
2345 @appendixsubsec Further submission validation using @command{adesklets_checkin}
2346 From @command{adesklets} 0.4.5, you now have access to the 
2347 @command{adesklets_checkin} script as well. This is the Python 
2348 script that the maintainer uses for checking in all submissions.
2349 @emph{Be aware that this script is only provided to desklet authors as a
2350 convenience, to lower their submission rejection count--developers are in no
2351 way forced to use it, and may even be unable to do so, since the script was not
2352 written with portability in mind as adesklets_submit was. Look at the script 
2353 header for a complete list of requirements.}
2355 @command{adesklets_checkin} has two modes of operation: interactive and 
2356 non-interactive. Only the non-interactive mode will interest desklet authors.
2357 In this mode, usage is fairly simple. Belial, for instance, would do:
2358 @example
2359 adesklets_submit beast | adesklets_checkin
2360 @end example
2362 If everything goes fine, an output similar to this will be produced:
2363 @example
2364 Validation started. Please wait.
2365 Everything seems fine, but keep in mind a few things cannot be
2366 verified without human intervention. See documentation for details.
2367 @end example
2369 If not, you will get an exception trace with some (hopefully) meaningful 
2370 explanations. 
2372 @appendixsubsec Limitations of @command{adesklets_checkin} in non-interactive mode
2374 Here are the remaining problems that @command{adesklets_checkin} 
2375 cannot detect and thus must absolutely be solved manually
2376 (the maintainer would interactively catch most of them, and you would have to
2377 resubmit anyway):
2378 @itemize
2379 @item
2380 Incomplete README file in base directory (Does it contain all the details
2381 enumerated above?).
2382 @item
2383 Out-of-date README file (Does its content reflect the current state
2384 of the desklet?).
2385 @item
2386 Desklet fails to run out-of-the-box (i.e. with or without minimal
2387 configuration) when requirements in the README file are met and special
2388 instructions are followed.
2389 @end itemize
2391 @node Copying This Manual
2392 @appendix Copying This Manual
2394 @menu
2395 * GNU General Public License::  License for copying this manual.
2396 @end menu
2398 @include gpl.texi
2400 @node Open PGP Public Key
2401 @appendix Open PGP Public Key
2403 @verbatiminclude syfou.asc
2405 @noindent You can also get this certificate from many public key servers on 
2406 the internet, such as @weblink{http://www.keyserver.net/}, or
2407 @weblink{http://pgp.mit.edu/}. Contact its rightful owner,
2408 Sylvain Fourmanoit, by email at @email{syfou@@users.sourceforge.net} 
2409 to arrange further key validation if you need any.
2411 @bye