def METHOD_NAME(self, enabled):
    surface = self.application.window.get_surface()
    is_active = self.application.window.is_active()
    try:
        surface.METHOD_NAME(enabled and not is_active)
    except AttributeError:
        # No support for urgency hints
        pass