From 2ec05716e5c8844f0887e4e3772d70ed19e2c850 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Wed, 21 Aug 2024 22:08:00 +0100 Subject: [PATCH] Support libayatana-appindicator as libappindicator is now dead (#9) * Support libayatana-appindicator as libappindicator is now dead It seems to be a drop-in replacement. --------- Co-authored-by: Martin --- scc/gui/statusicon.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scc/gui/statusicon.py b/scc/gui/statusicon.py index 713c56ba..66dd84bd 100644 --- a/scc/gui/statusicon.py +++ b/scc/gui/statusicon.py @@ -263,8 +263,15 @@ def __init__(self, *args, **kwargs): StatusIcon.__init__(self, *args, **kwargs) try: - from gi.repository import AppIndicator3 as appindicator - + import gi + try: + gi.require_version("AyatanaAppIndicator3", "0.1") + from gi.repository import AyatanaAppIndicator3 as appindicator + except ImportError: + log.warning("Failed to import AyatanaAppIndicator3, trying fallback to an old implementation of AppIndicator3!") + gi.require_version("AppIndicator3", "0.1") + from gi.repository import AppIndicator3 as appindicator + self._status_active = appindicator.IndicatorStatus.ACTIVE self._status_passive = appindicator.IndicatorStatus.PASSIVE except ImportError: