Skip to content

replace library used to interact with tray bar #721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 9, 2024
Merged

Conversation

umbynos
Copy link
Contributor

@umbynos umbynos commented Jul 27, 2022

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • Tests for the changes have been added (for bug fixes / features)
  • What kind of change does this PR introduce?

library change + infra enhancements

  • What is the current behavior?

We currently use systray to interact with tray bar. On linux this requires libappindicator3 to work (v1.1.0). This library is old and deprecated. See debian release notes:

The deprecated libappindicator libraries are no longer provided. As a result, the related packages libappindicator1, libappindicator3-1 and libappindicator-dev are no longer available. This is expected to cause dependency errors for third-party software that still depends on libappindicator to provide system tray and indicator support.
Debian is using libayatana-appindicator as the successor of libappindicator. For technical background see this announcement.

  • What is the new behavior?

The new library is libayatana-appindicator which is supported by systray starting from version 1.2.0. But there seems to be problems with that version of the lib. See getlantern/systray#191 (comment). Using the fork https://github.com/fyne-io/systray seems to be a better alternative for various reasons:

  1. there are no lib dependencies to install and to link against during the go build
  2. the new lib allows starting the binary even if there is no GUI. The binary prints this message but starts nonetheless:
    systray error: failed to register our icon with the notifier watcher (maybe no tray is running?): The name org.kde.StatusNotifierWatcher was not provided by any .service files. So we do not need the arduino_create_agent-cli version anymore.
  3. the first point allows us to build statically the agent, allowing it to run on almost everything:
ldd Arduino_Create_Agent
	linux-vdso.so.1 (0x00007fffb31f1000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f087db2f000)
	libappindicator3.so.1 => /usr/lib/x86_64-linux-gnu/libappindicator3.so.1 (0x00007f087d922000)
	libgtk-3.so.0 => /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 (0x00007f087d01a000)
	libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f087cdc6000)
	libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f087caaf000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f087c6be000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f087dd4e000)
	libindicator3.so.7 => /usr/lib/x86_64-linux-gnu/libindicator3.so.7 (0x00007f087c4ac000)
	libdbusmenu-gtk3.so.4 => /usr/lib/x86_64-linux-gnu/libdbusmenu-gtk3.so.4 (0x00007f087c298000)
	libdbusmenu-glib.so.4 => /usr/lib/x86_64-linux-gnu/libdbusmenu-glib.so.4 (0x00007f087c07c000)
	libgdk-3.so.0 => /usr/lib/x86_64-linux-gnu/libgdk-3.so.0 (0x00007f087bd86000)
	libgio-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007f087b9e7000)
	libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007f087b7e3000)
	libpangocairo-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 (0x00007f087b5d6000)
	libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f087b29e000)
	libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007f087b08e000)
	libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f087ae88000)
	libcairo-gobject.so.2 => /usr/lib/x86_64-linux-gnu/libcairo-gobject.so.2 (0x00007f087ac7f000)
	libcairo.so.2 => /usr/lib/x86_64-linux-gnu/libcairo.so.2 (0x00007f087a962000)
	libgdk_pixbuf-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007f087a73e000)
	libatk-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0 (0x00007f087a518000)
	libatk-bridge-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0 (0x00007f087a2e7000)
	libepoxy.so.0 => /usr/lib/x86_64-linux-gnu/libepoxy.so.0 (0x00007f0879fe6000)
	libpangoft2-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 (0x00007f0879dd0000)
	libpango-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0 (0x00007f0879b83000)
	libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f087993e000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f08795a0000)
	libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f0879398000)
	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f0879127000)
	libXinerama.so.1 => /usr/lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007f0878f24000)
	libXrandr.so.2 => /usr/lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007f0878d19000)
	libXcursor.so.1 => /usr/lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007f0878b0f000)
	libXcomposite.so.1 => /usr/lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007f087890c000)
	libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f0878709000)
	libxkbcommon.so.0 => /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007f08784ca000)
	libwayland-cursor.so.0 => /usr/lib/x86_64-linux-gnu/libwayland-cursor.so.0 (0x00007f08782c2000)
	libwayland-egl.so.1 => /usr/lib/x86_64-linux-gnu/libwayland-egl.so.1 (0x00007f08780c0000)
	libwayland-client.so.0 => /usr/lib/x86_64-linux-gnu/libwayland-client.so.0 (0x00007f0877eb1000)
	libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f0877c9f000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f0877a97000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f087787a000)
	libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f0877652000)
	libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f0877438000)
	libmount.so.1 => /lib/x86_64-linux-gnu/libmount.so.1 (0x00007f08771e4000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0876fe0000)
	libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f0876d2c000)
	libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f0876b04000)
	libpixman-1.so.0 => /usr/lib/x86_64-linux-gnu/libpixman-1.so.0 (0x00007f087685f000)
	libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f087662d000)
	libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007f087642a000)
	libxcb-render.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007f087621d000)
	libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f0876013000)
	libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f0875dc6000)
	libatspi.so.0 => /usr/lib/x86_64-linux-gnu/libatspi.so.0 (0x00007f0875b96000)
	libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007f08758f8000)
	libthai.so.0 => /usr/lib/x86_64-linux-gnu/libthai.so.0 (0x00007f08756ef000)
	libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f08754bd000)
	libblkid.so.1 => /lib/x86_64-linux-gnu/libblkid.so.1 (0x00007f0875270000)
	libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f087506c000)
	libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f0874e66000)
	libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007f0874be2000)
	libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007f08749b5000)
	libdatrie.so.1 => /usr/lib/x86_64-linux-gnu/libdatrie.so.1 (0x00007f08747ae000)
	libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f08745a7000)
	libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f0874392000)
	liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f087416c000)
	liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f0873f50000)
	libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f0873c34000)
	libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f0873a1f000)

