Skip to content

Load config appending windows in current active session #501

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

Closed
wants to merge 14 commits into from
Closed

Load config appending windows in current active session #501

wants to merge 14 commits into from

Conversation

emanuelhfarias
Copy link

I see some people requesting this feature (me included) #289 #373 and some even tried to add this functionality #374 #407 but those ideas never went from draft.

I decided to implement this feature maintaining the compatibility with features we already have (open attached and detached). The motivation to this feature is because I feel more productive seen everything I have opened as visible windows. I tried to use several sessions and switch-sessions using tmux shortcut C-b s but I didn't get use to it (maybe I will try again in the future).

Summarizing what this PR adds:
When you try to load a config file within a current open tmux session it will ask you if you want to:

  1. create a new session and attach?
  2. create a new session and detach?
  3. load config appending windows in the current active session?

To maintain the compatibility I didn't change the question, I just added another option to the user.

Already inside TMUX, switch to session? yes/no
Or (a)ppend windows in the current active session?
[y/n/a]:

If you anwser:
Yes it will attach
No will detach
Append will append windows in the same session

I also added the ability to force append using the CLI:
$ tmuxp load -a config

I hope to see this feature in tmuxp. Who else's want? 👆

@MagicDuck
Copy link

Me needs this as well 😍

@Wesmania
Copy link

+1, it's really convenient to setup just a single window with a few panes without creating a new session.

@Wesmania
Copy link

It seems that the active session is not detected correctly. Something like this should work better:

    def find_current_attached_session(self):
        sid = self.server.cmd("display", "-pt", os.environ['TMUX_PANE'], "#{session_id}")
        return self.server.get_by_id(sid.stdout[0])

@nickwynja
Copy link

I also think it's helpful to switch to an existing session instead of throwing an error, like this: nickwynja@8db9026

@tony
Copy link
Member

tony commented Aug 16, 2020

@emanuelhfarias Hi there, sorry about this! Can I get another rebase?

I just merged #623 which moves us to a poetry packaging setup and will runs the PR through GitHub actions.

@wantguns
Copy link

Is this PR still active ? I would love to get this feature merged.
Awesome work with tmuxp btw

@tony
Copy link
Member

tony commented Dec 11, 2020

@emanuelhfarias Can you rebase this?

@emanuelhfarias
Copy link
Author

@emanuelhfarias Can you rebase this?

yes

@emanuelhfarias
Copy link
Author

I'm trying to rebase but the code has change a lot. It is difficult to solve all the conflicts and keep everything working. This PR is one year and a half old.
I'm not even using tmuxp anymore. If anyone wants this, the method that change the most is def load_workspace() from cli.py.

@tony
Copy link
Member

tony commented Dec 27, 2020 via email

@will-ockmore
Copy link
Contributor

Hey everyone, I've opened a new PR #656 with these changes, unfortunately I wasn't able to rebase your work without difficult to resolve conflicts @emanuelhfarias - I've credited you in the PR itself as it's almost entirely your work, I just added a bugfix and some cleanup. Thanks for opening this PR! I've been looking for this functionality. Hoping we can get it merged in 🤞

@tony tony self-requested a review January 6, 2021 13:56
@will-ockmore
Copy link
Contributor

This work has been merged in #656 🙌

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

Successfully merging this pull request may close these issues.

7 participants