Users of "Thunderbird" (TB, a.k.a. "Icedove" in Debian) with its famous "Enigmail" plug-in might suffer from the fact, that Enigmail automatically opens more and more dialog boxes to enter your GPG passphrase, as soon as TB has focused an encrypted message and the passphrase isn't entered yet (or cleared from memory already). So if you leave your desktop for a while, you will frequently be bored with some senseless mouse exercise canceling them all one by one.
An obviously only far-less-than-ideal solution would be to "xkill" any of them.
Until the happy day when Enigmail will check on his own whether it has already an unanswered passphrase dialog open before it throws another one, it would be better if one could automatically close all that unnecessary windows by a single command. This would mean to send an "Escape" key to a group of windows with a common title phrase (e.g. "OpenPGP-Eingabe" for the German version).
Both xwit and wmctrl at least on my desktop (KDE 4.6.5) did not manage that, and KDE's
WMIFace utility mentioned at
http://userbase.kde.org
) seems to be unavailable as source.
Therefore, to summarize after longer searching a working solution for any fellow sufferer (in the Enigmail scenario described or something similar):
Code:
for WIN2CANCEL in $(xdotool search --name 'OpenPGP-Eingabe'); do xdotool windowactivate $WIN2CANCEL key "Escape" ; sleep 0.1 ; done
Finally, some annotations:
* Without short delays (100 ms) at least a 2 years old PC won't catch all dialogs in a single run. Alternatively you may try:
Code:
for WIN2CANCEL in $(xdotool search --name 'OpenPGP-Eingabe'); do xdotool windowactivate $WIN2CANCEL key --delay 100 Escape ; done
* Notwithstanding any timing issue, at least one of the simulated key events seems to stick with xdotool's own STDOUT, one of the dialog windows remains open therefore. Fortunately, in the Thundebird/Enigmail context described this is even useful.
* You may generate a test bunch of windows with appropriate properties by:
Code:
for id in $(seq 1 20) ; do kstart kdialog --yesnocancel "Test window" --title "OpenPGP-Eingabe" ; done
* If you have to send different key(s) to your targets: You won't find the "names" of the Keys to be sent in xdotool's man page, instead of that use the tool "xkeycaps" (look for the "KeySym:" line).