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

Window names are no longer dynamic after restore #57

Closed
frontierpsycho opened this issue Nov 21, 2014 · 6 comments · Fixed by #401
Closed

Window names are no longer dynamic after restore #57

frontierpsycho opened this issue Nov 21, 2014 · 6 comments · Fixed by #401
Labels

Comments

@frontierpsycho
Copy link

I started using tmux-resurrect recently, and I really like it, but I seem to have a problem with window names.

Before I started using tmux-resurrect, window names would be updated based what was running in them at the time. When working on a resurrected session, however, the names of the resurrected windows never change: If I run vim on one of them, the name is still bash. If I quit vim on one that was already called vim (because it was running vim when I saved the session), its name keeps being vim.

@bruno- bruno- added the bug label Nov 21, 2014
@bruno-
Copy link
Member

bruno- commented Nov 21, 2014

Thanks for bringing this up..
In man tmux, the description for automatic-rename pretty clearly hints why this is happening:

This flag is automatically disabled for an individual window when a name is specified at creation with new-window or new-session...

When restoring the window, we are specifying it's name.. so that disables automatic rename.

Here's the possible high-level solution:

  • when doing a save, for each window also save its automatic-rename value.

    There does not seem to be FORMAT flag for this option so we'd have to manually iterate over windows and call tmux show-window-option -t "session_name:window_number" automatic-rename to see if it's on or off (or nothing, in which case global option is respected).
  • when doing a restore, do *not* restore window name if automatic-rename is on.

    This should be the easier step as it's just a simple if..else for 2 lines: here and here.

@frontierpsycho how do you feel about making a PR for this?
I'd be glad to help you with questions and anywhere you get stuck...

@bruno-
Copy link
Member

bruno- commented Nov 21, 2014

Another simpler solution:
We might as well just not restore window names if global automatic-rename is on. Window names will be restored automatically.

The downside of this solution is: if a user manually names one of the windows, that name won't get restored...

@frontierpsycho
Copy link
Author

I don't think I would have enough time to make a PR, unfortunately :) I am not at all familiar with the inner workings of tmux, and it would take me a lot of time.

@frontierpsycho
Copy link
Author

I like the first solution more, though.

Also, I see it's just bash scripting, after all. But still, I'm not sure I could spend the time, now. I'll let you know if that changes.

@rootulp
Copy link

rootulp commented May 5, 2016

Created a workaround to enable automatic-rename on all tmux windows

mayanksuman added a commit to mayanksuman/tmux-resurrect that referenced this issue Dec 20, 2017
@mayanksuman
Copy link

Submitted a pull request #222 that fix this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants