Use the process name as the default window title rather than "kitty"
Fixes #610
This commit is contained in:
parent
ca17e9b02c
commit
a1355484a6
@ -23,7 +23,7 @@ def cmdline_of_process(pid):
|
||||
if is_macos:
|
||||
# TODO: macOS implementation, see DarwinProcess.c in htop for inspiration
|
||||
raise NotImplementedError()
|
||||
return open('/proc/{}/cmdline'.format(pid), 'rb').read().decode('utf-8').split('\0')
|
||||
return list(filter(None, open('/proc/{}/cmdline'.format(pid), 'rb').read().decode('utf-8').split('\0')))
|
||||
|
||||
|
||||
def remove_cloexec(fd):
|
||||
@ -88,7 +88,7 @@ class Child:
|
||||
@property
|
||||
def cmdline(self):
|
||||
try:
|
||||
return cmdline_of_process(self.pid)
|
||||
return cmdline_of_process(self.pid) or list(self.argv)
|
||||
except Exception:
|
||||
return list(self.argv)
|
||||
|
||||
|
||||
@ -97,7 +97,8 @@ class Window:
|
||||
self.override_title = override_title
|
||||
self.overlay_window_id = None
|
||||
self.overlay_for = None
|
||||
self.child_title = appname
|
||||
self.default_title = child.argv[0] or appname
|
||||
self.child_title = self.default_title
|
||||
self.id = add_window(tab.os_window_id, tab.id, self.title)
|
||||
self.clipboard_control_buffers = {'p': '', 'c': ''}
|
||||
if not self.id:
|
||||
@ -230,7 +231,7 @@ class Window:
|
||||
self.screen.send_escape_code_to_child(CSI, 'O')
|
||||
|
||||
def title_changed(self, new_title):
|
||||
self.child_title = sanitize_title(new_title or appname)
|
||||
self.child_title = sanitize_title(new_title or self.default_title)
|
||||
if self.override_title is None:
|
||||
self.title_updated()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user