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

Question:

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)
Asked By: Roberto Leinardi

||

Answers:

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

http://lazka.github.io/pgi-docs/#AppIndicator3-0.1/classes/Indicator.html#AppIndicator3.Indicator.set_status

Answered By: TingPing

The link in TingPing’s answer isn’t working (404), so here is one that works and contains documentation on appindicator status: https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators#Porting_Guide_for_Applications

Answered By: Benur21
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.