Sessions: Fix os_window_size and os_window_class not applying to the first OS Window
Fixes #4957
This commit is contained in:
parent
aabadd8517
commit
c9ef4aa8c8
@ -39,6 +39,9 @@ Detailed list of changes
|
|||||||
|
|
||||||
- Remote control: Allow using :ref:`Boolean operators <search_syntax>` when constructing queries to match windows or tabs
|
- Remote control: Allow using :ref:`Boolean operators <search_syntax>` when constructing queries to match windows or tabs
|
||||||
|
|
||||||
|
- Sessions: Fix :code:`os_window_size` and :code:`os_window_class` not applying to the first OS Window (:iss:`4957`)
|
||||||
|
|
||||||
|
|
||||||
0.25.0 [2022-04-11]
|
0.25.0 [2022-04-11]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@ -149,7 +149,7 @@ For example:
|
|||||||
|
|
||||||
# Create a new OS window
|
# Create a new OS window
|
||||||
new_os_window
|
new_os_window
|
||||||
# set new window size to 80x25 cells
|
# set new window size to 80x25 cells (if specifed before new_os_window will apply to first OS window)
|
||||||
os_window_size 80c 25c
|
os_window_size 80c 25c
|
||||||
# set the --class for the new OS window
|
# set the --class for the new OS window
|
||||||
os_window_class mywindow
|
os_window_class mywindow
|
||||||
|
|||||||
@ -11,8 +11,8 @@ from functools import partial
|
|||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
from time import monotonic
|
from time import monotonic
|
||||||
from typing import (
|
from typing import (
|
||||||
Any, Callable, Container, Dict, Iterable, Iterator, List, Optional,
|
Any, Callable, Container, Dict, Iterable, Iterator, List, Optional, Set,
|
||||||
Sequence, Set, Tuple, Union
|
Tuple, Union
|
||||||
)
|
)
|
||||||
from weakref import WeakValueDictionary
|
from weakref import WeakValueDictionary
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ class Boss:
|
|||||||
for sc in self.global_shortcuts.values():
|
for sc in self.global_shortcuts.values():
|
||||||
self.keymap.pop(sc, None)
|
self.keymap.pop(sc, None)
|
||||||
|
|
||||||
def startup_first_child(self, os_window_id: Optional[int], startup_sessions: Sequence[Optional[Session]] = ()) -> None:
|
def startup_first_child(self, os_window_id: Optional[int], startup_sessions: Iterable[Session] = ()) -> None:
|
||||||
si = startup_sessions or create_sessions(get_options(), self.args, default_session=get_options().startup_session)
|
si = startup_sessions or create_sessions(get_options(), self.args, default_session=get_options().startup_session)
|
||||||
for startup_session in si:
|
for startup_session in si:
|
||||||
self.add_os_window(startup_session, os_window_id=os_window_id)
|
self.add_os_window(startup_session, os_window_id=os_window_id)
|
||||||
@ -723,7 +723,7 @@ class Boss:
|
|||||||
def toggle_macos_secure_keyboard_entry(self) -> None:
|
def toggle_macos_secure_keyboard_entry(self) -> None:
|
||||||
toggle_secure_input()
|
toggle_secure_input()
|
||||||
|
|
||||||
def start(self, first_os_window_id: int) -> None:
|
def start(self, first_os_window_id: int, startup_sessions: Iterable[Session]) -> None:
|
||||||
if not getattr(self, 'io_thread_started', False):
|
if not getattr(self, 'io_thread_started', False):
|
||||||
self.child_monitor.start()
|
self.child_monitor.start()
|
||||||
self.io_thread_started = True
|
self.io_thread_started = True
|
||||||
@ -734,7 +734,7 @@ class Boss:
|
|||||||
self.startup_first_child(first_os_window_id, startup_sessions=tuple(sess))
|
self.startup_first_child(first_os_window_id, startup_sessions=tuple(sess))
|
||||||
self.launch_urls(*urls)
|
self.launch_urls(*urls)
|
||||||
else:
|
else:
|
||||||
self.startup_first_child(first_os_window_id)
|
self.startup_first_child(first_os_window_id, startup_sessions=startup_sessions)
|
||||||
|
|
||||||
if get_options().update_check_interval > 0 and not self.update_check_started and getattr(sys, 'frozen', False):
|
if get_options().update_check_interval > 0 and not self.update_check_started and getattr(sys, 'frozen', False):
|
||||||
from .update_check import run_update_check
|
from .update_check import run_update_check
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from .fonts.render import set_font_family
|
|||||||
from .options.types import Options
|
from .options.types import Options
|
||||||
from .options.utils import DELETE_ENV_VAR
|
from .options.utils import DELETE_ENV_VAR
|
||||||
from .os_window_size import initial_window_size_func
|
from .os_window_size import initial_window_size_func
|
||||||
from .session import get_os_window_sizing_data
|
from .session import create_sessions, get_os_window_sizing_data
|
||||||
from .types import SingleKey
|
from .types import SingleKey
|
||||||
from .utils import (
|
from .utils import (
|
||||||
cleanup_ssh_control_masters, detach, expandvars, log_error,
|
cleanup_ssh_control_masters, detach, expandvars, log_error,
|
||||||
@ -168,14 +168,16 @@ def _run_app(opts: Options, args: CLIOptions, bad_lines: Sequence[BadLine] = ())
|
|||||||
if not is_wayland() and not is_macos: # no window icons on wayland
|
if not is_wayland() and not is_macos: # no window icons on wayland
|
||||||
set_x11_window_icon()
|
set_x11_window_icon()
|
||||||
with cached_values_for(run_app.cached_values_name) as cached_values:
|
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
|
||||||
with startup_notification_handler(extra_callback=run_app.first_window_callback) as pre_show_callback:
|
with startup_notification_handler(extra_callback=run_app.first_window_callback) as pre_show_callback:
|
||||||
window_id = create_os_window(
|
window_id = create_os_window(
|
||||||
run_app.initial_window_size_func(get_os_window_sizing_data(opts), cached_values),
|
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,
|
pre_show_callback,
|
||||||
args.title or appname, args.name or args.cls or appname,
|
args.title or appname, args.name or args.cls or appname,
|
||||||
args.cls or appname, load_all_shaders, disallow_override_title=bool(args.title))
|
wincls, load_all_shaders, disallow_override_title=bool(args.title))
|
||||||
boss = Boss(opts, args, cached_values, global_shortcuts)
|
boss = Boss(opts, args, cached_values, global_shortcuts)
|
||||||
boss.start(window_id)
|
boss.start(window_id, startup_sessions)
|
||||||
if bad_lines:
|
if bad_lines:
|
||||||
boss.show_bad_config_lines(bad_lines)
|
boss.show_bad_config_lines(bad_lines)
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -3,18 +3,17 @@
|
|||||||
|
|
||||||
import shlex
|
import shlex
|
||||||
import sys
|
import sys
|
||||||
from typing import Generator, List, Optional, Union, TYPE_CHECKING
|
from typing import TYPE_CHECKING, Generator, Iterator, List, Optional, Union
|
||||||
|
|
||||||
from .cli_stub import CLIOptions
|
from .cli_stub import CLIOptions
|
||||||
from .options.utils import to_layout_names, window_size
|
|
||||||
from .constants import kitty_exe
|
from .constants import kitty_exe
|
||||||
from .layout.interface import all_layouts
|
from .layout.interface import all_layouts
|
||||||
from .options.types import Options
|
from .options.types import Options
|
||||||
|
from .options.utils import to_layout_names, window_size
|
||||||
from .os_window_size import WindowSize, WindowSizeData, WindowSizes
|
from .os_window_size import WindowSize, WindowSizeData, WindowSizes
|
||||||
from .typing import SpecialWindowInstance
|
from .typing import SpecialWindowInstance
|
||||||
from .utils import log_error, resolved_shell
|
from .utils import log_error, resolved_shell
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .window import CwdRequest
|
from .window import CwdRequest
|
||||||
|
|
||||||
@ -153,7 +152,7 @@ def create_sessions(
|
|||||||
cwd_from: Optional['CwdRequest'] = None,
|
cwd_from: Optional['CwdRequest'] = None,
|
||||||
respect_cwd: bool = False,
|
respect_cwd: bool = False,
|
||||||
default_session: Optional[str] = None
|
default_session: Optional[str] = None
|
||||||
) -> Generator[Session, None, None]:
|
) -> Iterator[Session]:
|
||||||
if args and args.session:
|
if args and args.session:
|
||||||
if isinstance(args.session, PreReadSession):
|
if isinstance(args.session, PreReadSession):
|
||||||
session_data = '' + str(args.session)
|
session_data = '' + str(args.session)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user