Skip to content

layout is broken on 1.3.4 #309

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
oblitum opened this issue Nov 4, 2017 · 18 comments
Closed

layout is broken on 1.3.4 #309

oblitum opened this issue Nov 4, 2017 · 18 comments

Comments

@oblitum
Copy link

oblitum commented Nov 4, 2017

With this simple configuration now the main window is always with width 2. It doesn't matter whether I set main-pane-width: 160 or not, it's always loaded in a strip of just 2 columns.

session_name: foo
windows:
- layout: main-vertical
  panes:
  - blank
  - blank

I'm using the package from AUR.

Issue is present both in vertical and horizontal layouts.

@oblitum oblitum changed the title main-vertical layout is broken on 1.3.4 layout is broken on 1.3.4 Nov 4, 2017
@oblitum
Copy link
Author

oblitum commented Nov 4, 2017

There's other strange behavior like character artifacts, etc.

@kageurufu
Copy link

Maintainer from the AUR here, I can reproduce without the AUR package, using a clean 3.6.3 virtualenv (--no-site-packages, etc)

tmux 2.6

@tony
Copy link
Member

tony commented Nov 8, 2017

I also get this.

But I think it has more to do with tmux 2.5, than tmuxp.

Can we get a confirmation on tmux versions? Anyone using tmux 2.4 or lower and seeing this?

@oblitum
Copy link
Author

oblitum commented Nov 8, 2017

I'm also on 2.6. It's what's on ArchLinux repos, and there's no option to downgrade due to dependencies.

@oblitum
Copy link
Author

oblitum commented Nov 8, 2017

But, by the way, it was fine on 1.3.2 on tmux 2.6.

@kageurufu
Copy link

I just build 2.3 through 2.6 on Arch from the ABS, heres the packages AND results for @oblitum's yaml. 2.6 has a 2-wide left pane, while 2.3 to 2.5 all show a 2px wide right pane. This is tmuxp installed in ~/.local with pip install --user tmuxp

tmux-2.3-1-x86_64.pkg.tar.gz
tmux-2 3

tmux-2.4-1-x86_64.pkg.tar.gz
tmux-2 4

tmux-2.5-1-x86_64.pkg.tar.gz
tmux-2 5

tmux-2.6-1-x86_64.pkg.tar.gz
tmux-2 6

@tony
Copy link
Member

tony commented Nov 9, 2017

  • Can I see your options? esp $ tmux showw | grep "main-pane"
  • So with other tmuxp versions (e.g. 1.3.3), it's ok?
  • what's the expected behavior vs what you get? are all tmux versions showing incorrect results with 1.3.4?

@oblitum
Copy link
Author

oblitum commented Nov 9, 2017

  • Can I see your options? esp $ tmux show | grep "main-pane"
    $ tmux show | grep "main-pane" shows nothing for me. tmux show just show status off. In any case, this is my .tmux.conf.

  • So with other tmuxp versions (e.g. 1.3.3), it's ok?
    I just tested with 1.3.2 and 1.3.4 lately. Only 1.3.4 presents the issue. It's the first time I see it since I've been using tmuxp from AUR, which has been for good time already, so it can be assumed 1.3.2 and earlier is fine regarding this.

  • what's the expected behavior vs what you get?
    The expected behavior is the previous, as it's documented, which are layouts loaded with respected width and height values, custom or default.

  • are all tmux versions showing incorrect results with 1.3.4?
    I think @kageurufu did a good job on displaying many tmux versions running tmuxp 1.3.4.

@tony
Copy link
Member

tony commented Nov 9, 2017

The only thing I have to mention is setting a main-pane-height, e.g. https://github.com/tony/tmuxp/blob/master/.tmuxp.yaml#L11

I'm going to check this again in the morning (need z's). We need to check the history to see what caused it.

1.3.2 is OK for sure right? https://tmuxp.git-pull.com/en/latest/history.html There hasn't been many changes between then and 1.3.4... And by the way I do get funky tmux window layouts, but that's after switching to tmux 2.5.

