Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tmux integration with iTerm didn't working with `setw -g aggressive-resize on` #24

Open
iAdramelk opened this issue Jun 27, 2015 · 19 comments

Comments

@iAdramelk
Copy link

commented Jun 27, 2015

iTerm is Terminal alternative form Mac OS X. It has from the box integration with tmux: https://gitlab.com/gnachman/iterm2/wikis/TmuxIntegration

Then you try to reattach to session in iTerm while using tmux-sensible it didn't work because of the tmux-sensible. It just shows message: «The "aggressive-resize" option is turned on in tmux. It is not compatible with the iTerm2-tmux integration. Please disable it and try again.» and exits.

@m1foley

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2015

I'm able to reproduce this: when I ran tmux -CC in iTerm 2.1.1, it gave me that warning and exited. It worked when I added setw -g aggressive-resize off to my .tmux.conf.

I'd assume there's enough Mac users using iTerm integration mode to question whether aggressive-resize is in the "options that should be acceptable to everyone".

@bruno-

This comment has been minimized.

Copy link
Member

commented Jun 29, 2015

Hey guys,
first of all, thanks for reporting. Yea this definitely doesn't look too sensible at first sight.

I updated iterm to the latest version 2.1.1 and indeed, when ran with tmux -CC I get the message about aggressive-resize being unsupported.

A quick solution to the problem would be to test if user's terminal is iterm: [[ "$TERM_PROGRAM" =~ ^iTerm ]]. Based on that, we can skip setting aggressive-resize 'on'. Ideally, we would also wanna check if tmux is ran in CONTROL MODE - do you know if we can get this info somehow?

On the other hand I was playing with iterm-tmux integration mode and man - it's very very very limited. Does any one of you actually use this?

I also tested running "regular" tmux (no control mode) in iterm and everything works just fine with it.

@iAdramelk

This comment has been minimized.

Copy link
Author

commented Jun 29, 2015

Hi, Bruno!

Yes, I'm using tmux+iTerm integration on practice. But I'm mostly use it for local development, so I'm not very representative.

Unfortunately I don't know how to check for CONTROL MODE.

@bruno-

This comment has been minimized.

Copy link
Member

commented Jun 29, 2015

Hey,
thanks for the prompt response.

Give me some time to try to figure control mode detection. If nothing, we'll fallback to just checking iterm as aggressive-resize is not that important option.

bruno- pushed a commit that referenced this issue Jun 29, 2015

Bruno Sutic
@bruno-

This comment has been minimized.

Copy link
Member

commented Jun 29, 2015

This issue should now be fixed on iterm2. Just pull the latest tmux-sensible and let me know if all is ok?

I asked on #tmux irc group and the tmux maintainer (Thomas) said detecting control mode is currently not possible. This means aggressive-resize will be off when using tmux old-school way (no special integration mode).

On the up side, implementing the control mode detection was easy so Thomas just made a patch. Suggestion to merge this to tmux core is here.

