Have the --start-as flag be respected when used with --single-instance

Fixes #9228
This commit is contained in:
Kovid Goyal 2025-11-17 17:42:26 +05:30
parent 4ea6862dd3
commit 11dd7eeb8e
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 11 additions and 4 deletions

View file

@ -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]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -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:

View file

@ -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,