Skip to content

appindicator support#2885

Merged
infeo merged 47 commits into
cryptomator:developfrom
purejava:libappindicator
Jul 26, 2023
Merged

appindicator support#2885
infeo merged 47 commits into
cryptomator:developfrom
purejava:libappindicator

Conversation

@purejava

@purejava purejava commented Apr 27, 2023

Copy link
Copy Markdown
Contributor

This PR changes the tray icon support for Linux away from AWT towards the libayatana-appindicator and the libappindicator library as suggested in #1645.

It displays SVG versions of the Cryptomator icon, that scale and should look ok on all desktop environments.

Some notes on requirements to get appindicator support:

  • libayatana-appindicator is a native library, that needs to be installed on the system. It is on most recent Linux desktop environments though. On Ubuntu, the package is named libayatana-appindicator3-1, on Arch linux it's called libayatana-appindicator. Please note, that it might be necessary to install a required package in order to make the lib visible to java. It's a dev-package called libayatana-appindicator3-dev.
  • There is another native library, that's used as a fall back, if it is installed on the system: libappindicator. On Ubuntu, the package is named libappindicator3-1, on Arch linux it's called libappindicator-gtk3. The dev package is named libappindicator3-dev.
  • Recent GNOME desktop environments by default do not allow the SystemTray icon to be shown. It's necessary to install the Appindicator Support plugin to show an appindicator icon at all
  • Of course, tray icon support needs to be enabled in the Cryptomator settings:
  "showTrayIcon": true,
  • On Debian*ish systems, libraries are located under /usr/lib/x86_64-linux-gnu/. To run Cryptomators AppImage version, you need to start it with a preceding LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu.

A note from the development perspective:

All requests from the previous PR have been implemented.

Edit: added LD_LIBRARY_PATH requirement

Edit 2: reduced requirements due to release 1.3.3 of appindicator-gtk3-java

@overheadhunter

Copy link
Copy Markdown
Member

All requests from the previous PR have been implemented.

Except for the fact that we would love to add this implementation to the integrations-linux repo. 😅

@purejava

Copy link
Copy Markdown
Contributor Author

Except for the fact that we would love to add this implementation to the integrations-linux repo. 😅

I thought we decided against it? 🙂 At least, it doesn't make sense to me.

If this is still wanted, I'd bring up my question from the linked comment again / I would need directions on how to do it.

@overheadhunter

overheadhunter commented Apr 29, 2023

Copy link
Copy Markdown
Member

@purejava TrayMenuController is part of the integrations-api as well, so you don't need anything from this repo. All the imports can happen in integrations-linux as well:

import org.cryptomator.integrations.common.CheckAvailability;
import org.cryptomator.integrations.tray.ActionItem;
import org.cryptomator.integrations.tray.SeparatorItem;
import org.cryptomator.integrations.tray.SubMenuItem;
import org.cryptomator.integrations.tray.TrayMenuController;
import org.cryptomator.integrations.tray.TrayMenuException;
import org.cryptomator.integrations.tray.TrayMenuItem;

I would need directions on how to do it

Just move the implementation that you did here to the other repo. 😉

@purejava

Copy link
Copy Markdown
Contributor Author

Just move the implementation that you did here to the other repo. 😉

Thanks for the directions of what to do.

After moving stuff to integrations-linux, a 'split jar' problem showed up:

Modul org.cryptomator.integrations.linux liest Package org.freedesktop.dbus.handlers sowohl aus kdewallet als auch aus org.freedesktop.dbus

I'll have to fix this in kdewallet and make a new release before this PR will compile.

@purejava

purejava commented May 1, 2023

Copy link
Copy Markdown
Contributor Author

Here is the required PR on integrations-linux: cryptomator/integrations-linux#18

This should be it! This PR is ready for review now.

Please note, testing everything together brought up one last point:

