#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributors.

from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.core import debug


class command:
    def __init__(self):
        pass

    def initialize(self, environment):
        self.env = environment

    def shutdown(self):
        pass

    def get_description(self):
        return _(
            "TUI focus mode handler - suppresses screen update spam "
            "for interactive TUI applications"
        )

    def run(self):
        # Check if TUI mode is enabled
        if not self.env["runtime"]["SettingsManager"].get_setting_as_bool(
            "focus", "tui"
        ):
            return

        # TUI mode is active - set suppression flag for incoming handler
        # This prevents the 70000-incoming.py command from announcing
        # screen updates
        self.env["commandBuffer"]["tuiSuppressIncoming"] = True

        self.env["runtime"]["DebugManager"].write_debug_out(
            "tui_focus_handler: TUI mode active, suppressing incoming text",
            debug.DebugLevel.INFO
        )

    def set_callback(self, callback):
        pass
