Hi,

I was missing a feature to be able to create named tabbers instead of
numbered tabs. This is useful for auto swallow so you don't have to
depend on the ordering of opening the tabbers. Attached is a patch that
implements that. Unamed new tabbers still get number names as before
(the change was quite minimal thanks to using a hash in the original
code ;-)

The syntax is
SendToModule FvwmTabs createNewTabber <name>
*FvwmTabs: autoSwallow(Class|Name|Resource) <appname> <tabber name>

so for example to create a tabber named vim and auto swallow gvim into
it:

SendToModule FvwmTabs createNewTabber vim
*FvwmTabs: autoSwallowClass Gvim vim

If anyone else was missing that also, enjoy
--- FvwmTabs    2004-06-06 15:03:59.000000000 +0300
+++ /usr/lib/fvwm/2.5.10/FvwmTabs       2004-06-20 22:06:03.000000000 +0300
@@ -303,7 +303,7 @@
        my ($type) = @_;
        foreach (split(/,/, $pConfig->{'autoSwallow' . $type}))
        {
-               if (!/^\s*(.+?)(\s+(\d+|any|lastFocus))?\s*$/i)
+               if (!/^\s*(.+?)(\s+(\S+|any|lastFocus))?\s*$/i)
                {
                        print(STDERR $fvwm->name() . ": unparseable 
autoSwallow$type.\n");
                        next;
@@ -415,10 +415,29 @@
 
 sub createNewTabber ()
 {
-       my $tId;
-       for ($tId = 0; ; $tId++)
+       my $tId = shift;
+
+       if (defined($tId))
        {
-               last if (!defined($tabWin{$tId}));
+               my $errmsg;
+
+               $errmsg = "Only tabber name allowed as parameter" if (defined($_[0]));
+               $errmsg = "any,lastFocus,-1 names are reserved" if ($tId =~ 
/any|lastfocus|-1/i);
+               $errmsg = "Tabber by that name already exists!" if 
(defined($tabWin{$tId}));
+               
+               if (defined($errmsg))
+               {
+                       $fvwm->send("Beep");
+                       $fvwm->showError($errmsg);
+                       return;
+               }
+       }
+       else
+       {
+               for ($tId = 0; ; $tId++)
+               {
+                       last if (!defined($tabWin{$tId}));
+               }
        }
 
        my $title = $fvwm->name() . " [$tId]";
@@ -892,7 +911,7 @@
                        $tId = $_, last if ($tabWin{$_}{parent} == $event{window});
                }
 
-               return if ($tId < 0);
+               return if ($tId == -1);
 
                my $h = $tabWin{$tId}{winFrame}->height();
                # resize the $winFrame widget. Can't use $w->configure(-height ...)
@@ -927,7 +946,7 @@
                        $tId = $_, last if (getWrapperWinId($_) == $event{event});
                }
 
-               print(STDERR "BUG: EnterNotify\n"), return if ($tId < 0);
+               print(STDERR "BUG: EnterNotify\n"), return if ($tId == -1);
                $tabWin{$tId}{focusTimestamp} = $event{time};
                $fvwm->debug("focusTimestamp set to $tabWin{$tId}{focusTimestamp}");
                takeFocus($tId);

Reply via email to