Skip to content

Commit e8a9935

Browse files
committed
Allow setting WM_CLASS and WM_NAME when creating new OS windows with the launch command
1 parent f353131 commit e8a9935

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

docs/changelog.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
5757
- Fix incorrect rendering of selection when using rectangular select and
5858
scrolling (:iss:`2351`)
5959

60+
- Allow setting WM_CLASS and WM_NAME when creating new OS windows with the
61+
launch command (:option:`launch --os-window-class`)
62+
6063
- macOS: When switching input method while a pending multi-key input is in
6164
progress, clear the pending input (:iss:`2358`)
6265

kitty/boss.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ def add_os_window(
198198
) -> int:
199199
if os_window_id is None:
200200
opts_for_size = opts_for_size or getattr(startup_session, 'os_window_size', None) or self.opts
201-
cls = wclass or self.args.cls or appname
201+
wclass = wclass or self.args.cls or appname
202202
with startup_notification_handler(do_notify=startup_id is not None, startup_id=startup_id) as pre_show_callback:
203203
os_window_id = create_os_window(
204204
initial_window_size_func(opts_for_size, self.cached_values),
205205
pre_show_callback,
206-
appname, wname or self.args.name or cls, cls)
206+
appname, wname or self.args.name or wclass, wclass)
207207
tm = TabManager(os_window_id, self.opts, self.args, startup_session)
208208
self.os_window_map[os_window_id] = tm
209209
return os_window_id

kitty/launch.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ def options_spec() -> str:
136136
--marker
137137
Create a marker that highlights text in the newly created window. The syntax is
138138
the same as for the :code:`toggle_marker` map action (see :doc:`/marks`).
139+
140+
141+
--os-window-class
142+
Set the WM_CLASS property on X11 and the application id property on Wayland for
143+
the newly created OS Window when using :option:`launch --type`=os-window.
144+
Defaults to whatever is used by the parent kitty process, which in turn
145+
defaults to :code:`kitty`.
146+
147+
148+
--os-window-name
149+
Set the WM_NAME property on X11 for the newly created OS Window when using
150+
:option:`launch --type`=os-window. Defaults to :option:`launch --os-window-class`.
139151
'''
140152

141153

@@ -169,7 +181,7 @@ def tab_for_window(boss: Boss, opts: LaunchCLIOptions, target_tab: Optional[Tab]
169181
else:
170182
tab = None
171183
elif opts.type == 'os-window':
172-
oswid = boss.add_os_window()
184+
oswid = boss.add_os_window(wclass=opts.os_window_class, wname=opts.os_window_name)
173185
tm = boss.os_window_map[oswid]
174186
tab = tm.new_tab(empty_tab=True)
175187
if opts.tab_title:

0 commit comments

Comments
 (0)