From 11dd7eeb8ecadecdce99f1490d366e8bd18eba2f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 17 Nov 2025 17:42:26 +0530 Subject: [PATCH] Have the --start-as flag be respected when used with --single-instance Fixes #9228 --- docs/changelog.rst | 3 +++ kitty/boss.py | 3 ++- kitty/simple_cli_definitions.py | 9 ++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 2235f28f4..610fa93c6 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -165,6 +165,9 @@ Detailed list of changes - kitten @ ls: Also output the neighbors for every window (:disc:`9225`) +- Have the :option:`kitty --start-as` flag be respected when used with + :option:`kitty --single-instance` (:iss:`9228`) + 0.44.0 [2025-11-03] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/boss.py b/kitty/boss.py index 5dbcee872..d1d3efb87 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -941,9 +941,10 @@ class Boss: assert isinstance(window.launch_spec, LaunchSpec) launch(get_boss(), window.launch_spec.opts, window.launch_spec.args) continue + wstate = args.start_as if args.start_as and args.start_as != 'normal' else None os_window_id = self.add_os_window( session, wclass=args.cls, wname=args.name, opts_for_size=opts, startup_id=startup_id, - override_title=args.title or None) + override_title=args.title or None, window_state=wstate) if session.focus_os_window: focused_os_window = os_window_id if opts.background_opacity != get_options().background_opacity: diff --git a/kitty/simple_cli_definitions.py b/kitty/simple_cli_definitions.py index 1c73964ab..af40b4614 100644 --- a/kitty/simple_cli_definitions.py +++ b/kitty/simple_cli_definitions.py @@ -387,7 +387,7 @@ system-wide defaults for all users. You can use either :code:`-` or def kitty_options_spec() -> str: if not hasattr(kitty_options_spec, 'ans'): - OPTIONS = ''' + OPTIONS = """ --class --app-id dest=cls default={appname} @@ -484,7 +484,10 @@ without an actual window, use :option:`{appname} --start-as`=hidden. type=choices default=normal choices=normal,fullscreen,maximized,minimized,hidden -Control how the initial kitty window is created. +Control how the initial kitty OS window is created. Note that +this is applies to all OS Windows if you use the :option:`{appname} --session` +option to create multiple OS Windows. Any OS Windows state in +specified in the session file gets overriden. --position @@ -552,7 +555,7 @@ This option is deprecated in favor of the :opt:`watcher` option in --execute -e type=bool-set ! -''' +""" setattr(kitty_options_spec, 'ans', OPTIONS.format( appname=appname, conf_name=appname, listen_on_defn=listen_on_defn, grab_keyboard_docs=grab_keyboard_docs, wait_for_single_instance_defn=wait_for_single_instance_defn,