#!/usr/bin/env python3 # vim:fileencoding=utf-8 # License: GPL v3 Copyright: 2018, Kovid Goyal from functools import lru_cache from typing import Any, Dict, NamedTuple, Optional, Sequence, Tuple from .config import build_ansi_color_table from .types import WindowGeometry from .fast_data_types import ( DECAWM, Screen, cell_size_for_window, pt_to_px, set_tab_bar_render_data, viewport_for_window ) from .layout.base import Rect from .options_stub import Options from .rgb import Color, alpha_blend, color_as_sgr, color_from_int, to_color from .utils import color_as_int, log_error from .window import calculate_gl_geometry class TabBarData(NamedTuple): title: str is_active: bool needs_attention: bool num_windows: int layout_name: str has_activity_since_last_focus: bool class DrawData(NamedTuple): leading_spaces: int sep: str trailing_spaces: int bell_on_tab: bool bell_fg: int alpha: Sequence[float] active_fg: Color active_bg: Color inactive_fg: Color inactive_bg: Color default_bg: Color title_template: str active_title_template: Optional[str] tab_activity_symbol: Optional[str] def as_rgb(x: int) -> int: return (x << 8) | 2 @lru_cache() def report_template_failure(template: str, e: str) -> None: log_error('Invalid tab title template: "{}" with error: {}'.format(template, e)) @lru_cache() def compile_template(template: str) -> Any: try: return compile('f"""' + template + '"""', '