If this is merged, then a test for checking if control mode is used will be something like this [ "$(tmux display -p -F "#{client_control_flag}")" != "0" ].
Let's leave the issue open till we see what happens with the patch.

@m1foley

This comment has been minimized.

Copy link
Contributor

commented Jun 29, 2015

To answer your question: I use tmux + iTerm professionally, and I've seen other developers doing so as well, and this is the first time I've heard of iTerm integration mode. Given the limitations of the feature, I'm guessing it's for developers who want to occassionally use tmux to pair program, but are too intimidated/lazy to learn tmux commands.

The proposed fix will inconvenience me, but I don't know if we have much of a choice: I'd guess that most developers on Macs use iTerm as their terminal, so even if a small percentage of them use integration mode that's still a lot of people.

@bruno-

This comment has been minimized.

Copy link
Member

commented Jun 29, 2015

Thanks for the sharing the details @m1foley.

The proposed fix will inconvenience me

Can you explain this a little bit? From what I know aggressive-resize on is useful with a multi-monitor setup when each screen has it's own terminal attached to the same tmux server. You have this setup?

@m1foley

This comment has been minimized.

Copy link
Contributor

commented Jun 29, 2015

Now that I've read the documentation, I was wrong about that -- I don't use aggressive-resize on.

@magicalbanana

This comment has been minimized.

Copy link

commented Sep 10, 2015

So is this supported? I do have a multi monitor setup and it would be the bomb if this was working with iterm2 since I have a script that opens a bunch of tmux sessions within VM's or remote servers.

@magicalbanana

This comment has been minimized.

Copy link

commented Oct 20, 2015

Any news onm this front? Would love to know if this will be a feature released soon. Perhaps I can help out if this is in the back burner.

@bruno-

This comment has been minimized.

Copy link
Member

commented Oct 21, 2015

Hey @magicalbanana,
this is not really a feature, just a tmux option we thought was sensible, but it turns out there were problems with it.

If you're NOT using iterm this is already working for you. If you ARE using iterm (but not its control mode) then just add set-window-option -g aggressive-resize on to .tmux.conf and that's it.

@magicalbanana

This comment has been minimized.

Copy link

commented Oct 21, 2015

@bruno- yeah. I am familiar that it works with iterm2. What I thought would be possible was having that active AND be in control mode, because when that's active that's when it doesn't work.

@bruno-

This comment has been minimized.

Copy link
Member

commented Oct 21, 2015

Ah, ok.
I'm not sure when or IF this will be fixed. It depends solely on iterm2 and tmux core developers, maybe you wanna check with them?

Another solution would be to switch from iterm-tmux integration to "regular" tmux mode. Last time I checked iterm-tmux integration mode was very limited. Regular tmux has much more powerful set of features.

@magicalbanana

This comment has been minimized.

Copy link

commented Oct 21, 2015

How do you do regular tmux with iterm2?

@bruno-

This comment has been minimized.

Copy link
Member

commented Oct 21, 2015

This thread assumes you're starting tmux in control mode with: tmux -C under iterm.

"Regular tmux" usage assumes using just the tmux command.

@neohunter

This comment has been minimized.

Copy link

commented Feb 8, 2016

with tmux 2.1 I'm having this problem even when adding setw -g aggressive-resize off

@eapolinario

This comment has been minimized.

Copy link

commented Mar 2, 2016

was this ever resolved? I'm running iTerm 2.1.4 and tmux 2.1 and still seeing this.

@nonzer0

This comment has been minimized.

Copy link

commented Apr 28, 2016

@eapolinario if you're using prezto and like me and haven't updated in a while do a git pull. That fixed things for me.

@gukoff

This comment has been minimized.

Copy link

commented Oct 3, 2016

Tmux 2.3.0, the issue is still there after installing the Tmux Plugin Manager.
Fixed it by adding setw -g aggressive-resize off to the very last line in tmux.conf at the remote machine and running tmux source ~/.tmux.conf in the tmux window afterwards.

~/.tmux.conf

# Tmux plugin manager
set -g @plugin 'tmux-plugins/tpm'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

# Fixes iterm2 integration. Should go after "run '~/.tmux/plugins/tpm/tpm'"
setw -g aggressive-resize off

yurrriq added a commit to nix-hackers/nix-darwin that referenced this issue Dec 29, 2017

tmux: play nice with iTerm2
That is, don't use reattach-to-user-namespace. iTerm2 provides an option to
allow applications in the terminal to access the clipboard, as well as deeper
shell integration utilities, which obviate the need reattach-to-user-namespace.
What's more, iTerm2's tmux integration doesn't work with it nor when
aggressive-resize is on.

See also:

- https://iterm2.com/documentation-preferences.html
- https://iterm2.com/documentation-utilities.html
- https://iterm2.com/documentation-tmux-integration.html
- tmux-plugins/tmux-sensible#24

yurrriq added a commit to nix-hackers/nix-darwin that referenced this issue Dec 29, 2017

tmux: play nice with iTerm2
That is, don't use reattach-to-user-namespace. iTerm2 provides an option to
allow applications in the terminal to access the clipboard, as well as deeper
shell integration utilities, which obviate the need for
reattach-to-user-namespace. What's more, iTerm2's tmux integration doesn't work
with it, nor when aggressive-resize is on.

See also:

- https://iterm2.com/documentation-preferences.html
- https://iterm2.com/documentation-utilities.html
- https://iterm2.com/documentation-tmux-integration.html
- tmux-plugins/tmux-sensible#24

yurrriq added a commit to nix-hackers/nix-darwin that referenced this issue Jan 3, 2018

tmux: play nice with iTerm2
That is, don't use reattach-to-user-namespace. iTerm2 provides an option to
allow applications in the terminal to access the clipboard, as well as deeper
shell integration utilities, which obviate the need for
reattach-to-user-namespace. What's more, iTerm2's tmux integration doesn't work
with it, nor when aggressive-resize is on.

See also:

- https://iterm2.com/documentation-preferences.html
- https://iterm2.com/documentation-utilities.html
- https://iterm2.com/documentation-tmux-integration.html
- tmux-plugins/tmux-sensible#24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.