Comments (4)
Hey @aggmoulik, thanks for the interest! I would very much like some help with this project.
I initially started on a macOS / AppKit implementation, and progress on that went okay-ish, but quickly found that I was not satisfied with the available libraries for interacting with Objective-C, so I've started a whole endeavour to make that better (which is what now takes most of my time
Missing from the current macOS implementation is probably the most important thing: the ability to add callbacks (e.g. functions that trigger when the item is clicked).
Anyhow, the general plan is split in two stages: The first is to develop and expose Rust APIs wrapping the platform-specific primitives (NSMenu
, HMENU
, GtkMenu
and so on). These should be as zero-cost as possible, and allow for essentially everything you could want to do with the menu.
This includes:
- Using it in the application’s menu bar
- Contextual menus
- Creating macOS pop-up menus
- Using it in the macOS status bar
- The macOS Dock menu
- ...
Having the platform specific API, it will be much easier to go to the next stage: To try and build a common abstraction over it. So that's the approximate roadmap, though I don't have any dates for this or anything.
I'm thinking we want "backends" for at least the following GUI toolkits:
- AppKit
- Win32
- Browser extensions
- GTK
- Qt
- UIKit (Mostly for Mac Catalyst, not a priority)
- Normal web pages (deprecated and only available in previous Firefox versions, haven't really found another way to get this functionality)
from menubar.
If you want something to work on, it would be nice to get started on a Windows/Win32 implementation, probably using stuff in windows-sys
(instead of the older winapi
, since the windows
crates are directly supported by Microsoft).
I should note, picking this project as a starting point for learning Rust is quite tough even if you know C/C++ already, because it entails interacting safely with libraries written in those languages, and that requires quite intricate knowledge on Rust's safety and memory models. On the other hand, it's a good way to gain said knowledge.
from menubar.
Hey, @madsmtm Thank You for the detailed answer here. Yeah, I understand it will be a difficult task but at least I can try. I think supporting windows API is ok but how can I test or work on that because I have mac os and Linux.
from menubar.
Ah, fair, then don't bother with that, rather try doing the GTK (or Qt) implementation instead.
A few links on GTK menus I've accumulated in the past:
- https://web.archive.org/web/20210306041654/https://developer.gnome.org/ApplicationMenu/
- https://web.archive.org/web/20210306041746/https://developer.gnome.org/menu-spec/
- https://developer.gnome.org/hig/patterns/controls/menus.html
- https://docs.gtk.org/gtk3/class.Menu.html
- https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/App-Menu-Retirement
- https://wiki.gnome.org/Projects/GTK/Menus
- https://gtk-rs.org/docs/gio/struct.MenuModel.html
- https://github.com/gtk-rs/examples/blob/master/src/bin/menu_bar.rs
- https://docs.gtk.org/gtk4/migrating-3to4.html#gtkmenu-gtkmenubar-and-gtkmenuitem-are-gone
I think we'd want to target both GTK 3 and GTK 4? You should research what even makes sense for a library like this to do in GTK 4.
from menubar.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from menubar.