Earlier quoted context omitted.
What's wrong with using reattach-to-user-namespace?
It involves compiling native code and its easier to do with a shell script?
Workflow in tmux
51–60 of 62 posts
Re: Workflow in tmux
#52Earlier quoted context omitted.
I used to do this all of the time in screen, but I haven't done so since switching to tmux (haven't run upon the situation). You've inspired me to look into it. First, terminology. I know that tmux has: servers, clients, windows, sessions, and panes, but I've never bothered to understand how they fit together. * server - The server is a process that listens on a unix socket, and accepts connections from clients. Each…
This is so much more complicated! When using byobu I use F3 and F4 to cycle to previous and next window. I can't understand why they think that by default I want all of the viewers to switch at once.
You could petition for an option to the `attach-session` command that automatically creates a new session grouped to the session that you're 'attaching' to. IIRC, you can't attach two 'clients' to the same (GNU) screen session unless you use the -x option, so it's not like it's the 'default' behaviour for screen either.
Edit:
I wasn't thinking, but `new-session` will automatically connect to the new session you created, so there is no need for an option to `attach-session`. So when you want to connect a second client, just:
# find the session you want
$ tmux list-sessions
# create a grouped session
$ tmux new-session -t SESSION_ID
Edit 2: | This is so much more complicated!
Depends. If you're using byobu, then you're already attempting to abstract away a bunch of the complexity of GNU screen, so it's not like you would find less complexity if you dove into the screen internals. It's also this design that makes it easier to do complex things that screen can't do with its windows. | When using byobu I use F3 and F4 to cycle to
| previous and next window.
Maybe you're misunderstanding. You still use the same tmux bindings to switch windows, it's just the setting up of the session that requires slightly more work when connecting a second client.Re: Workflow in tmux
#53Imagine having windows A, B, C, and D respectively in positions 0, 1, 2, and 3. I'd like to move D into position 1 so they end up in this order: A, D, B, C.
Haven't figured out how to pull this off yet.
Re: Workflow in tmux
#54Re: Workflow in tmux
#55Is there a way (short of writing a script) that will allow me to shuffle windows left and right, and/or move a window and slide the rest down? Imagine having windows A, B, C, and D respectively in positions 0, 1, 2, and 3. I'd like to move D into position 1 so they end up in this order: A, D, B, C. Haven't figured out how to pull this off yet.
bind-key ) swap-window -t +
bind-key ( swap-window -t -
So " (" swaps the active window with the one on its left, and " )" swaps it with the one on its right.It seems to be what you want.
Re: Workflow in tmux
#56Is there a way (short of writing a script) that will allow me to shuffle windows left and right, and/or move a window and slide the rest down? Imagine having windows A, B, C, and D respectively in positions 0, 1, 2, and 3. I'd like to move D into position 1 so they end up in this order: A, D, B, C. Haven't figured out how to pull this off yet.
I do it like this: bind-key ) swap-window -t + bind-key ( swap-window -t - So " (" swaps the active window with the one on its left, and " )" swaps it with the one on its right. It seems to be what you want.
Re: Workflow in tmux
#57Earlier quoted context omitted.
This is so much more complicated! When using byobu I use F3 and F4 to cycle to previous and next window. I can't understand why they think that by default I want all of the viewers to switch at once.
I think that the main issue that you're having is that 'active window' is an attribute of a session, and not of the client. If 'active window' were specific to a client, then two clients could switch windows independently while connected to the same session. You could petition for an option to the `attach-session` command that automatically creates a new session grouped to the session that you're 'attaching' to. IIRC…
I did switch it from screen to tmux because tmux definitely works better for other things and seems more responsive when there is lots of output. By default screen did let each client view independent of any other.
I don't see how to automate getting the behaviour I want (independent client views) as typing commands and feeding them into tmux would be a huge pain (especially as byobu is already doing that).
Re: Workflow in tmux
#58Earlier quoted context omitted.
This is so much more complicated! When using byobu I use F3 and F4 to cycle to previous and next window. I can't understand why they think that by default I want all of the viewers to switch at once.
Having the viewers switch by default is useful for demos, when you are showing something to someone. And it's the simplest behaviour for their data structure. So I can see some logic to why they designed it that way. I'm glad you raised this issue because I've only recently moved to tmux and would have been stung by it. Could you abstract it away behind a shell alias? I used this: alias tmuxc='tmux new-session -t 0'
Re: Workflow in tmux
#59Earlier quoted context omitted.
I think that the main issue that you're having is that 'active window' is an attribute of a session, and not of the client. If 'active window' were specific to a client, then two clients could switch windows independently while connected to the same session. You could petition for an option to the `attach-session` command that automatically creates a new session grouped to the session that you're 'attaching' to. IIRC…
Since I use byobu I neither know nor care what is going on under the hood. I use 4 keystrokes - F2 to start a new shell, F3 to cycle back, F4 to cycle forwards and ctrl-F5 to reconnect sockets (GPG agent, DBUS etc). I did switch it from screen to tmux because tmux definitely works better for other things and seems more responsive when there is lots of output. By default screen did let each client view independent of…
$ tmux.sh session-name
which would create the session the first time, and create a grouped session, the second time.Edit:
I've created a little script for this: https://github.com/bsandrow/tmux.sh
Re: Workflow in tmux
#60Earlier quoted context omitted.
Since I use byobu I neither know nor care what is going on under the hood. I use 4 keystrokes - F2 to start a new shell, F3 to cycle back, F4 to cycle forwards and ctrl-F5 to reconnect sockets (GPG agent, DBUS etc). I did switch it from screen to tmux because tmux definitely works better for other things and seems more responsive when there is lots of output. By default screen did let each client view independent of…
It really depends on what your workflow is. If you only ever have a single tmux session, then you could write a quick script that starts a session if it doesn't exist, but if it does, automatically creates a mirrored session and connects to it. In this workflow, you can assume which session you want to group with, but if you work with multiple sessions, then there is no way to automatically do this. E.g., you could r…