tmux-python / tmuxp

🖥️ Session manager for tmux, build on libtmux.
https://tmuxp.git-pull.com/
MIT License
4.04k stars 231 forks source link

Builder: Use `shutil.get_terminal_size()` #926

Closed tony closed 5 months ago

tony commented 5 months ago

in re: #667, #704, #737

[!WARNING] This would definitely be breaking behavior.

Test instructions

Latest (1.46.0a0):

pipx install --suffix=@builder-sizes 'tmuxp >= 1.46.0a0'

Outdated:

pipx install --suffix=@builder-sizes 'tmuxp @ git+https://github.com/tmux-python/tmuxp.git@builder-sizes'

Then:

tmuxp@builder-sizes load ./path/to/file.yaml

In the configuration, use options.main-pane-height / options.main-pane-width with or without percentage:

session_name: main-pane-height
start_directory: "~"
windows:
  - layout: main-horizontal
    options:
      main-pane-height: 67%
    panes:
      - shell_command:
          - pane
        start_directory: "~"
      - shell_command:
          - echo "hey"
      - shell_command:
          - echo "moo"
    window_name: my window name

You should see something like:

image

Video:

https://github.com/tmux-python/tmuxp/assets/26336/abdcf8b3-5c6c-4117-a2fe-298f2004dd0d

Changes

[Builder] Use shutil.get_terminal_size

This ensures the tmux builder obeys the terminal window's current dimensions.

CLI[Load] Remove layout hooks

These did not seem to be implemented correctly anyway, so will effectively be a noop.

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 91.66667% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 70.19%. Comparing base (f4b392c) to head (cd5d114).

Files Patch % Lines
src/tmuxp/workspace/builder.py 91.66% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #926 +/- ## ========================================== - Coverage 70.28% 70.19% -0.09% ========================================== Files 26 26 Lines 1955 1936 -19 Branches 409 404 -5 ========================================== - Hits 1374 1359 -15 Misses 454 454 + Partials 127 123 -4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.