query_terminal: Add support for reporting name of the OS the terminal emulator is running on

Fixes #8201
This commit is contained in:
Kovid Goyal
2025-01-07 08:21:53 +05:30
parent a3d6bf7a2c
commit 69aead6d3d
3 changed files with 16 additions and 2 deletions

View File

@@ -226,6 +226,17 @@ class ClipboardControl(Query):
return ' '.join(opts.clipboard_control)
@query
class OSName(Query):
name: str = 'os_name'
help_text: str = 'The name of the OS the terminal is running on. Kitty supports values: linux, macos, bsd or unknown'
@staticmethod
def get_result(opts: Options, window_id: int, os_window_id: int) -> str:
from kitty.conf.utils import os_name
return os_name()
def get_result(name: str, window_id: int, os_window_id: int) -> Optional[str]:
from kitty.fast_data_types import get_options
q = all_queries.get(name)