[Feature Request] Implement native macOS menu bar #385

Open
opened 2024-12-15 09:04:25 +00:00 by GabCoolDude · 3 comments
GabCoolDude commented 2024-12-15 09:04:25 +00:00 (Migrated from github.com)

Overview

Currently, Ryujinx, does not use the native macOS menu bar, and instead uses its own menu bar:

Screenshot 2024-12-15 at 09 44 34

I would like to implement this myself, so I looked into avalonia's current implementation of the macOS menu bar using NativeMenu and NativeMenuBar. Whatever I do, NativeMenuBar will not work and idk why. On the other hand NativeMenu, and its "sub-class" NativeMenuItemalso won't work because:

  1. It doesn't support tooltips, and therefore other platforms wont have tooltips anymore (minor)
  2. It doesn't support Name or Tag, meaning that Click will always reference NativeMenuItem, basically meaning you cant do case by case. I tried to do a workaround using Command and Gesture and checking for it in MainMenuBarView.axaml.cs but it wont work for some reason.

With that information, I came to a conclusion. Either we ASK avalonia to add these things and update to the version that implements it, or we use SwiftUI for the menu bar.
I looked a bit further into using SwiftUI, since it's basically my only option at this point, and it looks like we'll need to use .net 9, which added support for Swift bindings and some libraries.

So, we're waiting on either avalonia, or .net 9 support in Ryujinx.

Smaller details

Things we'd have to use: NSStatusBar, NSStatusItem and probably NSStatusBarButton for styling(?)

Nature of request

I like the macOS native menu bar, and also it saves some space on the screen.

Why would this feature be useful?

Makes Ryujinx look a bit nicer on macOS.

### Overview Currently, Ryujinx, does not use the native macOS menu bar, and instead uses its own menu bar: <img width="720" alt="Screenshot 2024-12-15 at 09 44 34" src="https://github.com/user-attachments/assets/1195d87c-6d47-4743-b804-3a7c5c5fa82f" /> I would like to implement this myself, so I looked into avalonia's current implementation of the macOS menu bar using `NativeMenu` and `NativeMenuBar`. Whatever I do, `NativeMenuBar` will not work and idk why. On the other hand `NativeMenu`, and its "sub-class" `NativeMenuItem`also won't work because: 1. It doesn't support tooltips, and therefore other platforms wont have tooltips anymore (minor) 2. It doesn't support `Name` or `Tag`, meaning that `Click` will always reference `NativeMenuItem`, basically meaning you cant do case by case. I tried to do a workaround using `Command` and `Gesture` and checking for it in `MainMenuBarView.axaml.cs` but it wont work for some reason. With that information, I came to a conclusion. **Either we ASK avalonia to add these things and update to the version that implements it, or we use SwiftUI for the menu bar.** I looked a bit further into using SwiftUI, since it's basically my only option at this point, and it looks like we'll need to use .net 9, which added support for Swift bindings and some libraries. So, we're waiting on either avalonia, or [.net 9](https://github.com/GreemDev/Ryujinx/pull/198) support in Ryujinx. ### Smaller details Things we'd have to use: [NSStatusBar](https://developer.apple.com/documentation/AppKit/NSStatusBar), [NSStatusItem](https://developer.apple.com/documentation/appkit/nsstatusitem) and probably [NSStatusBarButton](https://developer.apple.com/documentation/appkit/nsstatusbarbutton) for styling(?) ### Nature of request I like the macOS native menu bar, and also it saves some space on the screen. ### Why would this feature be useful? Makes Ryujinx look a bit nicer on macOS.
GabCoolDude commented 2024-12-15 11:14:52 +00:00 (Migrated from github.com)

Now that I think about it, Swift is definitely the way to go on this, for 2 reasons:

  • No more tooltips for other platforms if we use avalonia.
  • We'd have to ask avalonia to implement names and tags on NativeMenuItem, wait for it to be implemented, and then once it's implemented wait for a release, and then update to that release, which might break other stuff.
Now that I think about it, Swift is definitely the way to go on this, for 2 reasons: - No more tooltips for other platforms if we use avalonia. - We'd have to ask avalonia to implement names and tags on `NativeMenuItem`, wait for it to be implemented, and then once it's implemented wait for a release, and then update to that release, which might break other stuff.
InstantRamenPack commented 2024-12-18 06:10:40 +00:00 (Migrated from github.com)

+1. Also allows for shortcuts widely used across MacOS applications to also apply to Ryujinx, such as cmd+comma for preferences.

+1. Also allows for shortcuts widely used across MacOS applications to also apply to Ryujinx, such as cmd+comma for preferences.
GabCoolDude commented 2024-12-20 21:36:43 +00:00 (Migrated from github.com)

Now, that .NET 9 has been implemented, I can start working on this.

Now, that .NET 9 has been implemented, I can start working on this.
Sign in to join this conversation.
No Milestone
No project
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MeloNX/Ryujinx-ryubing#385
No description provided.