Save Layout/Session with Working Directories

Save Layout/Session with Working Directories

This is an open feature request to Byobu author @Dustin Kirkland

Byobu can save layout, that is somewhat useful to me. But I would like to save working directories of the current layout as well. And even better, if it can re-run ssh logins or restore vim/emacs currently open files. With this feature, I can have a servers layout to login quickly to servers I usually work with, or open projectABC layout to quickly get to the project and start working from where I left off.

A quick search shows that this almost exact idea has been implemented with tmux-resurrect I just don't know how to use it with Byobu yet. One different thing, however, I want to save the layout or session with a specific name, not just one name for everything.

3

1 Answer

According to this article, a Ruby gem called teamocil seems to do exactly what I was asking

I summarize the essential parts here to preserve the content:

sudo gem install teamocil

Most probably, you will have different workflows for office and personal projects. Teamocil lets you to create predefined configuration for each case and you can setup your entire workspace just by launching the teamocil. You can create the teamocil configuration like ~/.teamocil or ~/.teamocil/office.yml, ~/.teamocil/personal.yml, etc. Say for example, when I start my work at office, I'll first move to my projects folders and make an update from version control systems. In some other terminals I'll connect to different servers, and so on. With Teamocil, I'll create a configuration file office.yml for office with $ teamocil --edit office and add the following content

session:
  name: "Office"
  windows:
    - name: "Local"
      root: "~/Workplace/office"
      layout: tiled
      panes:
        - cmd: ["ls"]
          focus: true
        - cmd: ["cd application; svn up ."]
        - cmd: ["cd monitor; git pull origin master"]
    - name: "Remote"
      root: "~/Workplace/office"
      layout: tiled
      panes:
        - cmd: ["ssh -i prodkey.pem "]
          focus: true
        - cmd: ["ssh -i testkey.pem "]
        - cmd: ["ssh -i devkey.pem "]

To launch this, first start a tmux session and from inside the tmux session run,

$ teamocil office
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.