jonelo / HashGarten

A cross-platform Swing GUI for Jacksum.
GNU General Public License v3.0
9 stars 1 forks source link

Cannot run HashGarten GUI standalone #2

Closed mjk-gh closed 8 months ago

mjk-gh commented 9 months ago

HashGarten seems to be a phantastic project, but for the life of me, I cannot get it to run in standalone GUI mode.

I am using a 64-bit Devuan Daedalus (=Debian Bookworm (stable) without SystemD) with X.org (and fvwm), and have the following Java packages installed:

openjdk-11-jdk:amd64                             11.0.22+7-1~deb11
openjdk-11-jdk-headless:amd64                    11.0.22+7-1~deb11
openjdk-11-jre:amd64                             11.0.22+7-1~deb11
openjdk-11-jre-headless:amd64                    11.0.22+7-1~deb11
openjdk-17-jdk:amd64                             17.0.10+7-1~deb12
openjdk-17-jdk-headless:amd64                    17.0.10+7-1~deb12
openjdk-17-jre:amd64                             17.0.10+7-1~deb12
openjdk-17-jre-headless:amd64                    17.0.10+7-1~deb12

I downloaded from https://jacksum.net/ two versions: CLI and with file-browser integration.

After unzipping jacksum-3.7.0-hashgarten-0.14.0-linux-file-browser-integration-2.5.0.tar.bz2, the directory looks like this:

HashGarten-0.14.0.jar
flatlaf-3.2.jar
jacksum-3.7.0.jar
jacksum-file-browser-integration.sh
license.txt
readme.txt
readme_de.txt
release_notes.txt

I try to run it like this:

$ echo $DISPLAY
:0
$ ./HashGarten-0.14.0.jar
/home/mjk-default/.HashGarten.properties (No such file or directory)
Jacksum: Warning: No files have been specified, reading from standard input stream (stdin) ...
^C
$

While the readme.txt lists a file browser as requirement, the README.md on the github page says:

Run it standalone

I also tried to compile the source myself, but could not find any build instructions.

So: How do I run HashGarten in standalone GUI mode?

Thanks in advance!

jonelo commented 9 months ago

Thank your for your request!

If you want to run HashGarten in standalone mode, it is required to have all required files in one directory. Downloading and extracting jacksum-3.7.0-hashgarten-0.14.0-linux-file-browser-integration-2.5.0.tar.bz2 is perfectly fine - even if you don't want integrate it into your file browser, because the package contains all the files you need also for standalone mode. The readme.txt in the package mentions that a file browser is required, but that applies only to the file browser intregration script actually, because without a file browser a file browser integration makes no sense.

So standalone mode is supported for HashGarten as mentioned on the HashGarten GitHub page.

To run HashGarten in standalone mode you go to the directory where all the required files are stored, and run java -jar HashGarten-0.14.0.jar (on some systems you can even start the .jar directly).

Do you see the GUI open on your system after the two warnings have been printed?

BTW, you can ignore the warning that .HashGarten.properties cannot be found, because if you start HashGarten for the first time the property files will not be there, it will be created after the first successful hashing. You can also ignore the warning from Jacksum saying No files have been specified, reading from standard input stream (stdin) because since we didn't provide any arguments on the command line at that stage, Jacksum sees no tasks which is not problem, because we are going to add hash tasks at the GUI.

HashGarten supports the same options as Jacksum does, and HashGarten passes all given arguments to Jacksum by Jacksum's API. If you don't provide any options to HashGarten, that is also perfectly fine, but you have to feed the GUI with values then.

Since it is probably not that obvious what to do at the GUI, I am happy to explain it in detail.

grafik

1 - Click on the Select button and select the algorithm(s) you want to use for hashing 2 - Click on the Add button and add files and/or folders you want to hash 3 - Specify a file where the standard output should be stored 4 - Specify a file where the standard error should be stored 5 - Click on calculate hash values to start the process

You can specify many more options (e.g. by enabling advanced mode), but those are the required ones if you want to run HashGarten in standalone/hashing mode.

Does that answer your question? Apologies if I misunderstood your question.

