[ANN] Mousetrap, the new Julia GUI Engine, now supports GLMakie & macOS

Available here: https://github.com/Clemapfel/Mousetrap.jl


Mousetrap, a GUI engine designed for Julia, just released version 0.3.0.

This version makes Mousetrap fully portable, meaning it will now run on any 64-bit desktop operating system - without caveats.

It furthermore added a new feature that allows any OpenGL-based library to render to a Mousetrap widget. This was used to implement a (still experimental) GLMakie interface, such that Makie plots can now be displayed inside a Mousetrap application, just like any other widget.

If you were unsure about Mousetrap.jl due to stability, portability, and missing Makie integration, v0.3.0 addressed these concerns and hopes to aid in long-term adoption.

If you are knowledgeable about Makie, consider participating in the development of MousetrapMakie.jl, a newly created package that strives to make Makie integration seamless and fully featured.

Thank you for your consideration,
C. Cords


PS: See here for how to install Mousetrap. We are still waiting on pull requests with Yggdrasil and the Julia registry being merged, meaning add Mousetrap does not yet work, though it will soon.

73 Likes

This looks cool. Thank you for your contribution.

There are a few other tools that seem to have similar functionality and it’s difficult for me to figure which one to use without investing a lot of time playing around with them all.

If I was to choose between Mousetrap and QML.jl (which looks similar) what are the pros and cons of each? Does QML.jl lack the Makie rendering capability?

Are there other Julia GUI engines that are similar to Mousetrap?

3 Likes

Fantastic manual/documentation BTW :slight_smile:

3 Likes

This is incredible, and I just wanted to thank you for all your hard work on this. :smile:

3 Likes

I’m reading through the documentation for touch events, and while there are some multitouch events like pinch-zoom, rotate, and swipe, I was wondering if this can support simultaneous independent touches, each a simple press>possible move>release; an example off the top of my head is how multiple fingers on some drawing apps like Paint can independently draw different things per touch. I had considered if mouse button events can be repurposed for this, but ā€œtouchscreen ā€˜taps’ will be registered as if the left mouse button was pressedā€ seems to imply there can only be one such touch at a time.

1 Like

Looks cool, I’m looking forward to giving it a try.
I too would like comments contrasting this to other packages. It may be that there are no other packages working on guis…but I’m pretty sure I’ve heard of several. I understand the polite desire to refrain from critiquing other packages, but the earlier that architecture differences are made known, the sooner their implications can be considered and resourced correctly.

3 Likes

Is it available only through URL or has it been added to the Julia package registry?

The documentation says:

import Pkg;
begin
    Pkg.add(url="https://github.com/clemapfel/mousetrap.jl")
    Pkg.test("Mousetrap")
end

This paragraph from this package docs is worth highlighting:

Heavy editorializing has taken place, renaming or completely removing certain parts of GTK4 in an effort to make mousetrap more friendly to newcomers and people with no GUI experience, easier to use, and less susceptible to developer error.

1 Like

Hi @Clemapfel, how can we produce a scrollable Tree View using Mousetrap.jl, as in this Gtk.jl example?

Thanks.

1 Like

I just wanted to say good job, you have created a wonderful package with easy to follow documentation. I had two questions:

  1. I was wondering if you have any updates on mousetrap?

  2. I really want to start using it, however it seems that mousetrap does’nt work with julia 1.11, can anyone help me?

A note on the GitHub says

Note: February 8th, 2024: I’ve been having some health issues at the moment, it may take me some time to get to open issues. Mousetrap is still usable and (mostly) stable, the repo will be maintained in the immediate future to the best of my abilities. Thank you for your understanding, C.

The author of Mousetrap is currently commiting actively in their next project, which is in Lua. Mousetrap as well as jluna appear to be abandoned, and the author doesn’t respond to GitHub issues. It is really pity about the wasted effort: One is probably not going to build anything on such a foundation.

No longer works on 1.11 Ā· Issue #87 Ā· Clemapfel/Mousetrap.jl Ā· GitHub Try this fork?

2 Likes

I could install in 1.11 on Linux but not run (seemingly can work, and on Windows, see below):

(pharaldsson) pkg> st
Status `~/Project.toml`
  [ac6e5ff7] JuliaSyntaxHighlighting v0.1.0
  [5deeb4b9] Mousetrap v0.3.3 `https://github.com/HyperSphereStudio/Mousetrap.jl#main`
  [287f9a42] libmousetrap_jll v0.3.0+0 `https://github.com/Clemapfel/mousetrap_jll#main`

julia> using Mousetrap
Precompiling Mousetrap...
Info Given Mousetrap was explicitly requested, output will be shown live 
ERROR: LoadError: InitError: could not load library "/home/pharaldsson/.julia/artifacts/b292ae2e313d5ab559c9838dfb8390f192b4f3b8/lib/libmousetrap_julia_binding.so"
libjulia.so.1: cannot open shared object file: No such file or directory

What might work for others is this fork, note different name with lib in front (but not for me since it’s not build for Linux only Windows, should be fixable):

