Use the root process for the window pid in ls and pid matching
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run

This makes the pid consistent with the cmdline, cwd and env reported
for the window, which already skip over wrappers kitty inserts such as
/usr/bin/login on macOS and the wrapper used for --hold.
This commit is contained in:
Kovid Goyal 2026-10-23 01:19:40 +05:30
parent 4a99b367c5
commit e615009378
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 5 deletions

View file

@ -237,10 +237,12 @@ Detailed list of changes
:file:`/usr/bin/login` on macOS, are now skipped, so their first child is used
as the root process
- macOS: The working directory, command line and environment of a window
- The pid, working directory, command line and environment of a window
reported by :ref:`kitten @ ls <at-ls>` and used when matching windows by
:code:`cwd`, :code:`cmdline` or :code:`env` are now those of the shell rather
than of the :file:`/usr/bin/login` wrapper kitty runs it with
:code:`pid`, :code:`cwd`, :code:`cmdline` or :code:`env` are now those of the
process kitty was asked to run rather than of a wrapper kitty runs it with,
such as :file:`/usr/bin/login` on macOS or the wrapper used for
:option:`launch --hold`
- Remote control: Fix a crash when using damaged images with
:code:`set-window-logo` or :code:`set-background-image` (:pull:`10715`)

View file

@ -968,7 +968,7 @@ class Window:
if field in ('id', 'window_id'):
return pat.pattern == str(self.id)
if field == 'pid':
return pat.pattern == str(self.child.pid)
return pat.pattern == str(self.child.root_pid)
if field == 'title':
return pat.search(self.override_title or self.title) is not None
if field in 'cwd':
@ -2425,7 +2425,7 @@ class Window:
'is_active': is_active,
'title': self.title,
'title_overridden': self.override_title is not None,
'pid': self.child.pid,
'pid': self.child.root_pid,
'cwd': self.child.current_cwd or self.child.cwd,
'cmdline': self.child.cmdline,
'last_reported_cmdline': self.last_cmd_cmdline,