vs

ldd arduino-create-agent
        not a dynamic executable
  • Does this PR introduce a breaking change?

no

  • Other information:

@umbynos umbynos added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jul 27, 2022
@umbynos umbynos self-assigned this Jul 27, 2022
@umbynos umbynos marked this pull request as draft July 27, 2022 15:44
@per1234 per1234 linked an issue Jul 31, 2022 that may be closed by this pull request
@umbynos umbynos force-pushed the umbynos/fyne_io branch 2 times, most recently from 2bbe8af to 8326af1 Compare November 10, 2022 11:05
@umbynos umbynos requested a review from ubidefeo November 30, 2022 08:03
Copy link

@ubidefeo ubidefeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested on Mac OS 12.6 and Windows 11
LGTM

@umbynos umbynos force-pushed the umbynos/fyne_io branch 6 times, most recently from bda25fa to 64d02da Compare December 2, 2022 09:30
@umbynos umbynos marked this pull request as ready for review December 2, 2022 11:28
@umbynos
Copy link
Contributor Author

umbynos commented Dec 2, 2022

Apparently it's suggested to use CGO, even if on linux it works just fine fyne-io/systray@d16a617

@umbynos
Copy link
Contributor Author

umbynos commented Dec 2, 2022

The only downside of this PR is this https://github.com/fyne-io/systray#linuxbsd

On my linux 18.04 the icon is not showing:
image

But on newer machines should be working fine:
image

@per1234 what do you think about this?

…on systems without a tray bar with this error:

```
systray error: failed to register our icon with the notifier watcher (maybe no tray is running?): The name org.kde.StatusNotifierWatcher was not provided by any .service files

```
there are no more dependencies required we can do this
fyne-io/systray#24 (comment)
@umbynos umbynos requested a review from cmaglie February 9, 2024 13:55
@codecov-commenter
Copy link

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (c34a1e2) 20.93% compared to head (88dbd62) 20.93%.
Report is 6 commits behind head on main.

Files Patch % Lines
main.go 0.00% 9 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #721   +/-   ##
=======================================
  Coverage   20.93%   20.93%           
=======================================
  Files          43       43           
  Lines        3153     3162    +9     
=======================================
+ Hits          660      662    +2     
- Misses       2397     2404    +7     
  Partials       96       96           
Flag Coverage Δ
unit 20.93% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@umbynos umbynos merged commit 16f322f into main Feb 9, 2024
@umbynos umbynos deleted the umbynos/fyne_io branch February 9, 2024 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libappindicator deprecated in Debian 11 (bullseye), agent won't run
4 participants