I'm wondering it could be something to do with tmux configurations and v2.5 (which would be ideal) because I haven't reproduced these things on my end. Though I set my options for main-pane-height with using main-vertical.

I'm guessing it would be main-pane-width if using main-horizontal?

@oblitum
Copy link
Author

oblitum commented Nov 9, 2017

@tony I got the issue both main-horizontal and main-vertical, so this doesn't matter. Yes I can state for sure, as I'm now frozen on 1.3.2 on pacman, this version is fine.

@tony
Copy link
Member

tony commented Nov 9, 2017

I am perplexed. Tomorrow morning I'm going to start giving this a look

@tony
Copy link
Member

tony commented Nov 9, 2017

I kept mentioning 2.5 last night, I meant 2.6.

Based on the discussion, this seems to be about tmuxp version.

I'm of the belief for some reason that it's more to do with 2.6's changes, namely how detached windows are treated (tmux/tmux#1106).

tmuxp creates workspaces detached. tmux 2.6 sets the dimensions of these workspaces to 80x24. This can cause issues when running stuff like select-layout in workspace builder, which is similar to the symptoms being described in this thread.

@tony
Copy link
Member

tony commented Nov 9, 2017

Debugging, writing down some thoughts:

Here's the issue, even if giving -x and -y to new-session (which we are already doing), the selectl commands don't stick until the real client is attached.

This poses a tricky issue. There are ways libtmux can pass a ; selectl after the session is attached (using semi-colon to do a multi-command). But that only will fix the first window.

The same applies for using hooks in various ways, for instance:

# from powerline (required)
run-shell "tmux set-environment -g TMUX_VERSION_MAJOR $(tmux -V | cut -d' ' -f2 | cut -d'.' -f1 | sed 's/[^0-9]*//g')"
run-shell "tmux set-environment -g TMUX_VERSION_MINOR $(tmux -V | cut -d' ' -f2 | cut -d'.' -f2 | sed 's/[^0-9]*//g')"

# on tmux 2.6 and greater, it's not possible to select-layout until client is attached
if-shell "test '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -ge 6\)'" 'set-hook -g client-attached "selectl"'
if-shell "test '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -ge 6\)'" 'set-hook -g after-select-window "selectl"'

This gets the layout running after attaching. And also the first windows you select after. But here's the issue, it always runs selectl, every time you move windows.

# -gu disables the hook after first run
if-shell "test '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -ge 6\)'" 'set-hook -g after-select-window "selectl; set-hook -gu after-select-window"'

This only will fix the first window you traverse to.

An idea to fix this universally. tmuxp can have a command like tmuxp windows foreach <cmd> which runs a commands for all windows in a session. If we make that run with a semicolon via run-shell, that may get us the prior behavior we had.

A second idea would be to use a pure shell command that unsets with set-hook client-attached "<cmd> set-hook -gu client-attached. This would give the same behavior with no perceptible difference to the user, and still allow detached building.

Another option would be to not build clients in a detached state.

tony added a commit that referenced this issue Nov 9, 2017
even after setting -x and -y with new-session, select-layout won't take
effect. However, it is necessary in 2.6 to get pane creation in detached
mode to work.

the only way found for tmux select-layout to take effect and prior
behavior to have viewed the window you are running "select-layout"
for in the client.

a solution has been devised to connect the client to the session, then
run select-layout on each window in the session. However, it's still not
enough to load the session, it seems the window must be selected by the client
at least once for the select-layout to take effect.

so a hook against the session is created for the session that selects each
window, runs select layout at the -t target for the window id. and after
that, the hook is neatly unset when that's finished.
@tony
Copy link
Member

tony commented Nov 9, 2017

Looking for testers: #312

@kageurufu
Copy link

kageurufu commented Nov 9, 2017

#312 is showing the same behavior as 2.5 and below, heres a new screenshot
screenshot from 2017-11-09 14-32-34

My tmux config can be found in https://github.com/kageurufu/dotfiles/tree/master/tmux if its relevant

With larger consoles, cols >=161, I get equal panes left and right. When I have <161, It attempts to keep the left pane 80 wide

@tony
Copy link
Member

tony commented Nov 9, 2017

