madsmtm / menubar

Cross-platform native Rust menu library
https://docs.rs/menubar
Apache License 2.0
28 stars 2 forks source link

Contributing and Roadmap #1

Open aggmoulik opened 2 years ago

aggmoulik commented 2 years ago

Hi, @madsmtm I was looking for a good library in rust to create Menubar Applications, I found you are working on it. I am new to Rust and I want to learn by contributing. So, it will be great to collaborate with you and work on this project. If you can share the roadmap for features and what has been built till now.

madsmtm commented 2 years ago

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:

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:

madsmtm commented 2 years ago

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.

aggmoulik commented 2 years ago

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.

madsmtm commented 2 years ago

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:

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.