| eric@lucii.org on Sat, 15 Dec 2001 12:50:12 +0100 |
|
Here, for those that expressed an interest, is a simple
perl script I call "xmutt".
I created it because just putting mutt in an xterm at the push of a
button creates multiple copies without warning. xmutt will simply
display a pop-up box (because it finds the lock file) instead of
firing up another copy.
It has worked great for me since I created it in October.
In KDE I went to the panel and right clicked....
Panel->Add->Non-KDE Application
I then directed it to my xmutt script and changed the icon to the
attached. Now, when I want mutt, I push a button.
Simple but it works.
Comments/suggestions welcome.
Eric
#!/usr/bin/perl
#
# PROGRAM: xmutt
#
# DESCR: runs mutt inside a confugred xterm.
#
#
# REQUIREMENTS: Got perl? Got perl/tk?
#
#
# NOTES:
#
#
# REVISION HISTORY:
#
# DATE WHO WHAT
# -------- --- --------------------------------------------------------
# 10.10.01 EAL +Wrote it...
#
#
use Tk ;
use Tk::Dialog ;
my $XTOPT = "-geometry 100x60-0+0 -fn 9x15 +sb -e " ;
$LOCKFILE = "~/.xmutt-lock" ;
if ( -f $LOCKFILE ) {
$wMain = MainWindow->new;
$fStatus = $wMain->Frame( -relief => 'groove'
)->pack(-side => 'bottom',
-expand => 1,
-fill => 'x');
$wMain->title("Xmutt");
$Info = "\n\tXmutt is already running\t\n" ;
$fStatus->Label(-textvariable => \$Info,
-relief => 'groove',
-borderwidth => 3,
-justify => 'left',
-foreground => 'blue'
)->pack(-side => 'top',
-expand => 1,
-fill => 'x');
$fStatus->Button(-text => "OK",
-command => sub { $wMain->destroy() ; }
)->pack(-side => 'bottom',
-expand => 1);
MainLoop;
exit 0;
}else{
qx| touch $LOCKFILE | ;
qx| /usr/X11R6/bin/xterm.real $XTOPT ~/bin/mutt &| ;
qx| rm $LOCKFILE | ;
}
--
# Eric Allan Lucas
# "Oh, I have slipped the surly bond of earth
# And danced the skies on laughter-silvered wings..
# -- John Gillespie Magee Jr.
Attachment:
xmutt-2.png
|
|