mjk-gh commented 9 months ago

@jonelo Thanks for your detailed answer!

[...]

To run HashGarten in standalone mode you go to the directory where all the required files are stored, and run java -jar HashGarten-0.14.0.jar (on some systems you can even start the .jar directly).

Tried both ways, to no avail.

Do you see the GUI open on your system after the two warnings have been printed? [...]

My apologies, should have written that explicitly! No GUI visible whatsoever.

As it turns out, my window manager (fvwm3, but has been like this from the beginning) does not like Java GUIs at all. The GUIs are always visible, but the WM has trouble with focusing on the individual windows or even individual text entry fields. The usual fix is to let the FvwmIdentify module (called e.g. from an fvwm menu, then click on a window) find out the resource name of the JAVA GUI window(s), then add a

Style "net-jacksum*" FPLenient

to the fvwm config file and restart fvwm.

This time, I could not do that, because there was no HashGarten window to be seen, on none of my 9 virtuel pages. Checked every single one of them.

But the HashGarten window appeared in fvwm's window list! And as soon as I clicked on this entry, fvwm jumped right to another virtual page, and focused on the HashGarten window, which treacherously peacefully sat in the upper left corner (coordinates 0,0) all of a sudden.

The main GUI window still has the following problems, though:

Otherwise, it seems to work just fine (have not tested it thoroughly yet, though). The GUI layout might not be completely straight-forward, but as I don't have any creative resources currently, I cannot make any suggestions on improving it, so it has to stay that way. :) And I am really glad this tool exists! ❤️

If you have any ideas why your program is the only one never showing a window without being explicitly switched to via fvwm's window list, let me know. :-}

jonelo commented 9 months ago

I have installed fvmw3 on Debian 12, and I was able to reproduce the issue. Actually the issue appeared to be cross platform, but fvwm3 revealed it.

The root cause is a incorrect calculation of the virtual screen's width which leads to an x-coordinate that are thousands of pixel away of the visual view - which makes the window invisible actually.

I have rewritten the entire method which should now set the location of the window in the center of the screen. In case of multiple screen devices, it tries to center the window on that screen where the mouse cursor is actually. That strategy may still fail in some circumstances (especially where we have different window managers), but the window should be visible at least.

Could you please test the new binary attached to this note, and let me know if it works for you on your system?

Attaching a .jar to a GitHub note is not allowed, so I gzipped it. HashGarten-0.15.0-SNAPSHOT-20240212.jar.gz

jonelo commented 9 months ago

I have added issue #3 for problem 3.

jonelo commented 9 months ago

I have added issue #4 for problem 2.

mjk-gh commented 9 months ago

I have installed fvmw3 on Debian 12, and I was able to reproduce the issue.

Wow, thanks for the effort! 🥰️

[...]

Could you please test the new binary attached to this note, and let me know if it works for you on your system?

Attaching a .jar to a GitHub note is not allowed, so I gzipped it. HashGarten-0.15.0-SNAPSHOT-20240212.jar.gz

The window appears smack dab in the middle, much better, thank you! :)

One micro-nitpick (that can be totally ignored!) is that, if advanced mode is on, the window gets cut off on the left and the right side:

hg15-adv

If I then make it manually as wide as my screen (1200 pixels), a few things get cut off, because they don't fit in that width (I can live with that), but one thing gets overlapped on that width, although it does not have to: The "Quit" button gets overlapped by the "Dark Theme" button:

hg15-adv-resized

Not a drama, either, just thought that would be easily avoidable (in theory -- Java might disagree :-}).

jonelo commented 8 months ago

I have just released HashGarten 0.15.0. See also https://github.com/jonelo/HashGarten/releases/tag/v0.15.0

It addresses the issue described initially in this thread.

Please note that it requires FlatLaF 3.4 to run properly. File Browser Integrations with all required binaries will follow. Thanks for your patience!

jonelo commented 8 months ago

Oh, and BTW, HashGarten 0.15.0 comes with changes that addresses all the other spin-off problems described/discussed in this thread. Thanks again @mjk-gh for reporting! Much appreciated!