{"record":{"id":"538ca5b13da7eda3","repo":"kovidgoyal/kitty","slug":"the-os-window-os-window-id-is-a-panel-and-cannot","errorCode":null,"errorMessage":"The OS Window {os_window_id} is a panel and cannot be resized","messagePattern":"The OS Window (.+?) is a panel and cannot be resized","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"kitty/boss.py","lineNumber":2005,"sourceCode":"            overlay_window.allow_remote_control = True\n\n    def resize_layout_window(self, window: Window, increment: float, is_horizontal: bool, reset: bool = False) -> bool | None | str:\n        tab = window.tabref()\n        if tab is None or not increment:\n            return False\n        if reset:\n            tab.reset_window_sizes()\n            return None\n        return tab.resize_window_by(window.id, increment, is_horizontal)\n\n    def resize_os_window(self, os_window_id: int, width: int, height: int, unit: str, incremental: bool = False, metrics: 'None | OSWindowSize' = None) -> None:\n        if not incremental and (width < 0 or height < 0):\n            return\n        metrics = get_os_window_size(os_window_id) if metrics is None else metrics\n        if metrics is None:\n            return\n        if metrics['is_layer_shell']:\n            raise TypeError(f'The OS Window {os_window_id} is a panel and cannot be resized')\n        has_window_scaling = is_macos or is_wayland()\n        w, h = get_new_os_window_size(metrics, width, height, unit, incremental, has_window_scaling)\n        set_os_window_size(os_window_id, w, h)\n\n    def tab_for_id(self, tab_id: int) -> Tab | None:\n        for tm in self.os_window_map.values():\n            tab = tm.tab_for_id(tab_id)\n            if tab is not None:\n                return tab\n        return None\n\n    def default_bg_changed_for(self, window_id: int, via_escape_code: bool = False) -> None:\n        w = self.window_id_map.get(window_id)\n        if w is not None:\n            w.on_color_scheme_preference_change(via_escape_code=via_escape_code)\n            tm = self.os_window_map.get(w.os_window_id)\n            if tm is not None:\n                tm.update_tab_bar_data()","sourceCodeStart":1987,"sourceCodeEnd":2023,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/boss.py#L1987-L2023","documentation":"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.","triggerScenarios":"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.","commonSituations":"Scripts that iterate over all OS windows and resize them, hitting panel windows created for desktop panels/docks.","solutions":["Filter out panel windows before resizing: check metrics['is_layer_shell']","Configure panel size via the layer-shell config instead of resizing","Target a specific non-panel os_window_id"],"exampleFix":"# before\nfor wid in boss.os_window_map: boss.resize_os_window(wid, 50, 50)\n# after\nfor wid in boss.os_window_map:\n    m = boss.os_window_size(wid)\n    if not m.get('is_layer_shell'):\n        boss.resize_os_window(wid, 50, 50)","handlingStrategy":"validation","validationCode":"metrics = get_os_window_size(os_window_id)\nif metrics and not metrics['is_layer_shell']:\n    resize_os_window(os_window_id, w, h)","typeGuard":"def is_resizable_window(metrics: dict) -> bool:\n    return bool(metrics) and not metrics.get('is_layer_shell')","tryCatchPattern":"try:\n    resize_os_window(wid, w, h)\nexcept TypeError as e:\n    if 'cannot be resized' in str(e):\n        pass  # panel window, skip\n    else:\n        raise","preventionTips":["Always inspect window metrics for is_layer_shell before resizing","Target specific window ids rather than iterating all windows"],"tags":["kitty","resize","layer-shell","panel","remote-control"],"backgroundTag":"invalid-window-operation","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}