Support XTGETTCAP query with key query-os[-_]name

Fixes #9217
This commit is contained in:
Kovid Goyal 2025-12-25 18:22:42 +05:30
parent 0fb54d32b1
commit cc55c04034
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import os
import re
from binascii import hexlify, unhexlify
from collections.abc import Generator
@ -548,6 +549,9 @@ def result(encoded_query_name: str, x: str | Literal[True] | None = None) -> str
yield result(encoded_query_name)
else:
yield result(encoded_query_name, rval)
elif name in ('query-os-name', 'query-os_name'):
# https://github.com/kovidgoyal/kitty/issues/9217
yield result(encoded_query_name, os.uname().sysname)
else:
if name in bool_capabilities:
yield result(encoded_query_name, True)