LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 09-14-2011, 07:12 AM   #1
devdol
Member
 
Registered: Dec 2005
Distribution: debian (testing/unstable)
Posts: 68

Rep: Reputation: 17
Smile SOLUTION: Close bunches of dialogs by commandline


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).
 
Old 09-16-2011, 01:23 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Thanks for posting this.

If you go to thread tools at the top of your post you can mark it as "SOLVED" so it will be standard with other solutions on LQ.
 
  


Reply

Tags
automate, commandline, manipulation, windowmanager, windows



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Mindbridge switches to Linux, saves "bunches of money" LXer Syndicated Linux News 0 09-08-2007 10:41 AM
Qt dialogs return data Ephracis Programming 7 02-21-2007 11:49 AM
Signal 11 error dialogs linus321 Linux - Software 5 05-28-2005 07:24 AM
bunches of 01's when trying to boot wolffmanl7 Linux - Newbie 3 07-07-2002 01:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 12:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration