2 questions about working with tmux

2011-01-12 Thread hubert depesz lubaczewski
hi
I'm trying to migrate away from screen (biggest selling point for tmux
is (for me) that it doesn't preallocate memory for history).

but while working on migration I hit 2 problems that I can't solve.

first problem - too small window.

I work on rather large terminals, but when I start new *detached*
session, it's created as if it was 80x23 window.

Example:

created simple test script - test.pl which does:

#v+
#!/usr/bin/env perl
while (1) {
printf "%-40s : %s\n", scalar localtime time, " "x20;
sleep 30;
}
#v-

i'm using terminal that is that big:

#v+
=$ stty size
97 319
#v-

So, since each line of output from test.pl is only 144 characters long -
fits easily.
But when I'll start session auto-detached, with test.pl running:

=$ tmux new-session -d -s xxx 'perl test.pl'

created window is too small:

=$ tmux list-windows
1: sh [80x23]
layout: b85e,80x23,0,0

when I then attach to the terminal,  all lines that have been *already*
outputted by test.pl, are badly wrapped:, and it looks like this:
Wed Jan 12 17:19:16 2011 :        --
--             
Wed Jan 12 17:19:46 2011 :        --
--             
Wed Jan 12 17:20:16 2011 :        --
--             
Wed Jan 12 17:20:46 2011 :        
             
Wed Jan 12 17:21:16 2011 :        
             
Wed Jan 12 17:21:46 2011 :        
             
Wed Jan 12 17:22:16 2011 :        
             

this is problematic, as I'm using script that is more important that this
test.pl, and the wrapping of it's output makes it much less usable.

So, I'm wondering if there is a way to make initial window size for newly 
created, detached session, to be somehow configured.


second problem is problem with multiple panes.

Right now I'm using following "layout" in my screen session:

++
| *FIXED HEIGHT PANE*|
||
++
| *FIXED HEIGHT PANE*|
||
++
||
||
||
||
||
||
++

that is - I use 3 panels, split horizontally, with the top 2 having predefined, 
fixed height of 10 lines.

Now - I know I can make it myself, but running tmux, doing the split, and then
manually changing sizes of panes, but I'm looking for a script-based way to do
it.

In general - I need a script that will:
1. check for existing session
2. if the session exists - exit
3. if it doesn't exist - make new one, detached
4. in the new session, on first window, make 3 panes, change their sizes to 10 
lines, 10 lines, rest

i checked the docs and examples, and even bugged people on irc, but I wasn't 
able to get to a way to do it.

is there any way this could be done?

for the second problem - i.e. setting panes to 10lines/10lines/rest -
I'd be happy even to get a way to do it interactively (i.e. press a
button, and the heights set to predefined sizes).

Best regards,

depesz

--
Linkedin: http://www.linkedin.com/in/depesz  /  blog: http://www.depesz.com/
jid/gtalk: dep...@depesz.com / aim:depeszhdl / skype:depesz_hdl / gg:6749007

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: 2 questions about working with tmux

2011-01-12 Thread Patrick Shanahan
* hubert depesz lubaczewski  [01-12-11 11:53]:
> 
> that is - I use 3 panels, split horizontally, with the top 2 having 
> predefined, fixed height of 10 lines.
> 
> Now - I know I can make it myself, but running tmux, doing the split, and then
> manually changing sizes of panes, but I'm looking for a script-based way to do
> it.
> 
> In general - I need a script that will:
> 1. check for existing session
> 2. if the session exists - exit
> 3. if it doesn't exist - make new one, detached
> 4. in the new session, on first window, make 3 panes, change their sizes to 
> 10 lines, 10 lines, rest
> 
> i checked the docs and examples, and even bugged people on irc, but I wasn't 
> able to get to a way to do it.

get an xterm window with size 136x52 at 575+20
   black on white
   title "Pakas Tmux ML"
   attaches existing session or starts new if no existing

xterm -geometry 136x52+575+20 -ls -bg white -fg black \
  -title "Pakas Tmux ML" -e tmux -2u attach 



~/.tmux.conf
  split-window -v -l 10
  swap-pane -U
  split-window -v -l 10
  

will give you three panes but the two lowers will be 10 lines each



-- 
Patrick Shanahan Plainfield, Indiana, USAHOG # US1244711
http://wahoo.no-ip.org Photo Album:  http://wahoo.no-ip.org/gallery2
Registered Linux User #207535@ http://counter.li.org

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: 2 questions about working with tmux

2011-01-12 Thread hubert depesz lubaczewski
On Wed, Jan 12, 2011 at 12:58:27PM -0500, Patrick Shanahan wrote:
> * hubert depesz lubaczewski  [01-12-11 11:53]:
> > 
> > that is - I use 3 panels, split horizontally, with the top 2 having 
> > predefined, fixed height of 10 lines.
> > 
> > Now - I know I can make it myself, but running tmux, doing the split, and 
> > then
> > manually changing sizes of panes, but I'm looking for a script-based way to 
> > do
> > it.
> > 
> > In general - I need a script that will:
> > 1. check for existing session
> > 2. if the session exists - exit
> > 3. if it doesn't exist - make new one, detached
> > 4. in the new session, on first window, make 3 panes, change their sizes to 
> > 10 lines, 10 lines, rest
> > 
> > i checked the docs and examples, and even bugged people on irc, but I 
> > wasn't able to get to a way to do it.
> 
> get an xterm window with size 136x52 at 575+20
>black on white
>title "Pakas Tmux ML"
>attaches existing session or starts new if no existing
> 
> xterm -geometry 136x52+575+20 -ls -bg white -fg black \
>   -title "Pakas Tmux ML" -e tmux -2u attach 
> 
> 
> 
> ~/.tmux.conf
>   split-window -v -l 10
>   swap-pane -U
>   split-window -v -l 10
>   
> 
> will give you three panes but the two lowers will be 10 lines each

I know about split -l, but as you said - it will work for lower panes
only. any way to do it with top panes?

as for the xterm command - most of the steps I can do on my own, i have
problems only with the 10 lines requirement, and too small default
*detached* window.

Best regards,

depesz


--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: 2 questions about working with tmux

2011-01-12 Thread Nicholas Marriott
someone else asked for a way to set the initial size but they didn't
really give a convincing use case so i didn't do it

what you can do to get it the right size is do

tmux new\; detach

rather than new -d

you can resize the panes after you've created them

tmux new -d\; splitw -d\; resizep -U 100\; resizep -D 1\; attach

or alternatively

tmux new -d\; splitw -d\; set -g main-pane-height 2\; selectl main-horizontal\; 
set -u main-pane-height\; attach

of course this doesn't really help unless you can make the window the
right size



On Wed, Jan 12, 2011 at 07:02:50PM +0100, hubert depesz lubaczewski wrote:
> On Wed, Jan 12, 2011 at 12:58:27PM -0500, Patrick Shanahan wrote:
> > * hubert depesz lubaczewski  [01-12-11 11:53]:
> > > 
> > > that is - I use 3 panels, split horizontally, with the top 2 having 
> > > predefined, fixed height of 10 lines.
> > > 
> > > Now - I know I can make it myself, but running tmux, doing the split, and 
> > > then
> > > manually changing sizes of panes, but I'm looking for a script-based way 
> > > to do
> > > it.
> > > 
> > > In general - I need a script that will:
> > > 1. check for existing session
> > > 2. if the session exists - exit
> > > 3. if it doesn't exist - make new one, detached
> > > 4. in the new session, on first window, make 3 panes, change their sizes 
> > > to 10 lines, 10 lines, rest
> > > 
> > > i checked the docs and examples, and even bugged people on irc, but I 
> > > wasn't able to get to a way to do it.
> > 
> > get an xterm window with size 136x52 at 575+20
> >black on white
> >title "Pakas Tmux ML"
> >attaches existing session or starts new if no existing
> > 
> > xterm -geometry 136x52+575+20 -ls -bg white -fg black \
> >   -title "Pakas Tmux ML" -e tmux -2u attach 
> > 
> > 
> > 
> > ~/.tmux.conf
> >   split-window -v -l 10
> >   swap-pane -U
> >   split-window -v -l 10
> >   
> > 
> > will give you three panes but the two lowers will be 10 lines each
> 
> I know about split -l, but as you said - it will work for lower panes
> only. any way to do it with top panes?
> 
> as for the xterm command - most of the steps I can do on my own, i have
> problems only with the 10 lines requirement, and too small default
> *detached* window.
> 
> Best regards,
> 
> depesz
> 
> 
> --
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand 
> malware threats, the impact they can have on your business, and how you 
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> ___
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: 2 questions about working with tmux

2011-01-12 Thread Nicholas Marriott
try this, against CVS HEAD

Index: cmd-new-session.c
===
RCS file: /cvs/src/usr.bin/tmux/cmd-new-session.c,v
retrieving revision 1.34
diff -u -p -r1.34 cmd-new-session.c
--- cmd-new-session.c   4 Jan 2011 00:42:47 -   1.34
+++ cmd-new-session.c   12 Jan 2011 21:40:52 -
@@ -19,6 +19,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,8 +35,9 @@ int   cmd_new_session_exec(struct cmd *, s
 
 const struct cmd_entry cmd_new_session_entry = {
"new-session", "new",
-   "dn:s:t:", 0, 1,
-   "[-d] [-n window-name] [-s session-name] [-t target-session] [command]",
+   "dn:s:t:x:y:", 0, 1,
+   "[-d] [-n window-name] [-s session-name] [-t target-session] "
+   "[-x width] [-y height] [command]",
CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON,
NULL,
cmd_new_session_check,
@@ -47,6 +49,9 @@ cmd_new_session_check(struct args *args)
 {
if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n')))
return (-1);
+   if (!args_has(args, 'd') &&
+   (args_has(args, 'x') || args_has(args, 'y')))
+   return (-1);
return (0);
 }
 
@@ -60,7 +65,7 @@ cmd_new_session_exec(struct cmd *self, s
struct environ   env;
struct termios   tio, *tiop;
struct passwd   *pw;
-   const char  *newname, *target, *update, *cwd;
+   const char  *newname, *target, *update, *cwd, *errstr;
char*overrides, *cmd, *cause;
int  detached, idx;
u_intsx, sy, i;
@@ -149,6 +154,22 @@ cmd_new_session_exec(struct cmd *self, s
if (detached) {
sx = 80;
sy = 24;
+   if (args_has(args, 'x')) {
+   sx = strtonum(
+   args_get(args, 'x'), 1, USHRT_MAX, &errstr);
+   if (errstr != NULL) {
+   ctx->error(ctx, "width %s", errstr);
+   return (-1);
+   }
+   }
+   if (args_has(args, 'y')) {
+   sy = strtonum(
+   args_get(args, 'y'), 1, USHRT_MAX, &errstr);
+   if (errstr != NULL) {
+   ctx->error(ctx, "heigh %s", errstr);
+   return (-1);
+   }
+   }
} else if (ctx->cmdclient != NULL) {
sx = ctx->cmdclient->tty.sx;
sy = ctx->cmdclient->tty.sy;


On Wed, Jan 12, 2011 at 09:32:00PM +, Nicholas Marriott wrote:
> someone else asked for a way to set the initial size but they didn't
> really give a convincing use case so i didn't do it
> 
> what you can do to get it the right size is do
> 
> tmux new\; detach
> 
> rather than new -d
> 
> you can resize the panes after you've created them
> 
> tmux new -d\; splitw -d\; resizep -U 100\; resizep -D 1\; attach
> 
> or alternatively
> 
> tmux new -d\; splitw -d\; set -g main-pane-height 2\; selectl 
> main-horizontal\; set -u main-pane-height\; attach
> 
> of course this doesn't really help unless you can make the window the
> right size
> 
> 
> 
> On Wed, Jan 12, 2011 at 07:02:50PM +0100, hubert depesz lubaczewski wrote:
> > On Wed, Jan 12, 2011 at 12:58:27PM -0500, Patrick Shanahan wrote:
> > > * hubert depesz lubaczewski  [01-12-11 11:53]:
> > > > 
> > > > that is - I use 3 panels, split horizontally, with the top 2 having 
> > > > predefined, fixed height of 10 lines.
> > > > 
> > > > Now - I know I can make it myself, but running tmux, doing the split, 
> > > > and then
> > > > manually changing sizes of panes, but I'm looking for a script-based 
> > > > way to do
> > > > it.
> > > > 
> > > > In general - I need a script that will:
> > > > 1. check for existing session
> > > > 2. if the session exists - exit
> > > > 3. if it doesn't exist - make new one, detached
> > > > 4. in the new session, on first window, make 3 panes, change their 
> > > > sizes to 10 lines, 10 lines, rest
> > > > 
> > > > i checked the docs and examples, and even bugged people on irc, but I 
> > > > wasn't able to get to a way to do it.
> > > 
> > > get an xterm window with size 136x52 at 575+20
> > >black on white
> > >title "Pakas Tmux ML"
> > >attaches existing session or starts new if no existing
> > > 
> > > xterm -geometry 136x52+575+20 -ls -bg white -fg black \
> > >   -title "Pakas Tmux ML" -e tmux -2u attach 
> > > 
> > > 
> > > 
> > > ~/.tmux.conf
> > >   split-window -v -l 10
> > >   swap-pane -U
> > >   split-window -v -l 10
> > >   
> > > 
> > > will give you three panes but the two lowers will be 10 lines each
> > 
> > I know about split -l, but as you said - it will work for lower panes
> > only. any way to do it with top panes?
> > 
> > as for th

Re: 2 questions about working with tmux

2011-01-12 Thread mbm329
Hi depesz,

I too am evaluating tmux to see if it would be a suitable replacement
of gnu screen.  Your questions are interesting to me as well.  As I've
only been playing around with tmux for a few days, I decided to
attempt a solution for you.  I am in no way an expert on this and
expect I will be corrected shortly if I am wrong ;)

It appears as though tmux gets it's own geometry for the panes from
_your_ terminal session; and it's all relative to the terminal
window's size.  You can see this by taking a small terminal window and
sizing the panes exactly like you want, and then expand the terminal
to full-screen.  You will see the number of lines/characters in each
pane is different now.  They won't stick to the explicit 10 lines per
pane you are hoping for.

Here's a line that will work for you, I think.  But it will require
you connect to a terminal to size them. I've tried setting resize-pane
without an attach and it wouldn't work.

 Basically, what this does is split the windows like you want, and
then resize the first two panes upward to the smallest size (2 lines)
by using an extreme size of 500 lines.  Following that, it will resize
downward by 8 lines to give you a pane size of 10 lines.

tmux new-session -s xxx 'perl test.pl' \; splitw -v \; split-window -v
\; attach \; resize-pane -U -t0 500 \; resize-pane -U -t1 500 \;
resize-pane -D -t0 8 \; resize-pane -D -t1 8 \; detach

I know you were looking for a way to size them without connecting to a
terminal, but I'm not sure you can get around that.  Patrick's
solution with xterm is probably the closest you could get, and that
would require at least an X-Server.

xterm -geometry 178x53 -ls -e "tmux new-session -s xxx 'perl test.pl'
\; split-window -v \; split-window -v \; attach \; resize-pane -U -t0
500 \; resize-pane -U -t1 500 \; resize-pane -D -t0 8 \; resize-pane
-D -t1 8 \; detach"

You can get your xterm geometry by starting a new session and running
"tmux ls" and it will show you your window size.  Just +1 to the
height.

Good luck,

Mike


On Wed, Jan 12, 2011 at 1:02 PM, hubert depesz lubaczewski
 wrote:
> On Wed, Jan 12, 2011 at 12:58:27PM -0500, Patrick Shanahan wrote:
>> * hubert depesz lubaczewski  [01-12-11 11:53]:
>> >
>> > that is - I use 3 panels, split horizontally, with the top 2 having 
>> > predefined, fixed height of 10 lines.
>> >
>> > Now - I know I can make it myself, but running tmux, doing the split, and 
>> > then
>> > manually changing sizes of panes, but I'm looking for a script-based way 
>> > to do
>> > it.
>> >
>> > In general - I need a script that will:
>> > 1. check for existing session
>> > 2. if the session exists - exit
>> > 3. if it doesn't exist - make new one, detached
>> > 4. in the new session, on first window, make 3 panes, change their sizes 
>> > to 10 lines, 10 lines, rest
>> >
>> > i checked the docs and examples, and even bugged people on irc, but I 
>> > wasn't able to get to a way to do it.
>>
>> get an xterm window with size 136x52 at 575+20
>>    black on white
>>    title "Pakas Tmux ML"
>>    attaches existing session or starts new if no existing
>>
>> xterm -geometry 136x52+575+20 -ls -bg white -fg black \
>>       -title "Pakas Tmux ML" -e tmux -2u attach
>>
>>
>>
>> ~/.tmux.conf
>>   split-window -v -l 10
>>   swap-pane -U
>>   split-window -v -l 10
>>
>>
>> will give you three panes but the two lowers will be 10 lines each
>
> I know about split -l, but as you said - it will work for lower panes
> only. any way to do it with top panes?
>
> as for the xterm command - most of the steps I can do on my own, i have
> problems only with the 10 lines requirement, and too small default
> *detached* window.
>
> Best regards,
>
> depesz
>
>
> --
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> ___
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users
>

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: 2 questions about working with tmux

2011-01-12 Thread mbm329
Oops, since you're already attaching because you pretty much _have_
to, the "attach" can be removed from the line I gave:

tmux new-session -s xxx 'perl test.pl' \; splitw -v \; split-window -v
\; resize-pane -U -t0 500 \; resize-pane -U -t1 500 \; resize-pane -D
-t0 8 \; resize-pane -D -t1 8 \; detach

Mike


On Wed, Jan 12, 2011 at 4:51 PM, mbm329  wrote:
> Hi depesz,
>
> I too am evaluating tmux to see if it would be a suitable replacement
> of gnu screen.  Your questions are interesting to me as well.  As I've
> only been playing around with tmux for a few days, I decided to
> attempt a solution for you.  I am in no way an expert on this and
> expect I will be corrected shortly if I am wrong ;)
>
> It appears as though tmux gets it's own geometry for the panes from
> _your_ terminal session; and it's all relative to the terminal
> window's size.  You can see this by taking a small terminal window and
> sizing the panes exactly like you want, and then expand the terminal
> to full-screen.  You will see the number of lines/characters in each
> pane is different now.  They won't stick to the explicit 10 lines per
> pane you are hoping for.
>
> Here's a line that will work for you, I think.  But it will require
> you connect to a terminal to size them. I've tried setting resize-pane
> without an attach and it wouldn't work.
>
>  Basically, what this does is split the windows like you want, and
> then resize the first two panes upward to the smallest size (2 lines)
> by using an extreme size of 500 lines.  Following that, it will resize
> downward by 8 lines to give you a pane size of 10 lines.
>
> tmux new-session -s xxx 'perl test.pl' \; splitw -v \; split-window -v
> \; attach \; resize-pane -U -t0 500 \; resize-pane -U -t1 500 \;
> resize-pane -D -t0 8 \; resize-pane -D -t1 8 \; detach
>
> I know you were looking for a way to size them without connecting to a
> terminal, but I'm not sure you can get around that.  Patrick's
> solution with xterm is probably the closest you could get, and that
> would require at least an X-Server.
>
> xterm -geometry 178x53 -ls -e "tmux new-session -s xxx 'perl test.pl'
> \; split-window -v \; split-window -v \; attach \; resize-pane -U -t0
> 500 \; resize-pane -U -t1 500 \; resize-pane -D -t0 8 \; resize-pane
> -D -t1 8 \; detach"
>
> You can get your xterm geometry by starting a new session and running
> "tmux ls" and it will show you your window size.  Just +1 to the
> height.
>
> Good luck,
>
> Mike
>
>
> On Wed, Jan 12, 2011 at 1:02 PM, hubert depesz lubaczewski
>  wrote:
>> On Wed, Jan 12, 2011 at 12:58:27PM -0500, Patrick Shanahan wrote:
>>> * hubert depesz lubaczewski  [01-12-11 11:53]:
>>> >
>>> > that is - I use 3 panels, split horizontally, with the top 2 having 
>>> > predefined, fixed height of 10 lines.
>>> >
>>> > Now - I know I can make it myself, but running tmux, doing the split, and 
>>> > then
>>> > manually changing sizes of panes, but I'm looking for a script-based way 
>>> > to do
>>> > it.
>>> >
>>> > In general - I need a script that will:
>>> > 1. check for existing session
>>> > 2. if the session exists - exit
>>> > 3. if it doesn't exist - make new one, detached
>>> > 4. in the new session, on first window, make 3 panes, change their sizes 
>>> > to 10 lines, 10 lines, rest
>>> >
>>> > i checked the docs and examples, and even bugged people on irc, but I 
>>> > wasn't able to get to a way to do it.
>>>
>>> get an xterm window with size 136x52 at 575+20
>>>    black on white
>>>    title "Pakas Tmux ML"
>>>    attaches existing session or starts new if no existing
>>>
>>> xterm -geometry 136x52+575+20 -ls -bg white -fg black \
>>>       -title "Pakas Tmux ML" -e tmux -2u attach
>>>
>>>
>>>
>>> ~/.tmux.conf
>>>   split-window -v -l 10
>>>   swap-pane -U
>>>   split-window -v -l 10
>>>
>>>
>>> will give you three panes but the two lowers will be 10 lines each
>>
>> I know about split -l, but as you said - it will work for lower panes
>> only. any way to do it with top panes?
>>
>> as for the xterm command - most of the steps I can do on my own, i have
>> problems only with the 10 lines requirement, and too small default
>> *detached* window.
>>
>> Best regards,
>>
>> depesz
>>
>>
>> --
>> Protect Your Site and Customers from Malware Attacks
>> Learn about various malware tactics and how to avoid them. Understand
>> malware threats, the impact they can have on your business, and how you
>> can protect your company and customers by using code signing.
>> http://p.sf.net/sfu/oracle-sfdevnl
>> ___
>> tmux-users mailing list
>> tmux-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/tmux-users
>>
>

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware thr

Re: 2 questions about working with tmux

2011-01-12 Thread Patrick Shanahan
* mbm329  [01-12-11 16:56]:
> Oops, since you're already attaching because you pretty much _have_
> to, the "attach" can be removed from the line I gave:
> 
> tmux new-session -s xxx 'perl test.pl' \; splitw -v \; split-window -v
> \; resize-pane -U -t0 500 \; resize-pane -U -t1 500 \; resize-pane -D
> -t0 8 \; resize-pane -D -t1 8 \; detach

iiuc, the "attach" hurts nothing but allows you to attach an existing
session in another window.  I prefer issuing a detach first so the
session conforms size wize to my present terminal.

I have an alias defined:
alias tm='tmux detach; tmux -2u attach'
but I *normally* keep only one session with 10 windows of which several
are split into two or more panes.


note:  please do not cc me, I read the list and have no need of multiple
copies.  Please
-- 
Patrick Shanahan Plainfield, Indiana, USAHOG # US1244711
http://wahoo.no-ip.org Photo Album:  http://wahoo.no-ip.org/gallery2
Registered Linux User #207535@ http://counter.li.org

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: 2 questions about working with tmux

2011-01-12 Thread mbm329
Also of note to the devs, there may be a bug with regards to the
creation and detaching of a session within the same commandline.  It
works, but yields the following output.

$ tmux new -s xxx \; detach
fatal: main_dispatch: unexpected message

Mike


On Wed, Jan 12, 2011 at 4:56 PM, mbm329  wrote:
> Oops, since you're already attaching because you pretty much _have_
> to, the "attach" can be removed from the line I gave:
>
> tmux new-session -s xxx 'perl test.pl' \; splitw -v \; split-window -v
> \; resize-pane -U -t0 500 \; resize-pane -U -t1 500 \; resize-pane -D
> -t0 8 \; resize-pane -D -t1 8 \; detach
>
> Mike
>
>
> On Wed, Jan 12, 2011 at 4:51 PM, mbm329  wrote:
>> Hi depesz,
>>
>> I too am evaluating tmux to see if it would be a suitable replacement
>> of gnu screen.  Your questions are interesting to me as well.  As I've
>> only been playing around with tmux for a few days, I decided to
>> attempt a solution for you.  I am in no way an expert on this and
>> expect I will be corrected shortly if I am wrong ;)
>>
>> It appears as though tmux gets it's own geometry for the panes from
>> _your_ terminal session; and it's all relative to the terminal
>> window's size.  You can see this by taking a small terminal window and
>> sizing the panes exactly like you want, and then expand the terminal
>> to full-screen.  You will see the number of lines/characters in each
>> pane is different now.  They won't stick to the explicit 10 lines per
>> pane you are hoping for.
>>
>> Here's a line that will work for you, I think.  But it will require
>> you connect to a terminal to size them. I've tried setting resize-pane
>> without an attach and it wouldn't work.
>>
>>  Basically, what this does is split the windows like you want, and
>> then resize the first two panes upward to the smallest size (2 lines)
>> by using an extreme size of 500 lines.  Following that, it will resize
>> downward by 8 lines to give you a pane size of 10 lines.
>>
>> tmux new-session -s xxx 'perl test.pl' \; splitw -v \; split-window -v
>> \; attach \; resize-pane -U -t0 500 \; resize-pane -U -t1 500 \;
>> resize-pane -D -t0 8 \; resize-pane -D -t1 8 \; detach
>>
>> I know you were looking for a way to size them without connecting to a
>> terminal, but I'm not sure you can get around that.  Patrick's
>> solution with xterm is probably the closest you could get, and that
>> would require at least an X-Server.
>>
>> xterm -geometry 178x53 -ls -e "tmux new-session -s xxx 'perl test.pl'
>> \; split-window -v \; split-window -v \; attach \; resize-pane -U -t0
>> 500 \; resize-pane -U -t1 500 \; resize-pane -D -t0 8 \; resize-pane
>> -D -t1 8 \; detach"
>>
>> You can get your xterm geometry by starting a new session and running
>> "tmux ls" and it will show you your window size.  Just +1 to the
>> height.
>>
>> Good luck,
>>
>> Mike
>>
>>
>> On Wed, Jan 12, 2011 at 1:02 PM, hubert depesz lubaczewski
>>  wrote:
>>> On Wed, Jan 12, 2011 at 12:58:27PM -0500, Patrick Shanahan wrote:
 * hubert depesz lubaczewski  [01-12-11 11:53]:
 >
 > that is - I use 3 panels, split horizontally, with the top 2 having 
 > predefined, fixed height of 10 lines.
 >
 > Now - I know I can make it myself, but running tmux, doing the split, 
 > and then
 > manually changing sizes of panes, but I'm looking for a script-based way 
 > to do
 > it.
 >
 > In general - I need a script that will:
 > 1. check for existing session
 > 2. if the session exists - exit
 > 3. if it doesn't exist - make new one, detached
 > 4. in the new session, on first window, make 3 panes, change their sizes 
 > to 10 lines, 10 lines, rest
 >
 > i checked the docs and examples, and even bugged people on irc, but I 
 > wasn't able to get to a way to do it.

 get an xterm window with size 136x52 at 575+20
    black on white
    title "Pakas Tmux ML"
    attaches existing session or starts new if no existing

 xterm -geometry 136x52+575+20 -ls -bg white -fg black \
       -title "Pakas Tmux ML" -e tmux -2u attach



 ~/.tmux.conf
   split-window -v -l 10
   swap-pane -U
   split-window -v -l 10


 will give you three panes but the two lowers will be 10 lines each
>>>
>>> I know about split -l, but as you said - it will work for lower panes
>>> only. any way to do it with top panes?
>>>
>>> as for the xterm command - most of the steps I can do on my own, i have
>>> problems only with the 10 lines requirement, and too small default
>>> *detached* window.
>>>
>>> Best regards,
>>>
>>> depesz
>>>
>>>
>>> --
>>> Protect Your Site and Customers from Malware Attacks
>>> Learn about various malware tactics and how to avoid them. Understand
>>> malware threats, the impact they can have on your business, and how you
>>> can protect your company and customers by using code signing.
>>> ht

Re: 2 questions about working with tmux

2011-01-12 Thread mbm329
Nevermind, upgraded to the latest version.  This has been fixed.  My apologies.

Mike


On Wed, Jan 12, 2011 at 6:45 PM, mbm329  wrote:
> Also of note to the devs, there may be a bug with regards to the
> creation and detaching of a session within the same commandline.  It
> works, but yields the following output.
>
> $ tmux new -s xxx \; detach
> fatal: main_dispatch: unexpected message
>
> Mike
>
>
> On Wed, Jan 12, 2011 at 4:56 PM, mbm329  wrote:
>> Oops, since you're already attaching because you pretty much _have_
>> to, the "attach" can be removed from the line I gave:
>>
>> tmux new-session -s xxx 'perl test.pl' \; splitw -v \; split-window -v
>> \; resize-pane -U -t0 500 \; resize-pane -U -t1 500 \; resize-pane -D
>> -t0 8 \; resize-pane -D -t1 8 \; detach
>>
>> Mike
>>
>>
>> On Wed, Jan 12, 2011 at 4:51 PM, mbm329  wrote:
>>> Hi depesz,
>>>
>>> I too am evaluating tmux to see if it would be a suitable replacement
>>> of gnu screen.  Your questions are interesting to me as well.  As I've
>>> only been playing around with tmux for a few days, I decided to
>>> attempt a solution for you.  I am in no way an expert on this and
>>> expect I will be corrected shortly if I am wrong ;)
>>>
>>> It appears as though tmux gets it's own geometry for the panes from
>>> _your_ terminal session; and it's all relative to the terminal
>>> window's size.  You can see this by taking a small terminal window and
>>> sizing the panes exactly like you want, and then expand the terminal
>>> to full-screen.  You will see the number of lines/characters in each
>>> pane is different now.  They won't stick to the explicit 10 lines per
>>> pane you are hoping for.
>>>
>>> Here's a line that will work for you, I think.  But it will require
>>> you connect to a terminal to size them. I've tried setting resize-pane
>>> without an attach and it wouldn't work.
>>>
>>>  Basically, what this does is split the windows like you want, and
>>> then resize the first two panes upward to the smallest size (2 lines)
>>> by using an extreme size of 500 lines.  Following that, it will resize
>>> downward by 8 lines to give you a pane size of 10 lines.
>>>
>>> tmux new-session -s xxx 'perl test.pl' \; splitw -v \; split-window -v
>>> \; attach \; resize-pane -U -t0 500 \; resize-pane -U -t1 500 \;
>>> resize-pane -D -t0 8 \; resize-pane -D -t1 8 \; detach
>>>
>>> I know you were looking for a way to size them without connecting to a
>>> terminal, but I'm not sure you can get around that.  Patrick's
>>> solution with xterm is probably the closest you could get, and that
>>> would require at least an X-Server.
>>>
>>> xterm -geometry 178x53 -ls -e "tmux new-session -s xxx 'perl test.pl'
>>> \; split-window -v \; split-window -v \; attach \; resize-pane -U -t0
>>> 500 \; resize-pane -U -t1 500 \; resize-pane -D -t0 8 \; resize-pane
>>> -D -t1 8 \; detach"
>>>
>>> You can get your xterm geometry by starting a new session and running
>>> "tmux ls" and it will show you your window size.  Just +1 to the
>>> height.
>>>
>>> Good luck,
>>>
>>> Mike
>>>
>>>
>>> On Wed, Jan 12, 2011 at 1:02 PM, hubert depesz lubaczewski
>>>  wrote:
 On Wed, Jan 12, 2011 at 12:58:27PM -0500, Patrick Shanahan wrote:
> * hubert depesz lubaczewski  [01-12-11 11:53]:
> >
> > that is - I use 3 panels, split horizontally, with the top 2 having 
> > predefined, fixed height of 10 lines.
> >
> > Now - I know I can make it myself, but running tmux, doing the split, 
> > and then
> > manually changing sizes of panes, but I'm looking for a script-based 
> > way to do
> > it.
> >
> > In general - I need a script that will:
> > 1. check for existing session
> > 2. if the session exists - exit
> > 3. if it doesn't exist - make new one, detached
> > 4. in the new session, on first window, make 3 panes, change their 
> > sizes to 10 lines, 10 lines, rest
> >
> > i checked the docs and examples, and even bugged people on irc, but I 
> > wasn't able to get to a way to do it.
>
> get an xterm window with size 136x52 at 575+20
>    black on white
>    title "Pakas Tmux ML"
>    attaches existing session or starts new if no existing
>
> xterm -geometry 136x52+575+20 -ls -bg white -fg black \
>       -title "Pakas Tmux ML" -e tmux -2u attach
>
>
>
> ~/.tmux.conf
>   split-window -v -l 10
>   swap-pane -U
>   split-window -v -l 10
>
>
> will give you three panes but the two lowers will be 10 lines each

 I know about split -l, but as you said - it will work for lower panes
 only. any way to do it with top panes?

 as for the xterm command - most of the steps I can do on my own, i have
 problems only with the 10 lines requirement, and too small default
 *detached* window.

 Best regards,

 depesz


 --
 Protec

Re: 2 questions about working with tmux

2011-01-12 Thread Nicholas Marriott
Doesn't for me, what version on what platform?


On Wed, Jan 12, 2011 at 06:45:28PM -0500, mbm329 wrote:
> Also of note to the devs, there may be a bug with regards to the
> creation and detaching of a session within the same commandline.  It
> works, but yields the following output.
> 
> $ tmux new -s xxx \; detach
> fatal: main_dispatch: unexpected message
> 
> Mike
> 
> 
> On Wed, Jan 12, 2011 at 4:56 PM, mbm329  wrote:
> > Oops, since you're already attaching because you pretty much _have_
> > to, the "attach" can be removed from the line I gave:
> >
> > tmux new-session -s xxx 'perl test.pl' \; splitw -v \; split-window -v
> > \; resize-pane -U -t0 500 \; resize-pane -U -t1 500 \; resize-pane -D
> > -t0 8 \; resize-pane -D -t1 8 \; detach
> >
> > Mike
> >
> >
> > On Wed, Jan 12, 2011 at 4:51 PM, mbm329  wrote:
> >> Hi depesz,
> >>
> >> I too am evaluating tmux to see if it would be a suitable replacement
> >> of gnu screen.  Your questions are interesting to me as well.  As I've
> >> only been playing around with tmux for a few days, I decided to
> >> attempt a solution for you.  I am in no way an expert on this and
> >> expect I will be corrected shortly if I am wrong ;)
> >>
> >> It appears as though tmux gets it's own geometry for the panes from
> >> _your_ terminal session; and it's all relative to the terminal
> >> window's size.  You can see this by taking a small terminal window and
> >> sizing the panes exactly like you want, and then expand the terminal
> >> to full-screen.  You will see the number of lines/characters in each
> >> pane is different now.  They won't stick to the explicit 10 lines per
> >> pane you are hoping for.
> >>
> >> Here's a line that will work for you, I think.  But it will require
> >> you connect to a terminal to size them. I've tried setting resize-pane
> >> without an attach and it wouldn't work.
> >>
> >>  Basically, what this does is split the windows like you want, and
> >> then resize the first two panes upward to the smallest size (2 lines)
> >> by using an extreme size of 500 lines.  Following that, it will resize
> >> downward by 8 lines to give you a pane size of 10 lines.
> >>
> >> tmux new-session -s xxx 'perl test.pl' \; splitw -v \; split-window -v
> >> \; attach \; resize-pane -U -t0 500 \; resize-pane -U -t1 500 \;
> >> resize-pane -D -t0 8 \; resize-pane -D -t1 8 \; detach
> >>
> >> I know you were looking for a way to size them without connecting to a
> >> terminal, but I'm not sure you can get around that.  Patrick's
> >> solution with xterm is probably the closest you could get, and that
> >> would require at least an X-Server.
> >>
> >> xterm -geometry 178x53 -ls -e "tmux new-session -s xxx 'perl test.pl'
> >> \; split-window -v \; split-window -v \; attach \; resize-pane -U -t0
> >> 500 \; resize-pane -U -t1 500 \; resize-pane -D -t0 8 \; resize-pane
> >> -D -t1 8 \; detach"
> >>
> >> You can get your xterm geometry by starting a new session and running
> >> "tmux ls" and it will show you your window size.  Just +1 to the
> >> height.
> >>
> >> Good luck,
> >>
> >> Mike
> >>
> >>
> >> On Wed, Jan 12, 2011 at 1:02 PM, hubert depesz lubaczewski
> >>  wrote:
> >>> On Wed, Jan 12, 2011 at 12:58:27PM -0500, Patrick Shanahan wrote:
>  * hubert depesz lubaczewski  [01-12-11 11:53]:
>  >
>  > that is - I use 3 panels, split horizontally, with the top 2 having 
>  > predefined, fixed height of 10 lines.
>  >
>  > Now - I know I can make it myself, but running tmux, doing the split, 
>  > and then
>  > manually changing sizes of panes, but I'm looking for a script-based 
>  > way to do
>  > it.
>  >
>  > In general - I need a script that will:
>  > 1. check for existing session
>  > 2. if the session exists - exit
>  > 3. if it doesn't exist - make new one, detached
>  > 4. in the new session, on first window, make 3 panes, change their 
>  > sizes to 10 lines, 10 lines, rest
>  >
>  > i checked the docs and examples, and even bugged people on irc, but I 
>  > wasn't able to get to a way to do it.
> 
>  get an xterm window with size 136x52 at 575+20
>     black on white
>     title "Pakas Tmux ML"
>     attaches existing session or starts new if no existing
> 
>  xterm -geometry 136x52+575+20 -ls -bg white -fg black \
>        -title "Pakas Tmux ML" -e tmux -2u attach
> 
> 
> 
>  ~/.tmux.conf
>    split-window -v -l 10
>    swap-pane -U
>    split-window -v -l 10
> 
> 
>  will give you three panes but the two lowers will be 10 lines each
> >>>
> >>> I know about split -l, but as you said - it will work for lower panes
> >>> only. any way to do it with top panes?
> >>>
> >>> as for the xterm command - most of the steps I can do on my own, i have
> >>> problems only with the 10 lines requirement, and too small default
> >>> *detached* window.
> >>>
> >>> Best regards,
> >>>
> >>> depesz
> >>>
> >>>
> >>> ---

Re: 2 questions about working with tmux

2011-01-12 Thread Nicholas Marriott
alright, never mind :-)



On Wed, Jan 12, 2011 at 06:55:08PM -0500, mbm329 wrote:
> Nevermind, upgraded to the latest version.  This has been fixed.  My 
> apologies.
> 
> Mike
> 
> 
> On Wed, Jan 12, 2011 at 6:45 PM, mbm329  wrote:
> > Also of note to the devs, there may be a bug with regards to the
> > creation and detaching of a session within the same commandline.  It
> > works, but yields the following output.
> >
> > $ tmux new -s xxx \; detach
> > fatal: main_dispatch: unexpected message
> >
> > Mike
> >
> >
> > On Wed, Jan 12, 2011 at 4:56 PM, mbm329  wrote:
> >> Oops, since you're already attaching because you pretty much _have_
> >> to, the "attach" can be removed from the line I gave:
> >>
> >> tmux new-session -s xxx 'perl test.pl' \; splitw -v \; split-window -v
> >> \; resize-pane -U -t0 500 \; resize-pane -U -t1 500 \; resize-pane -D
> >> -t0 8 \; resize-pane -D -t1 8 \; detach
> >>
> >> Mike
> >>
> >>
> >> On Wed, Jan 12, 2011 at 4:51 PM, mbm329  wrote:
> >>> Hi depesz,
> >>>
> >>> I too am evaluating tmux to see if it would be a suitable replacement
> >>> of gnu screen.  Your questions are interesting to me as well.  As I've
> >>> only been playing around with tmux for a few days, I decided to
> >>> attempt a solution for you.  I am in no way an expert on this and
> >>> expect I will be corrected shortly if I am wrong ;)
> >>>
> >>> It appears as though tmux gets it's own geometry for the panes from
> >>> _your_ terminal session; and it's all relative to the terminal
> >>> window's size.  You can see this by taking a small terminal window and
> >>> sizing the panes exactly like you want, and then expand the terminal
> >>> to full-screen.  You will see the number of lines/characters in each
> >>> pane is different now.  They won't stick to the explicit 10 lines per
> >>> pane you are hoping for.
> >>>
> >>> Here's a line that will work for you, I think.  But it will require
> >>> you connect to a terminal to size them. I've tried setting resize-pane
> >>> without an attach and it wouldn't work.
> >>>
> >>>  Basically, what this does is split the windows like you want, and
> >>> then resize the first two panes upward to the smallest size (2 lines)
> >>> by using an extreme size of 500 lines.  Following that, it will resize
> >>> downward by 8 lines to give you a pane size of 10 lines.
> >>>
> >>> tmux new-session -s xxx 'perl test.pl' \; splitw -v \; split-window -v
> >>> \; attach \; resize-pane -U -t0 500 \; resize-pane -U -t1 500 \;
> >>> resize-pane -D -t0 8 \; resize-pane -D -t1 8 \; detach
> >>>
> >>> I know you were looking for a way to size them without connecting to a
> >>> terminal, but I'm not sure you can get around that.  Patrick's
> >>> solution with xterm is probably the closest you could get, and that
> >>> would require at least an X-Server.
> >>>
> >>> xterm -geometry 178x53 -ls -e "tmux new-session -s xxx 'perl test.pl'
> >>> \; split-window -v \; split-window -v \; attach \; resize-pane -U -t0
> >>> 500 \; resize-pane -U -t1 500 \; resize-pane -D -t0 8 \; resize-pane
> >>> -D -t1 8 \; detach"
> >>>
> >>> You can get your xterm geometry by starting a new session and running
> >>> "tmux ls" and it will show you your window size.  Just +1 to the
> >>> height.
> >>>
> >>> Good luck,
> >>>
> >>> Mike
> >>>
> >>>
> >>> On Wed, Jan 12, 2011 at 1:02 PM, hubert depesz lubaczewski
> >>>  wrote:
>  On Wed, Jan 12, 2011 at 12:58:27PM -0500, Patrick Shanahan wrote:
> > * hubert depesz lubaczewski  [01-12-11 11:53]:
> > >
> > > that is - I use 3 panels, split horizontally, with the top 2 having 
> > > predefined, fixed height of 10 lines.
> > >
> > > Now - I know I can make it myself, but running tmux, doing the split, 
> > > and then
> > > manually changing sizes of panes, but I'm looking for a script-based 
> > > way to do
> > > it.
> > >
> > > In general - I need a script that will:
> > > 1. check for existing session
> > > 2. if the session exists - exit
> > > 3. if it doesn't exist - make new one, detached
> > > 4. in the new session, on first window, make 3 panes, change their 
> > > sizes to 10 lines, 10 lines, rest
> > >
> > > i checked the docs and examples, and even bugged people on irc, but I 
> > > wasn't able to get to a way to do it.
> >
> > get an xterm window with size 136x52 at 575+20
> >    black on white
> >    title "Pakas Tmux ML"
> >    attaches existing session or starts new if no existing
> >
> > xterm -geometry 136x52+575+20 -ls -bg white -fg black \
> >       -title "Pakas Tmux ML" -e tmux -2u attach
> >
> >
> >
> > ~/.tmux.conf
> >   split-window -v -l 10
> >   swap-pane -U
> >   split-window -v -l 10
> >
> >
> > will give you three panes but the two lowers will be 10 lines each
> 
>  I know about split -l, but as you said - it will work for lower panes
>  only. any way to do it with top panes