An also, can you give your tmux -V and copy/paste your options in that window?

Inside that pane, what's the output of:

  • the tmuxp yaml file
  • $ tmux show-window-options
  • $ tmux show-options
  • $ tmux show-window-options
  • $ tmux show-options -g
  • $ tmux show-window-options -g

@kageurufu
Copy link

the tmuxp yaml file

session_name: foo
windows:
- layout: main-vertical
  panes:
  - blank
  - blank

$ tmux -V

tmux 2.6

$ tmux show-window-options

automatic-rename off

$ tmux show-options

No output

$ tmux show-options -g

@plugin "dominikduda/tmux_mode_indicator"
@tmux_mode_indicator_left_edge_character ""
@tmux_mode_indicator_separator "✤"
activity-action other
assume-paste-time 1
base-index 1
bell-action any
default-command ""
default-shell "/usr/bin/zsh"
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 50000
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 C-b
prefix2 None
renumber-windows off
repeat-time 500
set-titles off
set-titles-string "#S:#I:#W - \"#T\" #{session_alerts}"
silence-action other
status on
status-interval 5
status-justify left
status-keys emacs
status-left "[#S] "
status-left-length 10
status-left-style default
status-position bottom
status-right "#[fg=colour33,bg=#626262]#[bg=colour33,fg=#000000] #[bg=colour33]#{?client_prefix,#[fg=colour226]PREFIX PRESSED,#[fg=#000000]NORMAL} #[fg=#000000]✤ #[bg=colour33]#{?pane_in_mode,#[fg=colour82]COPY,#[fg=#000000]INSERT} #[bg=colour33,fg=#626262]#[bg=#626262,fg=#000000]"
status-right-length 40
status-right-style default
status-style fg=colour136,bg=colour235
update-environment[0] "DISPLAY"
update-environment[1] "SSH_ASKPASS"
update-environment[2] "SSH_AUTH_SOCK"
update-environment[3] "SSH_AGENT_PID"
update-environment[4] "SSH_CONNECTION"
update-environment[5] "WINDOWID"
update-environment[6] "XAUTHORITY"
visual-activity off
visual-bell off
visual-silence off
word-separators " -_@"

$ tmux show-window-options -g

aggressive-resize on
allow-rename on
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
force-height 0
force-width 0
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=colour240
pane-base-index 1
pane-border-format "#{?pane_active,#[reverse],}#{pane_index}#[default] \"#{pane_title}\""
pane-border-status off
pane-border-style fg=colour235
remain-on-exit off
synchronize-panes off
window-active-style default
window-status-activity-style reverse
window-status-bell-style reverse
window-status-current-format "#I:#W#{?window_flags,#{window_flags}, }"
window-status-current-style fg=colour166
window-status-format "#I:#W#{?window_flags,#{window_flags}, }"
window-status-last-style default
window-status-separator " "
window-status-style fg=colour244
window-style default
wrap-search on
xterm-keys on

@tony
Copy link
Member

tony commented Nov 9, 2017

@kageurufu Okay, I created a sample config:

session_name: example2
start_directory: ./ # load session relative to config location (project root).
windows:
- window_name: try out vertical
  focus: True
  layout: main-vertical
  options:
    main-pane-width: 100
  panes:
  - focus: true
  - pane
  - pane
- window_name: try out horizontal
  layout: main-horizontal
  options:
    main-pane-height: 35
  panes:
  - focus: true
  - pane
  - pane

I can confirm what you see.

screen shot 2017-11-09 at 3 42 13 pm

screen shot 2017-11-09 at 3 42 20 pm

tony added a commit that referenced this issue Nov 9, 2017
Per the feedback from:

- #309 (comment)
- #312 (comment)

and verified by me with:

- #309 (comment)

main-pane-width/height wasn't being respected when using targets with
selectl.
tony added a commit that referenced this issue Nov 10, 2017
attempt at fixing #309 layout issues with tmux 2.6
tony added a commit to tmux-python/libtmux that referenced this issue Nov 10, 2017
@oblitum oblitum closed this as completed Nov 10, 2017
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

No branches or pull requests

3 participants