Allow querying background opacity via XTGETTCAP

This commit is contained in:
Kovid Goyal
2024-07-22 11:31:34 +05:30
parent deff40df8a
commit 879effc6f5

View File

@@ -202,6 +202,20 @@ class Background(Query):
return (w.screen.color_profile.default_bg or get_options().background).as_sharp
@query
class BackgroundOpacity(Query):
name: str = 'background_opacity'
help_text: str = 'The current background opacity as a number between 0 and 1'
@staticmethod
def get_result(opts: Options, window_id: int, os_window_id: int) -> str:
from kitty.fast_data_types import background_opacity_of
ans = background_opacity_of(os_window_id)
if ans is None:
ans = 1.0
return f'{ans:g}'
@query
class ClipboardControl(Query):
name: str = 'clipboard_control'