(pharaldsson) pkg> add https://github.com/HyperSphereStudio/libmousetrap_jll
    Updating git-repo `https://github.com/HyperSphereStudio/libmousetrap_jll`
   Resolving package versions...
    Updating `~/Project.toml`
  [287f9a42] ~ libmousetrap_jll v0.3.0+0 `https://github.com/Clemapfel/mousetrap_jll#main` ⇒ v0.4.8+0 `https://github.com/HyperSphereStudio/libmousetrap_jll#main`
    Updating `~/Manifest.toml`
  [287f9a42] ~ libmousetrap_jll v0.3.0+0 `https://github.com/Clemapfel/mousetrap_jll#main` ⇒ v0.4.8+0 `https://github.com/HyperSphereStudio/libmousetrap_jll#main`
Precompiling project...
  āœ— Mousetrap
  1 dependency successfully precompiled in 5 seconds. 177 already precompiled.
  1 dependency errored.
  For a report of the errors see `julia> err`. To retry use `pkg> precompile`

julia> err
PkgPrecompileError: The following 1 direct dependency failed to precompile:

Mousetrap 

Failed to precompile Mousetrap [5deeb4b9-6e04-4da7-8b7f-c77fb1eae65e] to "/home/pharaldsson/.julia/compiled/v1.11/Mousetrap/jl_ckrovz".
ERROR: LoadError: UndefVarError: `mousetrap_julia_binding` not defined in `libmousetrap_jll`

src/wrappers/x86_64-w64-mingw32-julia_version+1.11.jl
..
ā€œbin\libmousetrap_julia_binding-0.dllā€,

This should work (maybe it does for you, I forget the reason for this error), in 1.11.5:

I fixed old error by [re]moving Manifest.toml file:

julia --project=.

(pharaldsson) pkg> add https://github.com/HyperSphereStudio/Mousetrap.jl
    Updating git-repo `https://github.com/HyperSphereStudio/Mousetrap.jl`
   Resolving package versions...
ERROR: expected package `JuliaSyntaxHighlighting [dc6e5ff7]` to be registered

In my current env for 1.10.5 I’m currently testing:

(pharaldsson) pkg> add https://github.com/HyperSphereStudio/Mousetrap.jl
    Updating git-repo `https://github.com/HyperSphereStudio/Mousetrap.jl`
   Resolving package versions...
ERROR: expected package `JuliaSyntaxHighlighting [dc6e5ff7]` to be registered
(@v1.10) pkg> add https://github.com/HyperSphereStudio/Mousetrap.jl
    Updating git-repo `https://github.com/HyperSphereStudio/Mousetrap.jl`
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package libmousetrap_jll [287f9a42]:
 libmousetrap_jll [287f9a42] log:
 ā”œā”€libmousetrap_jll [287f9a42] has no known versions!
 └─restricted to versions * by Mousetrap [5deeb4b9] — no versions left
   └─Mousetrap [5deeb4b9] log:
     ā”œā”€possible versions are: 0.3.3 or uninstalled
     └─Mousetrap [5deeb4b9] is fixed to version 0.3.3

(@v1.10) pkg> add https://github.com/HyperSphereStudio/libmousetrap_jll
     Cloning git-repo `https://github.com/HyperSphereStudio/libmousetrap_jll`
    Updating git-repo `https://github.com/HyperSphereStudio/libmousetrap_jll`
   Resolving package versions...
    Updating `~/.julia/environments/v1.10/Project.toml`
  [287f9a42] + libmousetrap_jll v0.4.8+0 `https://github.com/HyperSphereStudio/libmousetrap_jll#main`
    Updating `~/.julia/environments/v1.10/Manifest.toml`
  [bde7f898] + GLEW_jll v2.2.0+0
  [bd17208b] + GLU_jll v9.0.1+0
  [cc7be9be] + OpenGLMathematics_jll v0.9.9+0
  [583852a3] + libadwaita_jll v1.3.6+0
  [287f9a42] + libmousetrap_jll v0.4.8+0 `https://github.com/HyperSphereStudio/libmousetrap_jll#main`
  [05823500] ↑ OpenLibm_jll v0.8.1+2 ⇒ v0.8.1+4
Precompiling packages  [=========================>               ]  400/664
  āœ— Cxx
  ā—‘ JuliaFormatter
  ◐ TiffImages
  ◐ Polynomials
julia> Pkg.add(PackageSpec(url="https://github.com/JuliaLang/JuliaSyntaxHighlighting.jl", rev="dc6e5ff7"))
    Updating git-repo `https://github.com/JuliaLang/JuliaSyntaxHighlighting.jl`
ERROR: Did not find rev dc6e5ff7 in repository

julia> Pkg.add(PackageSpec(url="https://github.com/JuliaLang/JuliaSyntaxHighlighting.jl", rev="b666d3c"))
   Resolving package versions...
ERROR: expected package `JuliaSyntaxHighlighting [dc6e5ff7]` to be registered