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

Unable to append more windows to existing session #674

Open
bedge opened this issue Apr 7, 2021 · 3 comments
Open

Unable to append more windows to existing session #674

bedge opened this issue Apr 7, 2021 · 3 comments

Comments

@bedge
Copy link

bedge commented Apr 7, 2021

I want to have a session names "envs" that I hang multiple windows off of, each with a few panes to connect to an target env.

Each time I run tmuxp load -y /Users/edgeb1/.tmux/<env filename> I expect to get a new window added to the same session.

Here's a snippet of the yaml for env1:

session_name: envs

windows:
- window_name: env1
  layout: tiled
  panes:
    - shell_command:
...

and repeated again for env2:

session_name: envs

windows:
- window_name: env2
  layout: tiled
  panes:
    - shell_command:
...

Identical, except for the window_name.

Such that my session tree should look like:

(0)   + a-local: 8 windows
(1)   - envs:
(2)   ├─> + 0: env1 (2 panes)
(3)   ├─>   1: env2 (2 panes) "~"

"a-local" is the default session.

I load these using:

tmuxp load -y /Users/edgeb1/.tmux/env1.yml
tmuxp load -y /Users/edgeb1/.tmux/env2.yml

But what happens is that only the 1st one loads.

Afterwards I have this:

(0)   + a-local: 8 windows
(1)   - envs:
(2)   ├─> + 0: env1 (2 panes)

Or, if I reverse the order of the commands and instead run:

tmuxp load -y /Users/edgeb1/.tmux/env2.yml
tmuxp load -y /Users/edgeb1/.tmux/env1.yml

Then I get this:

(0)   + a-local: 8 windows
(1)   - envs:
(2)   ├─> + 0: env2 (2 panes)

Same applies if I try load to yml files on the same cmdline:

[I] ➜ tmuxp load -y /Users/edgeb1/.tmux/env1.yml /Users/edgeb1/.tmux/env2.yml
[Loading] /Users/edgeb1/.tmux/env1.yml
Session created in detached state.
[Loading] /Users/edgeb1/.tmux/env2.yml

Note that this does work if I specify a unique session name for each yml:

session_name: env1

windows:
- window_name: env1
  layout: tiled
  panes:
    - shell_command:
...

and repeated again for env2:

session_name: env2

windows:
- window_name: env2
  layout: tiled
  panes:
    - shell_command:
...

Then I get:

(0)  + a-local: 8 windows
(1)  + nghc: 15 windows
(2)  - env1: 1 windows
(3)  └─> + 0: env1* (6 panes)
(4)  - env2: 1 windows (attached)
(5)  └─> + 0: env2*Z (6 panes)

AFAICT, I should be able to load additional yml configs that append new windows to an existing session.

It does "something" on the 2nd failed load is it always switches to the "envs" session, and shows the one window that's there.

I would expect to be able to load the same yml, say env1, over and over and keep getting new windows with the same name:

(0)  + a-local: 8 windows
(1)  + nghc: 15 windows
(2)  - env1: 1 windows
(3)  └─> + 0: env1* (6 panes)
(4)  └─> + 0: env1* (6 panes)
(5)  └─> + 0: env1* (6 panes)

but that doesn't work either. I can see the argument for not allowing duplicate session/window name instances, but the with unique window names it should work.

Step 2: Provide tmuxp details

  • Include output of tmuxp debug-info
[I] ➜ tmuxp debug-info
-------------------------
environment:
        dist: macOS-10.15.7-x86_64-i386-64bit
        arch: x86_64
        uname: Darwin; edgeb1-F0MD6R; 19.6.0
        version: Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64
