Skip to content

WorkspaceBuilder creates "main-horizontal" layout with a very thin main pane #667

Open
@cblegare

Description

@cblegare

Step 1: Provide a summary of your problem

I am trying to use tmuxp.workspacebuilder.WorkspaceBuilder with a simple main-horizontal 3-panes scenario and the created result has the main pane of 1 line high.

  • When invoked from command line with a yaml config file, the issue is not reproduced.
  • When configrued with an explicit layout, the issue is not reproduced (see configurations below)

Step 2: Provide tmuxp details

➜ tmuxp debug-info
-------------------------
environment:
        dist: Linux-5.4.0-65-generic-x86_64-with-glibc2.29
        arch: x86_64
        uname: Linux; exfo7255; 5.4.0-65-generic
        version: #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021
-------------------------
python version: 3.8.7 (default, Feb  2 2021, 16:09:27)  [GCC 9.3.0]
system PATH: <REDACTED>/.venv/bin:<REDACTED>
tmux version: 3.0
libtmux version: 0.8.5
tmuxp version: 1.7.2
tmux path: /usr/bin/tmux
tmuxp path:<REDACTED>/.venv/lib/python3.8/site-packages/tmuxp/__init__.py
shell: /usr/bin/zsh
-------------------------
tmux sessions:
        myproject: 1 windows (created Thu Feb 18 20:48:37 2021) (attached)

tmux windows:
        0: mainwindow* (3 panes) [189x53] [layout 0ecd,189x53,0,0[189x1,0,0,81,189x51,0,2{93x51,0,2,82,95x51,94,2,83}]] @37 (active)

tmux panes:
        0: [189x1] [history 14/2000, 9178 bytes] %81
        1: [93x51] [history 13/2000, 6476 bytes] %82 (active)
        2: [95x51] [history 14/2000, 6613 bytes] %83

tmux global options:
        activity-action other
        assume-paste-time 1
        base-index 0
        bell-action none
        default-command
        default-shell /usr/bin/zsh
        default-size 80x24
        destroy-unattached off
        detach-on-destroy on
        display-panes-active-colour red
        display-panes-colour blue
        display-panes-time 1000
        display-time 750
        history-limit 2000
        key-table root
        lock-after-time 0
        lock-command "lock -np"
        message-command-style fg=yellow,bg=black
        message-style fg=black,bg=yellow
        mouse on
        prefix C-a
        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-bg green
        status-fg black
        status-format[0] "#[align=left range=left #{status-left-style}]#{T;=/#{status-left-length}:status-left}#[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},}}]#{T:window-status-format}#[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},}}]#{T:window-status-current-format}#[norange list=on default]#{?window_end_flag,,#{window-status-separator}}}#[nolist align=right range=right #{status-right-style}]#{T;=/#{status-right-length}:status-right}#[norange default]"
        status-format[1] "#[align=centre]#{P:#{?pane_active,#[reverse],}#{pane_index}[#{pane_width}x#{pane_height}]#[default] }"
        status-interval 15
        status-justify left
        status-keys vi
        status-left "[#S] "
        status-left-length 10
        status-left-style default
        status-position bottom
        status-right "#{?window_bigger,[#{window_offset_x}#,#{window_offset_y}] ,}\"#{=21:pane_title}\" %H:%M %d-%b-%y"
        status-right-length 40
        status-right-style default
        status-style fg=black,bg=green
        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 blue
        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 0
        pane-border-format "#{?pane_active,#[reverse],}#{pane_index}#[default] \"#{pane_title}\""
        pane-border-status off
        pane-border-style default
        remain-on-exit off
        synchronize-panes off
        window-active-style default
        window-size smallest
        window-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 default
        window-status-format "#I:#W#{?window_flags,#{window_flags}, }"
        window-status-last-style default
        window-status-separator " "
        window-status-style default
        wrap-search on
        xterm-keys on

Step 3: Describe the problem:

Steps to reproduce:

Run the following script

import tmuxp.workspacebuilder
import tmuxp.config
import libtmux.server
import libtmux.exc

tmuxp_config = {}  # see below

builder = tmuxp.workspacebuilder.WorkspaceBuilder(
    tmuxp.config.trickle(
        tmuxp.config.expand(tmuxp_config, ".")
    ),
    server=libtmux.server.Server()
)
try:
    builder.build()
except libtmux.exc.TmuxSessionExists:
    builder.build(builder.session)
builder.session.attach_session()
for plugin in builder.plugins:
    plugin.before_script(builder.session)

Observed Results:

Three panes are nicely, but the main (top) one has only one line of heigth

Expected Results:

Panes created with configured size.

Relevant Code:

tmuxp_config = {
    "session_name": "myproject",
    "start_directory": ".",
    "shell_command_before": [],
    "windows": [
        {
            "window_name": "mainwindow",
            "focus": True,
            ### this "abstract" layout reproduces the issue
            "layout": "main-horizontal",
            ### This "specific" layout does not reproduces the issue
            # "layout": "3951,189x53,0,0[189x35,0,0,51,189x17,0,36{94x17,0,36,52,94x17,95,36,53}]"
            "options": {
                "main-pane-height": 35
            },
            "panes": [
                "pane",
                "pane",
                "pane"
            ]
        }
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions