Add support for os_window_name in startup sessions.

You can now specify `os_window_name` in addition to `os_window_class` in
startup sessions.  It works for the initial session as well as new sessions
started with `new_os_window`.

Updated documentation in overview.rst to add `os_window_name` in the
Startup Session examples.

Although not related to this feature. The documentation in launch.py
was updated to note that the `launch --type` `tab` and `os-window` options
aren't supported when launch is invoked from a startup script.  There's
already a note to that effect in the "Startup Sessions" section in
overview.rst but if you're looking at the launch syntax page like I was,
you wouldn't realize the limitation. This was throwing me for a loop while
wotking on this PR.

Resolves: #8387
This commit is contained in:
George Joseph
2025-03-02 13:52:21 -07:00
parent ac9ed921d7
commit d2288ee787
5 changed files with 12 additions and 4 deletions

View File

@@ -223,6 +223,7 @@ def _run_app(opts: Options, args: CLIOptions, bad_lines: Sequence[BadLine] = (),
with cached_values_for(run_app.cached_values_name) as cached_values:
startup_sessions = tuple(create_sessions(opts, args, default_session=opts.startup_session))
wincls = (startup_sessions[0].os_window_class if startup_sessions else '') or args.cls or appname
winname = (startup_sessions[0].os_window_name if startup_sessions else '') or args.name or wincls or appname
window_state = (args.start_as if args.start_as and args.start_as != 'normal' else None) or (
getattr(startup_sessions[0], 'os_window_state', None) if startup_sessions else None
)
@@ -231,7 +232,7 @@ def _run_app(opts: Options, args: CLIOptions, bad_lines: Sequence[BadLine] = (),
window_id = create_os_window(
run_app.initial_window_size_func(get_os_window_sizing_data(opts, startup_sessions[0] if startup_sessions else None), cached_values),
pre_show_callback,
args.title or appname, args.name or args.cls or appname,
args.title or appname, winname,
wincls, wstate, load_all_shaders, disallow_override_title=bool(args.title), layer_shell_config=run_app.layer_shell_config)
boss = Boss(opts, args, cached_values, global_shortcuts, talk_fd)
boss.start(window_id, startup_sessions)