diff --git a/docs/changelog.rst b/docs/changelog.rst index 8585721ef..dedac96f8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -54,6 +54,8 @@ Detailed list of changes - When reloading configuration, also reload custom MIME types from :file:`mime.types` config file (:pull:`6012`) +- launch: Allow specifying the state (fullscreen/maximized/minimized) for newly created OS Windows (:iss:`6026`) + 0.27.1 [2023-02-07] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/launch.py b/kitty/launch.py index 7cadd3f8e..23c7c594e 100644 --- a/kitty/launch.py +++ b/kitty/launch.py @@ -13,7 +13,7 @@ from .cli import parse_args from .cli_stub import LaunchCLIOptions from .clipboard import set_clipboard_string, set_primary_selection from .constants import kitten_exe, shell_path -from .fast_data_types import add_timer, get_boss, get_options, get_os_window_title, patch_color_profiles +from .fast_data_types import add_timer, change_os_window_state, get_boss, get_options, get_os_window_title, patch_color_profiles from .options.utils import env as parse_env from .tabs import Tab, TabManager from .types import OverlayType, run_once @@ -252,6 +252,13 @@ titles set by programs running in kitty. The special value :code:`current` will use the title of the current OS window, if any. +--os-window-state +type=choices +default=normal +choices=normal,fullscreen,maximized,minimized +The initial state for the newly created OS Window. + + --logo completion=type:file ext:png group:"PNG images" relative:conf Path to a PNG image to use as the logo for the newly created window. See @@ -324,6 +331,8 @@ def tab_for_window(boss: Boss, opts: LaunchCLIOptions, target_tab: Optional[Tab] def create_tab(tm: Optional[TabManager] = None) -> Tab: if tm is None: oswid = boss.add_os_window(wclass=opts.os_window_class, wname=opts.os_window_name, override_title=opts.os_window_title or None) + if opts.os_window_state != 'normal': + change_os_window_state(opts.os_window_state, oswid) tm = boss.os_window_map[oswid] tab = tm.new_tab(empty_tab=True, location=opts.location) if opts.tab_title: @@ -595,7 +604,7 @@ def launch( def clone_safe_opts() -> FrozenSet[str]: return frozenset(( 'window_title', 'tab_title', 'type', 'keep_focus', 'cwd', 'env', 'hold', - 'location', 'os_window_class', 'os_window_name', 'os_window_title', + 'location', 'os_window_class', 'os_window_name', 'os_window_title', 'os_window_state', 'logo', 'logo_position', 'logo_alpha', 'color', 'spacing', )) diff --git a/kitty/rc/launch.py b/kitty/rc/launch.py index 497a7ce15..e48a2877e 100644 --- a/kitty/rc/launch.py +++ b/kitty/rc/launch.py @@ -46,6 +46,7 @@ class Launch(RemoteCommand): os_window_title/str: Title for OS Window os_window_name/str: WM_NAME for OS Window os_window_class/str: WM_CLASS for OS Window + os_window_state/choices.normal.fullscreen.maximized.minimized: The initial state for OS Window color/list.str: list of color specifications such as foreground=red watcher/list.str: list of paths to watcher files '''