-------------------------
python version: 3.9.0 (default, Dec  9 2020, 10:07:40)  [Clang 12.0.0 (clang-1200.0.32.27)]
system PATH: /Users/edgeb1/.pyenv/versions/3.9.0/bin:/usr/local/Cellar/pyenv/1.2.26/libexec:/usr/local/Cellar/pyenv/1.2.26/plugins/python-build/bin:/Users/edgeb1/.rbenv/shims:/Users/edgeb1/.pyenv/shims:/Users/edgeb1/.bin:/Users/edgeb1/venv/p3/bin:/usr/local/bin/aws:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/gnu-which/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/gawk/libexec/gnubin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/sbin:/usr/local/bin:.git/safe/../../bin:/Users/edgeb1/venv/p3/bin/aws:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/share/dotnet:/opt/X11/bin:/Library/Apple/usr/bin:/Users/edgeb1/.zinit/plugins/vim---vim/src:/Users/edgeb1/.zinit/plugins/docker---compose:/Users/edgeb1/.zinit/plugins/junegunn---fzf-bin:/Users/edgeb1/.zinit/polaris/bin:/Users/edgeb1/.fzf/bin
tmux version: 3.1
libtmux version: 0.8.5
tmuxp version: 1.7.2
tmux path: /usr/local/bin/tmux
tmuxp path: /Users/edgeb1/.pyenv/versions/3.9.0/lib/python3.9/site-packages/tmuxp/__init__.py
shell: /usr/local/bin/zsh
-------------------------
tmux sessions:
        a-local: 8 windows (created Tue Apr  6 08:48:19 2021)
        nghc: 15 windows (created Tue Apr  6 08:48:19 2021) (attached)

tmux windows:
        0: nghcZ (2 panes) [198x58] [layout 2148,198x58,0,0{99x58,0,0,8,98x58,100,0,58}] @8
        1: zsh (1 panes) [198x58] [layout e991,198x58,0,0,60] @32
        2: tess (1 panes) [198x58] [layout 698f,198x58,0,0,10] @10
        3: git* (1 panes) [198x58] [layout 6990,198x58,0,0,11] @11 (active)
        4: sb (1 panes) [198x58] [layout 6991,198x58,0,0,12] @12
        5: sb2 (1 panes) [198x58] [layout 6992,198x58,0,0,13] @13
        6: sb3 (1 panes) [198x58] [layout 6993,198x58,0,0,14] @14
        7: dev (1 panes) [198x58] [layout 6994,198x58,0,0,15] @15
        8: dev3 (1 panes) [198x58] [layout 6995,198x58,0,0,16] @16
        9: dev4 (1 panes) [198x58] [layout 6996,198x58,0,0,17] @17
        10: prd2 (1 panes) [198x58] [layout 6997,198x58,0,0,18] @18
        11: prd5x (1 panes) [198x58] [layout 6998,198x58,0,0,19] @19
        12: vnv5x (1 panes) [198x58] [layout e98f,198x58,0,0,20] @20
        13: jk (1 panes) [198x58] [layout e990,198x58,0,0,21] @21
        14: zsh- (2 panes) [198x58] [layout e334,198x58,0,0{99x58,0,0,118,98x58,100,0,273}] @46

tmux panes:
        1: [198x57] [history 1886/2000, 757552 bytes] %11 (active)

