-
Notifications
You must be signed in to change notification settings - Fork 66
Add basic support for Mac OS X tray icon (without callbacks and additional items) #22
base: master
Are you sure you want to change the base?
Conversation
79a9fc6
to
c891833
Compare
Otherwise it does not work on many systems, as some of the dependencies link different libraries for Linux.
Looks like this died on CI due to a timeout on the LLVM server. I'm kicking it to run again. Assuming it builds, is this ready to land, or should I just bring in the dependency update commit? |
Ah, I forgot that it automatically updates the pull request, just made some local changes here :) Well, basically if you want to know the current state from my side: I've been using your crate with a patched mac version (the one we discussed in a separate issue dedicated to Mac OS X support) for a while and it works fine for Mac, but currently it lacks the possibility to add additional menu items to the tray icon in Mac. But since my branch diverged from master much, I decided to rebase it, bringing this "basic Mac OS X support" and fixing some Linux issues which I observed when I tried to compile it in Linux. Unfortunately I did not have time to write the full support for Mac so far, but I'll try if I find some time in future (unless someone else implements this), I already know how to do it. Apart from that there are also several things which I think have to be changed in this crate to make it usable for production, namely:
|
Yeah, this crate started with good intentions, but I got sidetracked onto some C# and typescript stuff that has kinda eaten my life. I'm /still/ hoping to get more work done on this, and luckily some other project work I need to do involves learning tokio, so I can check out those patterns there to get threaded access working. Also, yay, had no idea winapi 0.3.x was out yet. :D |
@qdot here is by the way another important issue which I believe I mentioned somewhere in other issues in the past -- the tray icon library in the way it is written now will not work for every platform. I tried to adapt my branch to the current state from your master branch and I've noticed that after I did that, my OS X application crashes when I try to use the library, after checking the code I've found a reason for that. Basically we cannot create an "event loop" inside the tray icon library in an arbitrary thread as there are some operating systems (OS X) where we have to stick to the main thread only. Because of that I'm not sure if we can make this library truely crossplatform in the current architecture, because even if we update the architecture and documentation, pointing out that the Currently the user of the library has to create an
In other words, there are a plenty of things we have to think about. Perhaps the best thing which can be done is to write a library which provides something similar to |
Could you please merge this? Maybe the code isn't perfect, but it's a great start. Will be easier to contribute if this is merged and it has just been lying here for over a year now. |
@application-developer-DA I just rebased the snapview/systray-rs MacOS patches over here in an effort to try to get macOS code working, they're on the "macos" branch. I had to add a few more implementations (and I would like to speak to me from 4 years ago about why Window wasn't implemented as a trait...) to get things compiling, but I'm getting a segfault when running the example.
I haven't had a chance to dig into it too much yet, but thanks to working on https://github.com/deviceplug/btleplug and writing the CoreBluetooth impl for that, I've got some ObjC/Rust experience now, so I'll try to help out where I can, if/when I have time. |
@qdot oh, I did not expect you would return working on this ;) I'll try to check in the next days which branch do I use in some of the projects which currently rely on a tray icon crate (they work fine on Catalina and don't crash). I feel that a tray icon crate may require some refactoring, but I just was not able to do that as the priorities changed and now the tray icon part is a very small part of the product I was working on back then. On Linux we rely on libappindicator which seems to be a bit outdated as it does not seem to compile on the latest Rust version anymore (due to some old dependencies). |
Yeah I sometimes end up returning to projects. :)
Ok, don't worry about it too much if you're not using it much anymore. I just saw you had an update a couple of months ago so I didn't know if things were at least somewhat working.
Yeah, I updated all of the libappindicator dependencies, those changes came in with systray 0.4.0 which I released yesterday. |
Hm... I think last time I commited something to that repository was a year ago. Oh, by the way I checked one of the solutions where we use the tray icon and it turned out that we don't have any menus there, just a tray icon, that's probably the reason it does not crash. Maybe the example from From what I can see, the only thing we do with the
UPD. Oh, wait, the tray-icon example for Mac is simple and should work actually. I've just tried to pull the latest |
Partially implements #4