ui: add support for Ayatana AppIndicator

This commit is contained in:
Thomas Uhle 2020-03-30 20:10:44 +02:00 committed by Peter F. Patel-Schneider
parent 624247d378
commit ca9f9b3447
5 changed files with 26 additions and 11 deletions

View File

@ -1,3 +1,6 @@
1.0.2-rc2:
* Add support for Ayatana AppIndicator
1.0.2-rc1:
* Look up tray icon filenames to get around a bug in libappindicator.
* Make the default behavior be to show the main window at startup.

View File

@ -24,8 +24,11 @@ distribution the required packages are most likely named something similar.
If the desktop notifications bindings are also installed
(`gir1.2-notify-0.7` for Debian/Ubuntu),
you will also get desktop notifications when devices come online/go offline.
For gnome-shell/Unity support, you also need to have `gir1.2-appindicator3-0.1`
installed in Debian/Ubuntu.
For GNOME Shell/Budgie Desktop/KDE/XFCE support, you also need to have
`gir1.2-ayatanaappindicator3-0.1` installed in Debian/Ubuntu. Although it is
recommended to install and use `gir1.2-ayatanaappindicator3-0.1` if it is
available, you can also use `gir1.2-appindicator3-0.1` if necessary (e.g.,
for Unity in Ubuntu).
### Downloading

View File

@ -146,14 +146,23 @@ def _scroll(tray_icon, event, direction=None):
try:
import gi
try:
gi.require_version('AppIndicator3', '0.1')
gi.require_version('AyatanaAppIndicator3', '0.1')
ayatana_appindicator_found = True
except ValueError:
# Treat unavailable versions the same as unavailable packages
raise ImportError
from gi.repository import AppIndicator3
try:
gi.require_version('AppIndicator3', '0.1')
ayatana_appindicator_found = False
except ValueError:
# treat unavailable versions the same as unavailable packages
raise ImportError
if ayatana_appindicator_found:
from gi.repository import AyatanaAppIndicator3 as AppIndicator3
else:
from gi.repository import AppIndicator3
if _log.isEnabledFor(_DEBUG):
_log.debug("using AppIndicator3")
_log.debug("using %sAppIndicator3" % ('Ayatana ' if ayatana_appindicator_found else ''))
# Defense against AppIndicator3 bug that treats files in current directory as icon files
# https://bugs.launchpad.net/ubuntu/+source/libappindicator/+bug/1363277

View File

@ -14,11 +14,11 @@ Vcs-browser: http://github.com/pwr/Solaar
Package: solaar
Architecture: all
Depends: ${misc:Depends}, ${debconf:Depends}, udev (>= 175), passwd | adduser,
${python:Depends}, python3-pyudev (>= 0.13), python-gi (>= 3.2), gir1.2-gtk-3.0 (>= 3.4),
${python:Depends}, python3-pyudev (>= 0.13), python3-gi (>= 3.2), gir1.2-gtk-3.0 (>= 3.4),
${solaar:Desktop-Icon-Theme}
Recommends: gir1.2-notify-0.7, consolekit (>= 0.4.3) | systemd (>= 44),
python-dbus (>= 1.1.0), upower
Suggests: gir1.2-appindicator3-0.1
python3-dbus (>= 1.1.0), upower
Suggests: gir1.2-ayatanaappindicator3-0.1 | gir1.2-appindicator3-0.1
Description: Logitech Unifying Receiver peripherals manager for Linux
Solaar is a Linux device manager for Logitech's Unifying Receiver peripherals.
It is able to pair/unpair devices to the receiver, and for some devices read

View File

@ -75,7 +75,7 @@ battery status.
platforms=['linux'],
# sudo apt install python-gi python3-gi \
# gir1.2-gtk-3.0 gir1.2-notify-0.7 gir1.2-appindicator3-0.1
# gir1.2-gtk-3.0 gir1.2-notify-0.7 gir1.2-ayatanaappindicator3-0.1
# os_requires=['gi.repository.GObject (>= 2.0)', 'gi.repository.Gtk (>= 3.0)'],
python_requires='>=3.2',