Skip to content
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

Allow easier running, stopping, logging of OpenRefine #3221

Open
thadguidry opened this issue Sep 25, 2020 · 25 comments
Open

Allow easier running, stopping, logging of OpenRefine #3221

thadguidry opened this issue Sep 25, 2020 · 25 comments
Labels
help wanted An issue that we would love anyone to help us with Platform: Windows Indicates that the issue or feature is specific to the Windows operating system. Type: Feature Request Identifies requests for new features or enhancements. These involve proposing new improvements.

Comments

@thadguidry
Copy link
Member

thadguidry commented Sep 25, 2020

We want to make running and stopping easier for OpenRefine on Windows and Linux (we assume MacOS is good enough for now).

Proposed solution

Windows

On Windows, allow running OpenRefine as a native application, possibly with tray icon support (without displaying the console by default).

  • JAVA - The current supported and recommended community practice in Java world is to code a small JavaFX application.
  • RUST - But we might also instead use an actual systems programming language like Rust with Druid or Relm ((see Alternatives below).

The MVP for the application would be:

  1. The application window UI would have the following elements:
    • scrollable console text output (configurable line history display buffer with default at 3000)
    • File menu with options
      • Exit to ask a standard "Are you sure - OK/Cancel" and then gracefully shutdown OpenRefine and then the GUI app.
    • Close button (red X) on the GUI app would offer a confirmation dialog Are you sure you wish to exit OpenRefine?
    • Minimize/Maximize buttons
  2. OPTIONAL -
    • Save Log to allow saving the entire log output since beginning of application startup to a file
    • System Tray icon support
    • Right click on the System Tray gives only a single option Exit OpenRefine.
    • Double-click System Tray icon opens the application UI.
    • Toast notifications on Windows 10/11

Linux

TODO: On Linux, allow running OpenRefine as / with ???

MacOS

Nothing to do ?

Alternatives considering

  1. @dante9992 also mentioned that Tauri also supports system tray icon on Windows and can do app signing, self updating, toast notifications, etc. It also allows the app to be packaged as a .deb (Debian package) file. @thadguidry asked and paid for the Tauri team (see comments below) to put together a prototype with Tauri and Rust with code now stored here: https://github.com/OpenRefine/openrefine-tauri

  2. @timClicks said to me on Discord that we could just use Rust and Druid or maybe Relm

  3. some very hacky Launch4j opensource wrappers that are not 100% ideally compatible with Windows 10. (they were mostly coded and made for pre Win8.1 OS and no longer sufficient)

  4. Electron - has some non-free issues (see comment below)

Additional context


JAVA

From what I read so far, not entirely sure if AWT is really needed for SystemTray support (it was in JavaFX 8). Newer OpenJFX 11 or 15 might not need AWT at all, dunno. But just in case, here's some good info I found about showing/hiding the application when clicking the systray icon
https://javafxpedia.com/en/knowledge-base/12571329/javafx-app-in-system-tray

One of the nice things about using a library like FXTrayIcon below is that it hides AWT / Swing complexity, since AWT is still necessary for System tray support on OS's, unfortunately.

JavaFX might be a nice way to optionally allow running OpenRefine on all 3 OS's, Linux, MacOS, Windows.

GlucoStatusFX (which has nice source code to follow along) uses JavaFX and the FXTrayIcon library which allows it to run the application in the system tray of Windows and MacOS. The system tray feature, however, doesn’t work on all Linux distributions. In that case, the application is available through the dock. Which is likely a perfect balance for our Linux users.

Oracle provides a very useful guide for Self -Contained Application Packaging that covers Windows, Linux, Mac
https://docs.oracle.com/javase/10/deploy/self-contained-application-packaging.htm
OpenJFX has wide community support now and can be utilized to code a small JavaFX application that runs OpenRefine from a system tray utilizing a library like FXTrayIcon.
OpenJFX Intro: https://openjfx.io/openjfx-docs/#introduction
OpenJFX Wiki: https://wiki.openjdk.java.net/display/OpenJFX/Main


RUST

Even though Rust provides a way to handle system tray and a WebView, it's likely much more approachable for our existing contributors & core team to instead leverage JavaFX which can also use WebView and all the bells and whistles such as CSS, Canvas, etc. Still, below are some Rust references for the daring:

Iced

https://github.com/hecrj/iced

Druid

https://raphlinus.github.io/rust/druid/2020/09/28/rust-2021.html
https://github.com/linebender/druid/tree/master/druid
https://linebender.org/druid/
https://docs.rs/druid/0.7.0/druid/

Relm

https://github.com/antoyo/relm

Tauri

https://tauri.studio/en/
https://github.com/tauri-apps/tauri
https://tauri.studio/en/docs/usage/guides/visual/system-tray


@thadguidry thadguidry added Type: Feature Request Identifies requests for new features or enhancements. These involve proposing new improvements. help wanted An issue that we would love anyone to help us with Platform: Windows Indicates that the issue or feature is specific to the Windows operating system. labels Sep 25, 2020
@thadguidry thadguidry self-assigned this Sep 25, 2020
@tfmorris
Copy link
Member

These sound like two different features. Is there a reason to couple them together?

@wetneb
Copy link
Sponsor Member

wetneb commented Sep 26, 2020

I really agree we need both of these things, but they should be distinct issues indeed.

  • the integration as tray icon could be platform-independent (it would make sense on Linux too - I guess the mac integration is already good enough in this respect)
  • the innosetup package could be generated regardless

@thadguidry thadguidry changed the title Proper installer for Windows with System Tray icon support Allow easier running, stopping, logging of OpenRefine Sep 26, 2020
@thadguidry thadguidry removed their assignment Sep 26, 2020
@thadguidry
Copy link
Member Author

@wetneb @tfmorris I've relabeled and changed the scope on this issue. (Feel free to edit the the Linux and MacOS sections). And I split the Windows Installer portion to issue #3224

@thadguidry
Copy link
Member Author

thadguidry commented Jun 23, 2021

Added note in Alternatives considering and Additional Context from @timClicks about using Rust to possibly make things easier for all 3 platforms support.

@thadguidry
Copy link
Member Author

thadguidry commented Jun 23, 2021

I personally, really like what I see (and wonderful docusaurus docs) with Tauri...which is similar to Electron in some ways. His video is also pretty cool here: https://tauri.studio/en/docs/about/intro

1 thing that he does bring up in the video which I never knew is that if we used Electron to build a mini-app to run and manage OpenRefine...we would be non-free since Electron uses Chromium which contains Widevine and is non-free and must be removed with makefile options. And Electron also has weird un-compliant license headers within it.

@thadguidry
Copy link
Member Author

Add note in original comment about Tauri's capability to bundle the app as a .deb (Debian package) file. https://tauri.studio/en/docs/usage/guides/bundler/debian

@thadguidry
Copy link
Member Author

@wetneb I'm looking to fund this and have Tauri folks help me with it. I talked with them at length today.

From @nothingismagick (Denjell)

yeah, this kind of thing is where tauri really shines
you can totally update your brownfield stack just a little bit and reap the benefits

They've reviewed our architecture lightly and these requirements and are willing to put in the time where I'll make a large 1 time donation to them with my own funds. It will be cross platform for Windows, Linux, Mac.

I'd love to host the 1st review session with you, me, and them, anyone else who wants? Just to ensure we are all clear and have a good idea of the MVP detailed here for all 3 platforms that's extendable in the future for OpenRefine 4.0+.

Thoughts?

@nothingismagick
Copy link

Just a heads up, gnome engineers are probably removing rhe system tray entirely, and app menus too.

https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/App-Menu-Retirement

@wetneb
Copy link
Sponsor Member

wetneb commented Jun 25, 2021

Thanks for the notification @nothingismagick! The link you posted is about app menus, which does not seem to affect those plans much, but I would be interested about more pointers about the system tray.

@thadguidry I had a quick look at Tauri and it seems to be an alternative to Electron. I think this is not what this issue is about: having a more convenient launcher (without having to use the terminal), but still accessing OpenRefine via your browser.
For me it is clear that having a proper launcher (with system tray integration if that is still a thing, or any alternative that is available) would be a real benefit, but the move to an Electron-style app is more debatable. For some workflows (like reconciliation) it is quite convenient that OpenRefine lives in a browser tab and other browser tabs can be used to access data sources (APIs, authority databases, tutorials…) and switching between them quickly.

Concerning packaging, it's nice that Tauri comes with packaging features, but we can find similar features in other tools. For instance, the Deb package generation feature will not produce something suitable for integration in official package repositories (since it bundles up everything without packaging dependencies individually).

@thadguidry
Copy link
Member Author

thadguidry commented Jun 25, 2021

@wetneb I pinged @lucasfernog (member of Tauri) who's actually hacking on some of it at this moment, to step into this issue and reply to you on those points to get clarity.

@lucasfernog
Copy link

Tauri does not "bundles up everything without packaging dependencies", the Deb can specify Linux dependencies and only includes the Tauri binary and frontend assets (including the server, webapp and refine binary).

OpenRefine would still be accessed on the browser, the Tauri launcher is just a helper. Of course you can get the same functionality using another tools, but with Tauri you don't need to deal with all the cross platform stuff, most of the work is already implemented. I've managed to get a prototype running in a couple hours, and I suspect it would take a least a week to get tray/menu/UI working on all three platforms and bundle them with Windows installer / macOS .dmg / Linux packages. It also helps you with code signing.

@wetneb
Copy link
Sponsor Member

wetneb commented Jun 25, 2021

That sounds perfect then! Looking forward to it :)

