Monday, February 22, 2010

Gnome Panel launchers with a twist


I hate the fact that on Linux you can have 2 instances of the same program running, and I specially hate that for programs like Evolution; who on its right mind would want to run to simultaneous instances of that?

Found a Ubuntu Forum thread (thanks to an Ars LKF post) that deals with this problem... So, took the script, modified a little bit to suit my needs and presto! The thing know just works, no more double instances of Evolution, Firefox & VLC.

Here is the script for Firefox, the others are pretty much the same, but invoking a different program, of course:

#! /bin/bash

WINTITLE="Mozilla Firefox"
PROGNAME="/usr/bin/firefox"

# 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"
else
$PROGNAME &
fi
exit 0


Bring window to the front instead of launching new instance

Labels: , , , , , ,

0 Comments:

Post a Comment

<< Home