diff --git a/docs/changelog.rst b/docs/changelog.rst index 6f0987383..d8d232854 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -20,6 +20,8 @@ To update |kitty|, :doc:`follow the instructions `. - Implement support for box drawing rounded-corners characters (:iss:`2240`) +- Allow setting the class for new OS windows in a session file + - When a character from the Unicode Dingbat block is followed by a space, use the extra space to render a larger version of the character (:iss:`2850`) diff --git a/docs/index.rst b/docs/index.rst index 7a1f50dba..cbdc53cfd 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -346,6 +346,8 @@ For example: new_os_window # set new window size to 80x25 cells os_window_size 80c 25c + # set the --class for the new OS window + os_window_class mywindow launch sh # Make the current window the active (focused) window focus diff --git a/kitty/boss.py b/kitty/boss.py index 4084f2e41..62f1f5090 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -195,7 +195,7 @@ class Boss: ) -> int: if os_window_id is None: opts_for_size = opts_for_size or getattr(startup_session, 'os_window_size', None) or self.opts - wclass = wclass or self.args.cls or appname + wclass = wclass or getattr(startup_session, 'os_window_class', None) or self.args.cls or appname with startup_notification_handler(do_notify=startup_id is not None, startup_id=startup_id) as pre_show_callback: os_window_id = create_os_window( initial_window_size_func(opts_for_size, self.cached_values), diff --git a/kitty/session.py b/kitty/session.py index c9bd78600..5d85bddd6 100644 --- a/kitty/session.py +++ b/kitty/session.py @@ -43,6 +43,7 @@ class Session: self.active_tab_idx = 0 self.default_title = default_title self.os_window_size: Optional[WindowSizeOpts] = None + self.os_window_class: Optional[str] = None def add_tab(self, opts: Options, name: str = '') -> None: if self.tabs and not self.tabs[-1].windows: @@ -124,6 +125,8 @@ def parse_session(raw: str, opts: Options, default_title: Optional[str] = None) from kitty.config_data import window_size w, h = map(window_size, rest.split(maxsplit=1)) ans.os_window_size = WindowSizeOpts(w, h, opts.window_margin_width, opts.window_padding_width, False) + elif cmd == 'os_window_class': + ans.os_window_class = rest else: raise ValueError('Unknown command in session file: {}'.format(cmd)) yield finalize_session(ans)