tmux global options:
        @logging-filename "#{session_name}-#{window_name}-#{pane_index}.log"
        @logging-path /Users/edgeb1/log/tmux/%Y-%m-%d
        @pane_resize 5
        @plugin christoomey/vim-tmux-navigator
        activity-action other
        assume-paste-time 1
        base-index 0
        bell-action any
        default-command "reattach-to-user-namespace -l /usr/local/bin/zsh"
        default-shell /usr/local/bin/zsh
        default-size 80x24
        destroy-unattached off
        detach-on-destroy on
        display-panes-active-colour colour33
        display-panes-colour colour166
        display-panes-time 1000
        display-time 4000
        history-limit 2000
        key-table root
        lock-after-time 0
        lock-command "lock -np"
        message-command-style fg=yellow,bg=black
        message-style fg=colour166,bg=colour235
        mouse on
        prefix `
        prefix2 Invalid#1fff00000000
        renumber-windows off
        repeat-time 500
        set-titles off
        set-titles-string "#S:#I:#W - \"#T\" #{session_alerts}"
        silence-action other
        status on
        status-bg default
        status-fg default
        status-format[0] "#[align=left range=left #{status-left-style}]#[push-default]#{T;=/#{status-left-length}:status-left}#[pop-default]#[norange default]#[list=on align=#{status-justify}]#[list=left-marker]<#[list=right-marker]>#[list=on]#{W:#[range=window|#{window_index} #{window-status-style}#{?#{&&:#{window_last_flag},#{!=:#{window-status-last-style},default}}, #{window-status-last-style},}#{?#{&&:#{window_bell_flag},#{!=:#{window-status-bell-style},default}}, #{window-status-bell-style},#{?#{&&:#{||:#{window_activity_flag},#{window_silence_flag}},#{!=:#{window-status-activity-style},default}}, #{window-status-activity-style},}}]#[push-default]#{T:window-status-format}#[pop-default]#[norange default]#{?window_end_flag,,#{window-status-separator}},#[range=window|#{window_index} list=focus #{?#{!=:#{window-status-current-style},default},#{window-status-current-style},#{window-status-style}}#{?#{&&:#{window_last_flag},#{!=:#{window-status-last-style},default}}, #{window-status-last-style},}#{?#{&&:#{window_bell_flag},#{!=:#{window-status-bell-style},default}}, #{window-status-bell-style},#{?#{&&:#{||:#{window_activity_flag},#{window_silence_flag}},#{!=:#{window-status-activity-style},default}}, #{window-status-activity-style},}}]#[push-default]#{T:window-status-current-format}#[pop-default]#[norange list=on default]#{?window_end_flag,,#{window-status-separator}}}#[nolist align=right range=right #{status-right-style}]#[push-default]#{T;=/#{status-right-length}:status-right}#[pop-default]#[norange default]"
        status-format[1] "#[align=centre]#{P:#{?pane_active,#[reverse],}#{pane_index}[#{pane_width}x#{pane_height}]#[default] }"
        status-interval 1
        status-justify centre
        status-keys vi
        status-left "#[fg=green]#H #[fg=black]• #[fg=green,bright]#(uname -r | cut -c 1-6)#[default]"
        status-left-length 20
        status-left-style default
        status-position bottom
        status-right "#[fg=green,bg=default,bright]#(tmux-mem-cpu-load) #[fg=red,dim,bg=default]#(uptime | cut -f 4-5 -d \" \" | cut -f 1 -d \",\") #[fg=white,bg=default]%a%l:%M:%S %p#[default] #[fg=blue]%Y-%m-%d"
        status-right-length 140
        status-right-style default
        status-style bright
        update-environment[0] DISPLAY
        update-environment[1] KRB5CCNAME
        update-environment[2] SSH_ASKPASS
        update-environment[3] SSH_AUTH_SOCK
        update-environment[4] SSH_AGENT_PID
        update-environment[5] SSH_CONNECTION
        update-environment[6] WINDOWID
        update-environment[7] XAUTHORITY
        visual-activity off
        visual-bell off
        visual-silence off
        word-separators " "

tmux window options:
        aggressive-resize off
        allow-rename off
        alternate-screen on
        automatic-rename on
        automatic-rename-format "#{?pane_in_mode,[tmux],#{pane_current_command}}#{?pane_dead,[dead],}"
        clock-mode-colour colour64
        clock-mode-style 24
        main-pane-height 24
        main-pane-width 80
        mode-keys vi
        mode-style fg=black,bg=yellow
        monitor-activity off
        monitor-bell on
        monitor-silence 0
        other-pane-height 0
        other-pane-width 0
        pane-active-border-style fg=green
        pane-base-index 1
        pane-border-format "#{pane_index} #{pane_title}"
        pane-border-status bottom
        pane-border-style default
        remain-on-exit off
        synchronize-panes off
        window-active-style bg=colour234
        window-size latest
        window-style fg=colour247,bg=colour235
        window-status-activity-style reverse
        window-status-bell-style reverse
        window-status-current-format "  #{window_index} #{window_name}  "
        window-status-current-style fg=#000000,bg=yellow
        window-status-format "#{window_index} #{window_name}"
        window-status-last-style default
        window-status-separator " "
        window-status-style fg=brightblue
        wrap-search on
        xterm-keys on
  • Include any other pertinant system info not captured
[I] ➜ tmux -V
tmux 3.1c
@tony
Copy link
Member

tony commented Oct 29, 2022

It's been a long time since this was posted. Not sure if it's still the case or not - but I suppose so

Note that this does work if I specify a unique session name for each yml

So it worked then. If so, that makes sense with the current behavior.

Right now - tmuxp treats workspace files with the same session_name as already loaded. They need to be named differently. Perhaps we can change that assumption (I'm redoing the test infrastructure and loading code in other PRs)

@bedge
Copy link
Author

bedge commented Oct 30, 2022

@tony Appreciate the mental bandwidth of working through the post.

My argument for the change is be the ability to append to an existing session programmatically, vs needing to create a new session just to add a window, that really belonged on the existing session.

@tony
Copy link
Member

tony commented Oct 30, 2022

@bedge Got it

A PR at #839 may graze upon this issue

For this specific case:

Some underlying code in cli/load.py may need to be changed.

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

No branches or pull requests

2 participants