mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
query_terminal: Add support for reporting name of the OS the terminal emulator is running on
Fixes #8201
This commit is contained in:
@@ -87,7 +87,7 @@ Detailed list of changes
|
|||||||
0.39.0 [future]
|
0.39.0 [future]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
- diff kitten: Automatically use dark/light color scheme based on the color scheme of the parent terminal. Can be controlled via the new :opt:`kitten-diff.color_scheme` option. Note that this is a **default behavior change** (:iss:`8170`)
|
- :doc:`diff kitten <kittens/diff>`: Automatically use dark/light color scheme based on the color scheme of the parent terminal. Can be controlled via the new :opt:`kitten-diff.color_scheme` option. Note that this is a **default behavior change** (:iss:`8170`)
|
||||||
|
|
||||||
- Allow dynamically generating configuration by running an arbitrary program using the new :code:`geninclude` directive in :file:`kitty.conf`
|
- Allow dynamically generating configuration by running an arbitrary program using the new :code:`geninclude` directive in :file:`kitty.conf`
|
||||||
|
|
||||||
@@ -101,6 +101,8 @@ Detailed list of changes
|
|||||||
|
|
||||||
- diff kitten: Abort when run inside a terminal that does not support the kitty keyboard protocol (:iss:`8185`)
|
- diff kitten: Abort when run inside a terminal that does not support the kitty keyboard protocol (:iss:`8185`)
|
||||||
|
|
||||||
|
- :doc:`query kitten <kittens/query_terminal>`: Add support for reporting name of the OS the terminal emulator is running on (:iss:`8201`)
|
||||||
|
|
||||||
- macOS: Allow using the Passwords app to autofill passwords via the Edit->Autofill menu mimicking other macOS applications (:pull:`8195`)
|
- macOS: Allow using the Passwords app to autofill passwords via the Edit->Autofill menu mimicking other macOS applications (:pull:`8195`)
|
||||||
|
|
||||||
- macOS: Add menu items to the Edit menu to clear the screen and scrollback
|
- macOS: Add menu items to the Edit menu to clear the screen and scrollback
|
||||||
|
|||||||
@@ -226,6 +226,17 @@ class ClipboardControl(Query):
|
|||||||
return ' '.join(opts.clipboard_control)
|
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]:
|
def get_result(name: str, window_id: int, os_window_id: int) -> Optional[str]:
|
||||||
from kitty.fast_data_types import get_options
|
from kitty.fast_data_types import get_options
|
||||||
q = all_queries.get(name)
|
q = all_queries.get(name)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ from typing import (
|
|||||||
Iterable,
|
Iterable,
|
||||||
Iterator,
|
Iterator,
|
||||||
List,
|
List,
|
||||||
|
Literal,
|
||||||
NamedTuple,
|
NamedTuple,
|
||||||
Optional,
|
Optional,
|
||||||
Sequence,
|
Sequence,
|
||||||
@@ -178,7 +179,7 @@ currently_parsing = CurrentlyParsing()
|
|||||||
|
|
||||||
|
|
||||||
@run_once
|
@run_once
|
||||||
def os_name() -> str:
|
def os_name() -> Literal['macos', 'bsd', 'linux', 'unknown']:
|
||||||
if is_macos:
|
if is_macos:
|
||||||
return 'macos'
|
return 'macos'
|
||||||
if 'bsd' in _plat:
|
if 'bsd' in _plat:
|
||||||
|
|||||||
Reference in New Issue
Block a user