Best option to do desktop apps in Elixir

I did not know about revery, of course, if it is done with Reason.

1 Like

Revery looks interesting, specially due to the use of ReasonML, which looks like an OK functional deviation of JavaScript.

However, right now I am not really sure I have the time to learn yet another technology, never mind remaking the entire project from scratch.

CEF looks interesting, but I am afraid my lack of experience with CEF as well as how to link erlang binaries with something else binaries is a decisive factor to not use this solution.

1 Like

Did you seen this one in your research:

Itā€™s the Elixir bindings for:

Maybe @Gee5ive can tell more to us about his experience:

And you also have this research from Joe:

http://erlang.org/pipermail/erlang-questions/2017-July/092949.html

2 Likes

Webview for elixir, unfortunately is not being maintained, nor is it active.
It never left alpha and its development stop 2 years ago.
Looked promising though.

As for the post from Joe, I couldnā€™t take much, as most of the links from there are no longer active (they are broken) and the few links that arenā€™t are for C and Red and REBOL, languages I do not plan on integrating in the project.

Thanks for the research though!

2 Likes

Itā€™s essentially Ocaml, which should feel quite similar to Elixir.

Why not have a study of the Wings 3D codebase and try it out yourself? It has the installer code in it too. I think Fred Herbert made a project in wx not too long ago too which would be worth a look too.

Do you have a link? I am afraid I donā€™t quite understand what you are trying to show me.

Written in Erlang, wings3d.

You could try tauri which targets rust, or sciter-js. Both allows for you to connect to your phoenix server.

Iā€™m not too sure if the self-healing properties of the beam are as beneficial for gui apps, which users can just force kill and restart in seconds. It might even be detrimental to user experience, especially if the app gets stuck in an infinite loop of restarting without the user being able to manually handle the error.

1 Like

onivim autocompletes every do as defmodule or another word, you have to go back to normal mode each time. Awful. Iā€™d say it is not ready for elixir right now :slight_smile:

But the autocomplete and docs for all the standard library and own modules works well!

1 Like

Is using the users default web browser out of the question?

You could use something like Bakeware and then use System.cmd("open http://localhost:<my-port>") to open the default browser on the users machine. The command would differ between OSs, but should be pretty easy to implement.

You should probably also consider a method to figure out an unused port, and include that in your command to launch the browser.

I donā€™t mind using the default browser, itā€™s just I donā€™t know how to make an Elixir program open a new browser window (using the default browser) and then making it open the url I have in mind.

Bakeware looked promising, but it doesnā€™t work for Windows, which is a requirement.

I did find this code snippet:

 def open(url) do
    start_browser_command =
      case :os.type do
        {:win32, _} ->
          "start"
        {:unix, :darwin} ->
          "open"
        {:unix, _} ->
          "xdg-open"
      end

    if System.find_executable(start_browser_command) do
      System.cmd(start_browser_command, [url])
    else
      Mix.raise "Command not found: #{start_browser_command}"
    end
  end

From the project:

Could prove useful, as long as I can make it work for both Windows and Linux.

1 Like

Iā€™ve been working on a library to make the desktop apps part possible here: GitHub - dominicletz/desktop: Elixir library to write desktop apps with OTP24 & Phoenix.LiveView it all depends on Erlang OTP24 because that includes my pull request to include :wxWebView and so you can have a native window that shows your Elixir LiveView app. So the desktop library brings you all of that and avoids the need to mess around with any of the :wx* libs in your app.

Iā€™ve got a local version of an app builder that produces a .dmg for macOS and a nsis Windows installer but itā€™s still a work in progress - planning to get that desktop-builder ready for the Code Beam V in May.

18 Likes

Wow, this is awesome :heart_eyes:

Link to the pull request so that we can upvote it :slight_smile:

Oh, I though it was pending approval(bad interpretation from me), but it was already merged in February :tada:

And for Linux?

1 Like

For linux Iā€™ve got a self-extracting installer based on makeself.io . That one Iā€™m not super happy with though, would prefer a deb package. Iā€™ll push to github as soon as possible.

3 Likes

Better then nothing :slight_smile:

It would be a great addition for sure :slight_smile:

Thanks man. I am really excited with the possibility of writing a modern looking desktop app in Elixir with LiveView. I may make a version of my video notes web app with your desktop library :slight_smile:

1 Like

This project looks rather interesting. Let me know if you give any conferences or do any articles on it, I really would like to learn more about it.

2 Likes

Wow, thatā€™s cool!

Is it limited to browser features or some deeper OS integration is possible?

2 Likes

Yeah Iā€™ll talk at the code beam sto about this project and next steps Virtual Erlang and Elixir Conference for Europe

So far there is a native widow, native desktop notifications and native app icon. Also the sample app is using the sqlite ecto library for local storage. What are you thinking of in terms of deeper OS integration?

1 Like

For example registering itself as a service in macOS and handling NSPasteboard data.

@dominicletz Hello again, do you have a link for the conference? I wasnā€™t able to get a ticket but I am still interested to see how your presentation went !