Allow setting the class for new OS windows in a session file
This commit is contained in:
parent
9d9ec84b54
commit
8093d70643
@ -20,6 +20,8 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
||||
|
||||
- Implement support for box drawing rounded-corners characters (:iss:`2240`)
|
||||
|
||||
- Allow setting the class for new OS windows in a session file
|
||||
|
||||
- When a character from the Unicode Dingbat block is followed by a space, use
|
||||
the extra space to render a larger version of the character (:iss:`2850`)
|
||||
|
||||
|
||||
@ -346,6 +346,8 @@ For example:
|
||||
new_os_window
|
||||
# set new window size to 80x25 cells
|
||||
os_window_size 80c 25c
|
||||
# set the --class for the new OS window
|
||||
os_window_class mywindow
|
||||
launch sh
|
||||
# Make the current window the active (focused) window
|
||||
focus
|
||||
|
||||
@ -195,7 +195,7 @@ class Boss:
|
||||
) -> int:
|
||||
if os_window_id is None:
|
||||
opts_for_size = opts_for_size or getattr(startup_session, 'os_window_size', None) or self.opts
|
||||
wclass = wclass or self.args.cls or appname
|
||||
wclass = wclass or getattr(startup_session, 'os_window_class', None) or self.args.cls or appname
|
||||
with startup_notification_handler(do_notify=startup_id is not None, startup_id=startup_id) as pre_show_callback:
|
||||
os_window_id = create_os_window(
|
||||
initial_window_size_func(opts_for_size, self.cached_values),
|
||||
|
||||
@ -43,6 +43,7 @@ class Session:
|
||||
self.active_tab_idx = 0
|
||||
self.default_title = default_title
|
||||
self.os_window_size: Optional[WindowSizeOpts] = None
|
||||
self.os_window_class: Optional[str] = None
|
||||
|
||||
def add_tab(self, opts: Options, name: str = '') -> None:
|
||||
if self.tabs and not self.tabs[-1].windows:
|
||||
@ -124,6 +125,8 @@ def parse_session(raw: str, opts: Options, default_title: Optional[str] = None)
|
||||
from kitty.config_data import window_size
|
||||
w, h = map(window_size, rest.split(maxsplit=1))
|
||||
ans.os_window_size = WindowSizeOpts(w, h, opts.window_margin_width, opts.window_padding_width, False)
|
||||
elif cmd == 'os_window_class':
|
||||
ans.os_window_class = rest
|
||||
else:
|
||||
raise ValueError('Unknown command in session file: {}'.format(cmd))
|
||||
yield finalize_session(ans)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user