View previous topic :: View next topic |
Author |
Message |
gerardo Apprentice
Joined: 05 Feb 2004 Posts: 228 Location: Belgium
|
Posted: Wed Mar 12, 2008 7:41 pm Post subject: Hint (howto): avoid opening multiple instances of Evolution |
|
|
I'm using mail-notification to check for new mail.
It works fine, but everytime I click the icon evolution starts up yet again.
To avoid this, I made the following script
~/.evolution/launch_evolution
Code: | #!/bin/bash
WINTITLE=" - Evolution" # Main Evolution window has this in titlebar
PROGNAME="evolution" # This is the name of the binary for Evolution
# Use wmctrl to list all windows, count how many contain WINTITLE,
# and test if that count is non-zero:
if [ `wmctrl -l | grep -c "$WINTITLE"` != 0 ]
then
wmctrl -a "$WINTITLE" # If it exists, bring Evolution window to front
sleep 1
xsendkeycode 75 1; xsendkeycode 75 0 # Send F9 to do a Send/Receive
else
$PROGNAME "$@" & # Otherwise, just launch Evolution
sleep 2
xsendkeycode 75 1; xsendkeycode 75 0 # Send F9 to do a Send/Receive
fi
exit 0
|
The wmctrl is part of x11-misc/wmctrl.
The xsendkeycode is part of x11-misc/lineakd. The 75 is the F9 key, used for Send/Receive in Evolution.
To determine your keycode, use xev (from x11-apps/xev)
Do not forget to make this file executable. (chmod +x filename)
Now open Menu System -> Preferences -> Preferred Applications
Change in tab internet the mail-reader to the filename you used (in my case ~/.evolution/launch_evolution)
If you click the mail-notification icon now, the current open Evolution is activated rather than a new version is opened. _________________ Windoze : Plug and Pay...
Last edited by gerardo on Sat Mar 15, 2008 11:35 am; edited 2 times in total |
|
Back to top |
|
|
mark_alec Bodhisattva
Joined: 11 Sep 2004 Posts: 6066 Location: Melbourne, Australia
|
Posted: Thu Mar 13, 2008 5:52 am Post subject: |
|
|
Moved from Desktop Environments to Documentation, Tips & Tricks. _________________ www.gentoo.org.au || #gentoo-au |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|