Skip to content

Commit

Permalink
Fix appindicator fallback import
Browse files Browse the repository at this point in the history
Before it was trying the fallback import even if the first choice
import succeeded. This resulted in confusing diagnostic messages about
failing to import the fallback on systems that only have the first
choice.
  • Loading branch information
ntc2 committed Jul 15, 2023
1 parent 22a16f2 commit a21f55f
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/fluxgui/fluxapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,18 @@
from gi.repository import Gtk as gtk
# As of 2022/03/23 there is no Ayatana appindicator on Fedora, so fall
# back to using regular appindicator if necessary.
_imported_appindicator = False
try:
gi.require_version('AyatanaAppIndicator3', '0.1')
from gi.repository import AyatanaAppIndicator3 as appindicator
_imported_appindicator = True
except:
print('Failed to import Ayatana appindicator, falling back to plain appindicator ...')
try:
gi.require_version('AppIndicator3', '0.1')
from gi.repository import AppIndicator3 as appindicator
_imported_appindicator = True
except:
print('Failed to import plain appindicator ...')
if not _imported_appindicator:
print('Failed to import an appindicator implementation, dying ...')
sys.exit(1)
try:
gi.require_version('AppIndicator3', '0.1')
from gi.repository import AppIndicator3 as appindicator
except:
print('Failed to import plain appindicator ...')
print('Failed to import an appindicator implementation, dying ...')
sys.exit(1)

class FluxGUI(object):
"""
Expand Down

0 comments on commit a21f55f

Please sign in to comment.