Skip to content

"Splits" layout not preserved #9

@mtalexan

Description

@mtalexan

In the splits layout, any number of kitty "windows" (panes) can be split vertically or horizontally and resized. This information is included in the JSON output of kitty @ ls, but is not used when generating the kitty layout description output. Windows don't seem to be movable beyond just forward/backward once created, so the split layout cannot be reconstructed manually after kitty is restored.


For example, I have 3 windows open in a splits layout, 2 split evenly left-right in the upper half of an OS window, and one full width in the lower half. The JSON output it gives is:

[
  {
    "background_opacity": 1.0,
    "id": 1,
    "is_active": true,
    "is_focused": true,
    "last_focused": true,
    "platform_window_id": 111149067,
    "tabs": [
      {
        "active_window_history": [
          2,
          3,
          1
        ],
        "enabled_layouts": [
          "splits",
          "tall",
          "horizontal",
          "grid",
          "stack"
        ],
        "groups": [
          {
            "id": 1,
            "windows": [
              1
            ]
          },
          {
            "id": 3,
            "windows": [
              3
            ]
          },
          {
            "id": 2,
            "windows": [
              2
            ]
          }
        ],
        "id": 1,
        "is_active": true,
        "is_focused": true,
        "layout": "splits",
        "layout_opts": {
          "default_axis_is_horizontal": true
        },
        "layout_state": {
          "pairs": {
            "bias": 0.5,
            "horizontal": false,
            "one": {
              "bias": 0.5,
              "horizontal": true,
              "one": 1,
              "two": 3
            },
            "two": 2
          }
        },
        "title": "kitty @ ls",
        "windows": [
          {
            "at_prompt": true,
            "cmdline": [
              "zsh"
            ],
            "columns": 106,
            "created_at": 1747074039165099410,
            "cwd": "**redacted 1**",
            "env": {
              "KITTY_WINDOW_ID": "1"
            },
            "foreground_processes": [
              {
                "cmdline": [
                  "zsh"
                ],
                "cwd": "**redacted 1**",
                "pid": 37579
              }
            ],
            "id": 1,
            "in_alternate_screen": false,
            "is_active": false,
            "is_focused": false,
            "is_self": false,
            "last_cmd_exit_status": 0,
            "last_reported_cmdline": "**redacted 2**",
            "lines": 51,
            "pid": 37579,
            "title": "**redacted 3**",
            "user_vars": {}
          },
          {
            "at_prompt": false,
            "cmdline": [
              "zsh"
            ],
            "columns": 213,
            "created_at": 1747074472395477308,
            "cwd": "**redacted 4**",
            "env": {
              "KITTY_WINDOW_ID": "2"
            },
            "foreground_processes": [
              {
                "cmdline": [
                  "kitten",
                  "@",
                  "ls"
                ],
                "cwd": "**redacted 4**",
                "pid": 40761
              }
            ],
            "id": 2,
            "in_alternate_screen": false,
            "is_active": true,
            "is_focused": true,
            "is_self": true,
            "last_cmd_exit_status": 0,
            "last_reported_cmdline": "kitty @ ls",
            "lines": 51,
            "pid": 40348,
            "title": "kitty @ ls",
            "user_vars": {}
          },
          {
            "at_prompt": true,
            "cmdline": [
              "zsh"
            ],
            "columns": 106,
            "created_at": 1747074482437066072,
            "cwd": "**redacted 5**",
            "env": {
              "KITTY_WINDOW_ID": "3"
            },
            "foreground_processes": [
              {
                "cmdline": [
                  "zsh"
                ],
                "cwd": "**redacted 5**",
                "pid": 40506
              }
            ],
            "id": 3,
            "in_alternate_screen": false,
            "is_active": false,
            "is_focused": false,
            "is_self": false,
            "last_cmd_exit_status": 0,
            "last_reported_cmdline": "**redacted 6**",
            "lines": 51,
            "pid": 40506,
            "title": "**redacted 7**",
            "user_vars": {}
          }
        ]
      }
    ],
    "wm_class": "kitty",
    "wm_name": "kitty"
  }
]

(I've redacted some paths, titles, and last-command-run, but numbered the redactions to indicate when the same value was redacted in different places).


The "grouping" of the windows seems to affect how the bias is applied. There's some support for defining splits via the launch command, but it's unclear how the grouping could be replicated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions