kovidgoyal/kitty · error · TypeError

The OS Window {os_window_id} is a panel and cannot be resize

Error message

The OS Window {os_window_id} is a panel and cannot be resized

What it means

Boss.resize_os_window raises TypeError when resizing an OS window that was created as a layer-shell desktop panel. Panels get their geometry from the layer-shell protocol, so programmatic resizing is disallowed.

Source

Thrown at kitty/boss.py:2005

            overlay_window.allow_remote_control = True

    def resize_layout_window(self, window: Window, increment: float, is_horizontal: bool, reset: bool = False) -> bool | None | str:
        tab = window.tabref()
        if tab is None or not increment:
            return False
        if reset:
            tab.reset_window_sizes()
            return None
        return tab.resize_window_by(window.id, increment, is_horizontal)

    def resize_os_window(self, os_window_id: int, width: int, height: int, unit: str, incremental: bool = False, metrics: 'None | OSWindowSize' = None) -> None:
        if not incremental and (width < 0 or height < 0):
            return
        metrics = get_os_window_size(os_window_id) if metrics is None else metrics
        if metrics is None:
            return
        if metrics['is_layer_shell']:
            raise TypeError(f'The OS Window {os_window_id} is a panel and cannot be resized')
        has_window_scaling = is_macos or is_wayland()
        w, h = get_new_os_window_size(metrics, width, height, unit, incremental, has_window_scaling)
        set_os_window_size(os_window_id, w, h)

    def tab_for_id(self, tab_id: int) -> Tab | None:
        for tm in self.os_window_map.values():
            tab = tm.tab_for_id(tab_id)
            if tab is not None:
                return tab
        return None

    def default_bg_changed_for(self, window_id: int, via_escape_code: bool = False) -> None:
        w = self.window_id_map.get(window_id)
        if w is not None:
            w.on_color_scheme_preference_change(via_escape_code=via_escape_code)
            tm = self.os_window_map.get(w.os_window_id)
            if tm is not None:
                tm.update_tab_bar_data()

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Filter out panel windows before resizing: check metrics['is_layer_shell']
  2. Configure panel size via the layer-shell config instead of resizing
  3. Target a specific non-panel os_window_id

Example fix

# before
for wid in boss.os_window_map: boss.resize_os_window(wid, 50, 50)
# after
for wid in boss.os_window_map:
    m = boss.os_window_size(wid)
    if not m.get('is_layer_shell'):
        boss.resize_os_window(wid, 50, 50)
Defensive patterns

Strategy: validation

Validate before calling

metrics = get_os_window_size(os_window_id)
if metrics and not metrics['is_layer_shell']:
    resize_os_window(os_window_id, w, h)

Type guard

def is_resizable_window(metrics: dict) -> bool:
    return bool(metrics) and not metrics.get('is_layer_shell')

Try / catch

try:
    resize_os_window(wid, w, h)
except TypeError as e:
    if 'cannot be resized' in str(e):
        pass  # panel window, skip
    else:
        raise

Prevention

When it happens

Trigger: Calling resize_os_window (e.g. via remote control `kitty @ resize-os-window`) on an os_window_id whose metrics report is_layer_shell=True.

Common situations: Scripts that iterate over all OS windows and resize them, hitting panel windows created for desktop panels/docks.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/538ca5b13da7eda3. Report an issue: GitHub.