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

Feature: Add pane names #928

Merged
merged 6 commits into from
Dec 9, 2021
Merged

Feature: Add pane names #928

merged 6 commits into from
Dec 9, 2021

Conversation

kunalmohan
Copy link
Member

fix #850
Users can add names to panes from the layout and rename them at runtime.

- direction: Vertical
  pane_name: zellij-main

At runtime, user can press "c" in pane mode to rename a pane.

Pane name (set by user), when set, is preferred and displayed over pane title (set by terminal applications).

Copy link
Contributor

@a-kenji a-kenji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, works great!

I think in the future it would be good to find a solution that could unify the handling
of the TabName and PaneName inputs, and similar ones.
But that is totally a different issue.

@kunalmohan kunalmohan merged commit c75bcbd into main Dec 9, 2021
@kunalmohan kunalmohan deleted the pane-name branch December 9, 2021 18:00
@gilesknap
Copy link

gilesknap commented Jan 18, 2022

@kunalmohan - thanks for this feature, its just what I need. Only I can't get it to work in 0.24.0.

Please could you comment on what I'm doing wrong?

I'm launching with the yaml below as follows

zellij --layout-path PATH_TO_YAML

Thanks

---
# this template is for the root Pane on each tab. It provides the 
# header tab-bar and footer status-bar
template:
  direction: Horizontal
  parts:
    - direction: Vertical  # part 1
      borderless: true
      split_size:
        Fixed: 1
      run:
        plugin:
          location: "zellij:tab-bar"
    - direction: Vertical # part 2
      body: true
    - direction: Vertical # part 3
      borderless: true
      split_size:
        Fixed: 2
      run:
        plugin:
          location: "zellij:status-bar"
# this does not work - the docs don't specify at which level to place session
session:
  name: "k8s-session"
  attach: true
tabs:
  - name: "K8s Monitor"
    direction: Vertical
    parts:
      - direction: Horizontal
        borderless: true
        parts:
          - split_size:
              Fixed: 3
            borderless: true
            run:
              command: {cmd: ssh, args: ["-t", "pi1", "watch -t \"hostname && vcgencmd measure_temp\""]}
          - pane_name: pi1
            split_size:
              Percent: 30
            run:
              command: {cmd: ssh, args: ["-t", "pi1", "top && bash"]}
          - run:
              command: {cmd: ssh, args: ["-t", "pi1", "journalctl -fu k3s"]}
      - direction: Horizontal
        borderless: false
        parts:
          - split_size:
              Fixed: 3
            borderless: true
            run:
              command: {cmd: ssh, args: ["-t", "pi2", "watch -t \"hostname && vcgencmd measure_temp\""]}
          - split_size:
              Percent: 30
            run:
              command: {cmd: ssh, args: ["-t", "pi2", "top && bash"]}
          - run:
              command: {cmd: ssh, args: ["-t", "pi2", "journalctl -fu k3s"]}
      - direction: Horizontal
        borderless: false
        parts:
          - split_size:
              Fixed: 3
            borderless: true
            run:
              command: {cmd: ssh, args: ["-t", "pi3", "watch -t \"hostname && vcgencmd measure_temp\""]}
          - split_size:
              Percent: 30
            run:
              command: {cmd: ssh, args: ["-t", "pi3", "top && bash"]}
          - run:
              command: {cmd: ssh, args: ["-t", "pi3", "journalctl -fu k3s"]}
      - direction: Horizontal
        borderless: false
        parts:
          - split_size:
              Fixed: 3
            borderless: true
            run:
              command: {cmd: ssh, args: ["-t", "gknuc", "watch -t \"hostname && sensors | grep Package\""]}
          - split_size:
              Percent: 30
            run:
              command: {cmd: ssh, args: ["-t", "gknuc", "top && bash"]}
          - run:
              command: {cmd: ssh, args: ["-t", "gknuc", "journalctl -fu k3s"]}
        

@a-kenji
Copy link
Contributor

a-kenji commented Jan 19, 2022

Hey @gilesknap, thank you for reaching out!
Do you mind trying out this minimal example, if this works on your end?

---
template:
  direction: Horizontal
  parts:
    - direction: Vertical
      body: true
    - direction: Vertical
      borderless: true
      split_size:
        Fixed: 1
      run:
        plugin:
          location: "zellij:tab-bar"
session:
  name: zellij
  attach: true

Edit:

I tried to omit the commands from your setup and it seems that I get the behaviour
that you are going for:

image

Do you mind also testing this layout:

---
# this template is for the root Pane on each tab. It provides the 
# header tab-bar and footer status-bar
template:
  direction: Horizontal
  parts:
    - direction: Vertical  # part 1
      borderless: true
      split_size:
        Fixed: 1
      run:
        plugin:
          location: "zellij:tab-bar"
    - direction: Vertical # part 2
      body: true
    - direction: Vertical # part 3
      borderless: true
      split_size:
        Fixed: 2
      run:
        plugin:
          location: "zellij:status-bar"
# this does not work - the docs don't specify at which level to place session
session:
  name: "k8s-session"
  attach: true
tabs:
  - name: "K8s Monitor"
    direction: Vertical
    parts:
      - direction: Horizontal
        borderless: true
        parts:
          - split_size:
              Fixed: 3
            borderless: true
          - pane_name: pi1
            split_size:
              Percent: 30
          - split_size:
              Percent: 70
      - direction: Horizontal
        borderless: false
        parts:
          - split_size:
              Fixed: 3
            borderless: true
          - split_size:
              Percent: 30
          - split_size:
              Percent: 70
      - direction: Horizontal
        borderless: false
        parts:
          - split_size:
              Fixed: 3
            borderless: true
          - split_size:
              Percent: 30
          - split_size:
              Percent: 70
      - direction: Horizontal
        borderless: false
        parts:
          - split_size:
              Fixed: 3
            borderless: true
          - split_size:
              Percent: 30

@kunalmohan
Copy link
Member Author

Hey @gilesknap, sorry for the experience.
I tried out your layout and I too get results similar to @a-kenji's. Maybe the output of the above (simplified/minimal) layouts can help us debug the issue.

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

Successfully merging this pull request may close these issues.

Feature: add name to panes
3 participants