On Thu, Nov 25, 2010 at 12:00 PM, Marc Lehmann said:
> As for restoring, you could start by modifying the existing tabbed
> extension (as limited as it is) and spawn a number of subterminals by
> using e.g. env variable,s x-resources or any othe rmeans of
> communication.
>
> It's certainly not trivial, unless you hacked around with/in perl
> extensions before, but certainly doable.
Well, I came up with an ugly hack (to the existing tabbed extension)
that allows you to pass parameters for opening up multiple tabs on
the command line. I use the fact that you don't carefully check what
is on the command line after a -e (I'm not complaining).
I use a command "tab$abspath" to tell uxrvt to open up a new tab with
a directory $abspath, which must be an absolute path. That means the
so-called command has a / in it and therefore is unlikely to conflict
with a real command. You are allowed give an optional command with
optional args to each tab. The format is:
-e tab/path1 [cmd1 [args1]] tab/path2 [cmd2 [args2]] ...
For example, if I want two tabs, each in my home directory, one
running zsh, and a second running bash running htop, I would:
$ urxvt -pe tabbed -e tab$HOME zsh tab$HOME bash -c htop
Of course, this will fail miserably if an argument to one of the
commands starts out with "tab/".
Some people might want it to be more user friendly but this suffices
for my needs. I've added an optional "." before the first slash so
"tab./" will open a tab in the current directory (whatever that is).
I'm posting this in case someone else wants similar functionality.
It's far from perfect but for me it suffices.
Peace, James
Here is the patch:
--- tabbed.orig 2010-11-30 18:28:22.000000000 -0700
+++ tabbed 2010-11-30 18:29:12.000000000 -0700
@@ -248,7 +248,22 @@
shift @argv;
} while @argv && $argv[0] ne "-e";
- $self->new_tab (@argv);
+ @argv or do { $self->new_tab(); return () };
+ shift @argv;
+
+ while (@argv and $argv[0] =~ m{^tab(\.?/.*)}) {
+ chdir($1);
+ shift @argv;
+ my @tab_args = ();
+ while (@argv and $argv[0] !~ m{^tab\.?/}) {
+ push @tab_args, shift @argv;
+ }
+ $self->new_tab ( @tab_args ? ("-e", @tab_args) : () );
+ @argv and next;
+
+ return ();
+ }
+
+ $self->new_tab ("-e", @argv);
()
}
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode