tmuxp: Respawning panes and remain-on-exit

Using YAML, is there a way to respawn a pane and run the commands for that pane again?

I’ve tried:

session_name: respawnable
windows:
- window_name: watchers
  options:
    remain-on-exit: on
  layout: tiled
  panes:
    - shell_command:
        - ls
    - shell_command:
        - ls

I was expecting when I sent: respawn-pane -k for “ls” to reload. This is not the case.

Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (13 by maintainers)

Most upvoted comments

Thanks for the info. I will check it out this evening.

Regarding the use case for remain-on-exit. I use tmuxp to start a standard session with relevant tools I use. E.g. my mail client (neomutt) or an irc client (irssi). I want this tools to be always at the same place. So, when I have to restart them, I just quite them, as usual. The pane doesn’t vanish and I can just respawn-pane to get the application back running. Helpful also when I change e.g. configuration for those tools and just want them to restart again.

So, right now as a workaround I just use window_shell, as I don’t use split windows right now. But I can image using split windows and than I would need this pane shell configuration to make this possible.

Apart from that I like the idea of having the capabilities to specify the shell per pane (like in the example provided above).

I created a first implementation here https://github.com/jerri/tmuxp/tree/issue-139 . A demo file would look like this:

session_name: just-a-test
windows:
  - window_name: test window
    window_shell: /usr/bin/python2
    layout: even-horizontal
    suppress_history: false
    options:
      remain-on-exit: true
    panes:
      - shell: /usr/local/bin/python3
        shell_command:
          - print("Hello World")
      - shell: /bin/bash
        shell_command:
          - echo "Hello World, too"
      - shell_command:
          - print("Hello World 2")

I also fixed a bug with this code, I believe, because right now window_shell would only affect the first pane. Further panes created after the first pane would still use the default shell.

Next I would like to create a test for this addition. But I am not quite sure I fully understand, how the test system works and how you are testing against real tmux. Maybe someone can help me here. On top, unfortunately, the tests don’t seem to run through on my mac. The tests in test_workspacebuilder.py seem to hang at some point. Right now I can’t really see where.

On top, is this change actually relevant for the project? I found, that I can workaround my current problems using window_shell, but if you really would like to use remain-on-exit also for several panes, than the change I propose would be required.