moses-palmer / pystray

GNU General Public License v3.0
463 stars 57 forks source link

Doesn't work on ubuntu20.04 - tests fail #98

Closed robmsmt closed 2 years ago

robmsmt commented 2 years ago
(pyproj) rob@rob-T480s:~/projects/Test/pystray (master)$ python3 -m unittest tests/icon_tests.py 
Failed to dock icon
Traceback (most recent call last):
  File "/home/rob/pyproj/venv/pyproj/lib/python3.8/site-packages/pystray/_xorg.py", line 162, in _update_icon
    self._assert_docked()
  File "/home/rob/pyproj/venv/pyproj/lib/python3.8/site-packages/pystray/_xorg.py", line 389, in _assert_docked
    assert self._systray_manager
AssertionError
Failed to dock icon
Traceback (most recent call last):
  File "/home/rob/pyproj/venv/pyproj/lib/python3.8/site-packages/pystray/_xorg.py", line 143, in _show
    self._assert_docked()
  File "/home/rob/pyproj/venv/pyproj/lib/python3.8/site-packages/pystray/_xorg.py", line 389, in _assert_docked
    assert self._systray_manager
AssertionError

Click the icon
EFailed to dock icon
Traceback (most recent call last):
  File "/home/rob/pyproj/venv/pyproj/lib/python3.8/site-packages/pystray/_xorg.py", line 162, in _update_icon
    self._assert_docked()
  File "/home/rob/pyproj/venv/pyproj/lib/python3.8/site-packages/pystray/_xorg.py", line 389, in _assert_docked
    assert self._systray_manager
AssertionError
Failed to dock icon
Traceback (most recent call last):
  File "/home/rob/pyproj/venv/pyproj/lib/python3.8/site-packages/pystray/_xorg.py", line 143, in _show
    self._assert_docked()
  File "/home/rob/pyproj/venv/pyproj/lib/python3.8/site-packages/pystray/_xorg.py", line 389, in _assert_docked
    assert self._systray_manager
AssertionError

I am on:

rob@rob-T480s:~/projects/Test/pystray (master)$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal

I am on X11 with gnome 3.36. Any ideas why xorg won't dock?

moses-palmer commented 2 years ago

Thank you for your report.

I think this may be caused by lack of a system tray manager on your system. Under X, a dedicated window is designated as the system tray, but Gnome does not generally have one running (there are extensions for that though).

On Ubuntu the AppIndicator backend should generally be used instead, or at least the GTK+ backend. Are you running this on s minimal install with limited GUI toolkits installed?

robmsmt commented 2 years ago

Thanks, I must have had some of the components missing. I installed https://extensions.gnome.org/extension/1031/topicons/ and refreshed the gnome with Alt+f2 (enter r) and the tests now appear to work. It's possible on this laptop I have reinstalled some GUI toolkit components from a minimal install.

Is it expected on a stock ubuntu 20.04 install? I can test this later in the week with another laptop which has more recent install.

Thanks again!

xfangfang commented 2 years ago

I just run pystray with pyinstaller on a new ubuntu 20.04

  1. install Tweaks from Ubuntu software
  2. install and turn on this plugin: https://extensions.gnome.org/extension/615/appindicator-support/
  3. restart gnome shell and everything works fine

hope this is helpful.


update:
after install libappindicator3-dev, the menu looks like "gnome style", and I don't need that plugin to run my program.

ReenigneArcher commented 2 years ago

I just run pystray with pyinstaller on a new ubuntu 20.04

1. install **Tweaks** from **Ubuntu software**

2. install and turn on this plugin: https://extensions.gnome.org/extension/615/appindicator-support/

3. restart gnome shell and everything works fine

hope this is helpful.

update: after install libappindicator3-dev, the menu looks like "gnome style", and I don't need that plugin to run my program.

Your original method works for me, kind of ... only the default action is available. No menu is actually shown. The icon is also very distorted.

Installing libappindicator3-dev and disabling extension 615, the icon does not launch.

tihoangyeudau commented 1 year ago

I just run pystray with pyinstaller on a new ubuntu 20.04

1. install **Tweaks** from **Ubuntu software**

2. install and turn on this plugin: https://extensions.gnome.org/extension/615/appindicator-support/

3. restart gnome shell and everything works fine

hope this is helpful. update: after install libappindicator3-dev, the menu looks like "gnome style", and I don't need that plugin to run my program.

Your original method works for me, kind of ... only the default action is available. No menu is actually shown. The icon is also very distorted.

Installing libappindicator3-dev and disabling extension 615, the icon does not launch.

same problem, and if using 615, I cant show menu from tray icon when right clicking mouse