Qortal / qortal

Qortal Project Core - decentralize the world - Data storage, communications, web hosting, decentralized trading, complete infrastructure for the future blockchain based Internet
https://qortal.org
70 stars 60 forks source link

[linux] Tool tip on systray icon doesn't show Build Version #43

Closed DemonRx closed 1 year ago

DemonRx commented 3 years ago

image

archived-2 commented 3 years ago

Thanks - what Linux distro and version are you running?

DemonRx commented 3 years ago

Distributor ID: Ubuntu Description: Ubuntu 21.04 Release: 21.04 Codename: hirsute

DemonRx commented 3 years ago

Referencing a relevant line of code: https://github.com/Qortal/qortal/blob/b1777b601116de818810abe35b47211c9e694944/src/main/java/org/qortal/controller/Controller.java#L878

It is however curious that in the log file it correctly outputs the full build version.

QuickMythril commented 3 years ago

there should be a Line Break after the height, before the build version. that would be the "\n" shown in the code above. for some reason it does not seem to apply that properly in Linux or Mac, but only in Windows. i tried looking into the cause and a possible solution, but was not able to fix it myself. image

xspektrex commented 3 years ago

@QuickMythril

try the system-dependent approach... String newline = System.lineSeparator();

resulting in... String tooltip = String.format("%s - %d %s - %s %d", actionText, numberOfPeers, connectionsText, heightText, height) + newline + String.format("Build version: %s", this.buildVersion);

QuickMythril commented 3 years ago

tested with + newline + and also directly + System.lineSeparator() + which both worked fine on windows, but neither fixed the issue in linux VM: Kernel: 5.4.0-74-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: Cinnamon 4.8.6 wm: muffin dm: LightDM Distro: Linux Mint 20.1 Ulyssa base: Ubuntu 20.04 focal just tested on macos VM and actually did not have a newline issue at all, with current 1.4.3 download, or using lineSeparator.

from: https://stackoverflow.com/questions/56110590/system-lineseparator-does-not-work-in-linux-environment "You need to use \r\n explicitly to separate your lines. You can't rely upon System.lineSeparator(), because this is dependent upon JVM config; by default, that config will use just \n on Linux." i had tried "\r\n" before and just to be sure tested it again with no success. just tried System.getProperty("line.separator") also.

QuickMythril commented 3 years ago

https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6580959 "EVALUATION - I haven't found any place in TrayIcon specification about handling special characters like \n, so this change request may be easily closed as not a defect. Moreover, with the upcoming JTrayIcon class (Swing-based tray icons support) this problem will go away automatically."

https://docs.oracle.com/javase/7/docs/api/java/awt/TrayIcon.html "When displayed, the tooltip string may be truncated on some platforms; the number of characters that may be displayed is platform-dependent."

i looked into JTrayIcon but couldn't figure anything else out. seems like this is a bug combined with an OS limitation. i have come up with a sort of workaround (at least for english) just by shortening the words used: image

Pull request to fix this issue - https://github.com/Qortal/qortal/pull/48

QuickMythril commented 1 year ago

Thank you for the feedback. This appears to be an OS limitation. The build version can now be displayed in a dialog window as a workaround. I think this issue can be closed / considered resolved.