@thadguidry
Copy link
Member Author

@wetneb Do we need to worry about Freexian at this point, whose helping us on other matters with the Debian packaging? I guess I'll let you sort those things out (head's spinning). Good Night.

@wetneb
Copy link
Sponsor Member

wetneb commented Jun 25, 2021

Again I don't know Tauri at all but even if it can be configured to rely on pre-packaged dependencies I suspect it would be still quite hard to use it to produce a package for Debian's official repository. For instance because Tauri itself would need to be packaged for Debian first, since it would become a build dependency of OpenRefine (but maybe I am also wrong on this and @lucasfernog knows of official Debian packages made with Tauri?).

And even if it actually became suitable to produce such a package, that would not make Freexian's work useless, since a big part of their work actually went into packaging our dependencies first…

@lucasfernog
Copy link

Tauri does not have a Debian package since it's just a Rust library that depends on WebKitGTK (and Tauri automatically adds that and GTK as a Debian dependency).

@nothingismagick
Copy link

Sorry I thought I posted both links, here you go:

https://blogs.gnome.org/aday/2017/08/31/status-icons-and-gnome/

@thadguidry
Copy link
Member Author

@wetneb Hi Antonin, @lucasfernog and @nothingismagick have sent you and I (email from GitHub) the access to his private repo to review the preliminary "startup app" (we need a better name eventually for our docs, lolol). I chatted briefly with them today on Discord direct message, but this probably needs a call just to ensure you are comfortable and can ask questions. Can you set something up for all of us? I can't do this without your keen eyes.

