Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Hint (howto): avoid opening multiple instances of Evolution
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
gerardo
Apprentice
Apprentice


Joined: 05 Feb 2004
Posts: 228
Location: Belgium

PostPosted: Wed Mar 12, 2008 7:41 pm    Post subject: Hint (howto): avoid opening multiple instances of Evolution Reply with quote

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
View user's profile Send private message
mark_alec
Bodhisattva
Bodhisattva


Joined: 11 Sep 2004
Posts: 6066
Location: Melbourne, Australia

PostPosted: Thu Mar 13, 2008 5:52 am    Post subject: Reply with quote

Moved from Desktop Environments to Documentation, Tips & Tricks.
_________________
www.gentoo.org.au || #gentoo-au
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
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