feat(systray): added systray widget #155
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A system tray widget that works similar to the original Windows systray.
Functionality:
Known limitations:
Some technical stuff:
It works by creating a process that intercepts the messages meant for the real systray, extracting all the data it needs (icon, tooltip, callback, etc.) and forwarding those messages to the original system tray to not interrupt its functionality.
The main trick here is to create a window that has the exact same class name as the original system tray and set it as topmost to get the messages priority. It needs to reset its "topmost" state every 100ms so that Windows keeps sending messages to it.
When the window gets the WM_COPYDATA message, this message will contain all the necessary data for a fully functional systray icon: icon handle, original window handle, callback for clicks, etc.
Example config:
Example CSS:
Special thanks:
Special thanks to Zebar team and especially @lars-berger and @HolbyFPV for their fantastic systray-util rust crate. It would have been much harder to implement the Python version without their work. And of course the Managed Shell team for the original idea of intercepting systray messages.