Error Code S7V8:7KAL:7KAL
java.lang.UnsupportedClassVersionError: org/cryptomator/jfuse/api/Fuse (class file version 63.65535) was compiled with preview features that are unsupported. This version of the Java Runtime only recognizes preview features for class file version 64.65535
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1013)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1091)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:182)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:821)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(BuiltinClassLoader.java:741)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:665)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at org.cryptomator.frontend.fuse@2.0.5/org.cryptomator.frontend.fuse.mount.LinuxFuseMountProvider$LinuxFuseMountBuilder.mount(LinuxFuseMountProvider.java:105)
	at org.cryptomator.desktop/org.cryptomator.common.mount.Mounter.mount(Mounter.java:134)
	at org.cryptomator.desktop/org.cryptomator.common.vaults.Vault.unlock(Vault.java:150)
	at org.cryptomator.desktop/org.cryptomator.ui.keyloading.KeyLoadingStrategy.use(KeyLoadingStrategy.java:79)
	at org.cryptomator.desktop/org.cryptomator.ui.unlock.UnlockWorkflow.attemptUnlock(UnlockWorkflow.java:70)
	at org.cryptomator.desktop/org.cryptomator.ui.unlock.UnlockWorkflow.call(UnlockWorkflow.java:60)
	at org.cryptomator.desktop/org.cryptomator.ui.unlock.UnlockWorkflow.call(UnlockWorkflow.java:31)
	at javafx.graphics@20.0.1/javafx.concurrent.Task$TaskCallable.call(Task.java:1426)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1623)

jfuse seems to need an update too.

@overheadhunter

Copy link
Copy Markdown
Member

jfuse seems to need an update too.

A JDK 20 release of jfuse is already prepared. We're making the switch really soon.

Comment thread dist/linux/common/org.cryptomator.Cryptomator-unlocked.svg Outdated
Comment thread pom.xml Outdated
Comment thread src/main/java/module-info.java Outdated
Comment thread src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java Outdated
Comment thread src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java Outdated
Comment thread src/main/java/org/cryptomator/ui/traymenu/TrayMenuBuilder.java Outdated
@overheadhunter

Copy link
Copy Markdown
Member

It's an env var only valid for this step and so seemed the best fitting solution to me.

Nevertheless, it doesn't explain why we don't have env vars for LOG_DIR, PLUGIN_DIR, SETTINGS_PATH, P12_PATH, ..., too. 😉

--java-options "--enable-preview"
--java-options "--enable-native-access=org.cryptomator.jfuse.linux.amd64,org.cryptomator.jfuse.linux.aarch64,org.purejava.appindicator"
--java-options "-Xss5m"
--java-options "-Xmx256m"
--java-options "-Dcryptomator.appVersion=\"${{ needs.get-version.outputs.semVerStr }}\""
--java-options "-Dfile.encoding=\"utf-8\""
--java-options "-Dcryptomator.logDir=\"@{userhome}/.local/share/Cryptomator/logs\""
--java-options "-Dcryptomator.pluginDir=\"@{userhome}/.local/share/Cryptomator/plugins\""
--java-options "-Dcryptomator.settingsPath=\"@{userhome}/.config/Cryptomator/settings.json:@{userhome}/.Cryptomator/settings.json\""
--java-options "-Dcryptomator.p12Path=\"@{userhome}/.config/Cryptomator/key.p12\""
--java-options "-Dcryptomator.ipcSocketPath=\"@{userhome}/.config/Cryptomator/ipc.socket\""
--java-options "-Dcryptomator.mountPointsDir=\"@{userhome}/.local/share/Cryptomator/mnt\""
--java-options "-Dcryptomator.showTrayIcon=true"
--java-options "-Dcryptomator.integrationsLinux.trayIconsDir=\"${TRAYICONSDIR}\""
--java-options "-Dcryptomator.buildNumber=\"appimage-${{ needs.get-version.outputs.revNum }}\""

Therefore, I would like this to be changed to

--java-options "-Dcryptomator.integrationsLinux.trayIconsDir=\"@{appdir}/usr/share/icons/hicolor/symbolic/apps\"" 

@purejava

Copy link
Copy Markdown
Contributor Author

I have open questions regarding the (non-modular) packages. And also important in this context: Can secret-service still be used?