@lucasfernog
Copy link

The app only supports Linux and Windows so far because I saw on the website only a DMG installer for Mac - does it also have a bash script like Linux? That would be easier to manage.

@wetneb
Copy link
Sponsor Member

wetneb commented Jun 26, 2021

The bash script that we recommend for Linux can actually also be used on Mac. The DMG gives a better UX because people don't have to use the terminal to start the app.
I've sent an invite for a call, happy to reschedule if it doesn't work for you.

@thadguidry
Copy link
Member Author

thadguidry commented Jul 9, 2021

@wetneb Hi Antonin, it looks like first creating a new separate repo for us would be ideal to hold the tauri-openrefine code they helped us with. A few Rustaceans have volunteered to help us out also! (I'm impressed by the Rust community!) Those other Rustaceans are awaiting our repo creation and code to review with us and help us do the integration and resolve issues along the way.

@wetneb
Copy link
Sponsor Member

wetneb commented Jul 9, 2021

The prototype is here: https://github.com/OpenRefine/openrefine-tauri

@thadguidry
Copy link
Member Author

@nothingismagick We'd like you to clarify the license as BSD-3 for the tauri code ya'll contributed. Can you offer a PR which makes that change for us in our new repo for it?

@thadguidry
Copy link
Member Author

Asked @lucasfernog in a new PR for accepting MIT license with his name as copyright holder in the prototype repo.

@wetneb
Copy link
Sponsor Member

wetneb commented Oct 17, 2022

The OpenRefine project has funding available to work on this. Do you know someone who would be able to get this fixed? Send them our way!
https://openrefine.org/blog/2022/09/30/windows-macos-packaging.html

@thadguidry
Copy link
Member Author

@HanSolo Do you think you might be interested in helping us build a small JavaFX app launcher? We have funding, see comment above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted An issue that we would love anyone to help us with Platform: Windows Indicates that the issue or feature is specific to the Windows operating system. Type: Feature Request Identifies requests for new features or enhancements. These involve proposing new improvements.
Projects
None yet
Development

No branches or pull requests

5 participants