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

MacOS Handles menus differently than Windows and Linux #40

Open
socialmediarefugee opened this issue Oct 22, 2023 · 3 comments
Open

MacOS Handles menus differently than Windows and Linux #40

socialmediarefugee opened this issue Oct 22, 2023 · 3 comments
Labels
Acknowledged We are aware of this issue and will respond soon

Comments

@socialmediarefugee
Copy link

MacOS handles all of the menu functions for applications. Generally, the Cocoa application object is supplied with delegates implementing a command pattern. Gtk has traditionally had difficulties with this, requiring a separate library to fully support it. Now, that library is deprecated because, supposedly, gtk4 handles that. It may be as simple as providing true values for GtkSettings:gtk-shell-shows-app-menu and GtkSettings:gtk-shell-shows-menubar

@Clemapfel Clemapfel added the Acknowledged We are aware of this issue and will respond soon label Oct 23, 2023
@Clemapfel
Copy link
Owner

Clemapfel commented Oct 23, 2023

I don't see how these settings would help but you can set them like this:

using Mousetrap
import GTK4_jll

main() do app::Application
    
    settings = ccall((:gtk_settings_get_default, GTK4_jll.libgtk4), Ptr{Cvoid}, ())
    @ccall GTK4_jll.libgtk4.g_object_set(settings::Ptr{Cvoid}, "gtk-shell-shows-app-menu"::Cstring, true::Bool, C_NULL::Ptr{Cvoid})::Cint
    @ccall GTK4_jll.libgtk4.g_object_set(settings::Ptr{Cvoid}, "gtk-shell-shows-menubar"::Cstring, true::Bool, C_NULL::Ptr{Cvoid})::Cint

    # your code here
end

You may need to install GTK4_jll with import Pkg; Pkg.add("GTK4_jll")

@Clemapfel
Copy link
Owner

Clemapfel commented Oct 23, 2023

I've been looking into https://docs.gtk.org/gtk4/method.Application.set_menubar.html which states:

Depending on the desktop environment, this may appear at the top of each window, or at the top of the screen

I don't have a mac to test if this is indeed the thing we are looking for, since there needs to be some kind of function that provides GTK4 a MenuModel, this might be it.

I added this function for 3.1, though it will be reserved to Mousetrap.detail since this function does literally nothing on both Windows and Linux, on those platforms MenuBar should be used instead.

@socialmediarefugee
Copy link
Author

No joy as of yet. Today I installed a Linux vm and will test on that to confirm that what I’ve written works. Then I will retest on MaOS. Probably in the next few days

@Clemapfel Clemapfel linked a pull request Nov 16, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Acknowledged We are aware of this issue and will respond soon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants