pythongtkpygobject

AppIndicator3.Indicator: is there a way to hide/show it at runtime?


I am trying to hide the `AppIndicator3.Indicator`` once is shown but so far all my tries have failed.

So far I tried to just set the instance to None in the hope that the garbage collector would remove it and I tried to set the menu to None.

This is how I am showing it:

def __show_app_indicator(self) -> None:
    if AppIndicator3:
        icon_theme = Gtk.IconTheme.get_default()
        icon_name = icon_theme.lookup_icon('weather-showers-symbolic', 16, 0).get_filename()
        self.__app_indicator: AppIndicator3.Indicator = AppIndicator3.Indicator \
            .new(APP_ID, icon_name, AppIndicator3.IndicatorCategory.HARDWARE)
        self.__app_indicator.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
        self.__app_indicator.set_menu(self.__app_indicator_menu)

Solution

  • self.__app_indicator.set_status(AppIndicator3.IndicatorStatus.PASSIVE)
    

    https://lazka.github.io/pgi-docs/#AyatanaAppIndicator3-0.1/classes/Indicator.html#AyatanaAppIndicator3.Indicator.set_status