I had an eye on the other integrations for the keyring, and they still do work. If you feel like, you can test it yourself with the AppImage mentioned above. It needs to be noted, that it was build with integrations-linux 1.3.0-beta4 and therefore appindicator-gtk3-java 1.3.2, so you still need LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu when running the AppImage.
This is not needed anymore with appindicator-gtk3-java 1.3.3..

@purejava

Copy link
Copy Markdown
Contributor Author

It's an env var only valid for this step and so seemed the best fitting solution to me.

Nevertheless, it doesn't explain why we don't have env vars for LOG_DIR, PLUGIN_DIR, SETTINGS_PATH, P12_PATH, ..., too. 😉

Sorry. I misunderstood your question in the first place. This can be changed. Testing it right now in my branch, where I can run the GitHub workflow to create a new AppImage.

@purejava

Copy link
Copy Markdown
Contributor Author

@overheadhunter your suggested change works. Done with 3fbc5e8.

@overheadhunter overheadhunter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

😇

Comment thread dist/linux/appimage/build.sh Outdated
@purejava

Copy link
Copy Markdown
Contributor Author

Turns out, that org.gnome.Nautilus-symbolic.svg suffers from the same problems (16px small, does not adjust to color scheme).

Is org.gnome.Nautilus-symbolic.svg one of the icons in the xfce4-panel?

With these instructions, I identified one of the icons that is used in the xfce4-panel and used it for the Cryptomator AppImage too. It looks like this:

Bildschirmfoto 2023-07-13 um 20 08 20

Same as with your test @overheadhunter.

@infeo infeo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems to work! No blocker on my side.

@overheadhunter

Copy link
Copy Markdown
Member

@infeo what about your last requests for changes? I would at least want to update to the final API version before merging this. Otherwise no complaints from my side.

@infeo

infeo commented Jul 17, 2023

Copy link
Copy Markdown
Member

Oohh, right there was also this request, seems like it got lost. @purejava see #2885 (comment)

@infeo infeo mentioned this pull request Jul 18, 2023
2 tasks

@infeo infeo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

With integrations-beta5, on Kubuntu no appindicator library (libayatana or -indicator) is found. @purejava Is this expected?

But apart from that, the ship is ready to sail!

@infeo infeo merged commit 3071cfb into cryptomator:develop Jul 26, 2023
@purejava

purejava commented Jul 26, 2023

Copy link
Copy Markdown
Contributor Author

With integrations-beta5, on Kubuntu no appindicator library (libayatana or -indicator) is found. @purejava Is this expected?

It contains latest appindicator version 1.3.3, so any of these libs should be found, when installed.

There were OSes, were initially none of these is installed, but I can't tell out of my mind, if this is the case for the KUbuntu (version?, vanilla or not?) you are using.

@infeo Did you check, whether one of the libs is installed?

But apart from that, the ship is ready to sail!

Great! I am happy, that all of the PRs got merged! 😃

@overheadhunter overheadhunter linked an issue Jul 29, 2023 that may be closed by this pull request
@aberenguel

Copy link
Copy Markdown

I think it should invert the colors when we are using dark theme.
Tested on 1.10.0-beta2.

image

@purejava

Copy link
Copy Markdown
Contributor Author

I think it should invert the colors when we are using dark theme.

Tested on 1.10.0-beta2.

I wish there was a way for a SVG icon to adjust its colors to theme changes for every Linux desktop environment.

We are aware of this (see #2885 (review), #2885 (comment) and following comments in this issue).

What Linux desktop environment and distribution are you using?

@aberenguel

Copy link
Copy Markdown

What Linux desktop environment and distribution are you using?

I'm using Kubuntu 23.04 (KDE Plasma 5.27.4)

@overheadhunter

Copy link
Copy Markdown
Member

@aberenguel can you open a new bug report for your specific distro and desktop environment?

@purejava

Copy link
Copy Markdown
Contributor Author

I'm using Kubuntu 23.04 (KDE Plasma 5.27.4)

Thanks. Problems with KDE have been reported before. Unfortunately, I cannot reproduce this. I set up two VMs, in which I installed your version of KUbuntu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment