-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add cpu, gpu, memory, text file, and weather bar components #297
Conversation
This is probably the craziest PR that's come in so far haha. The amount of features + fixes is huge, and thanks especially for documenting some of the stuff that desperately needed documenting. Had a quick chat with @notblam regarding the open PRs for weather and system stats bar components (#270 and #253), and we'd be in favour of going with your implementations and just closing those existing ones. We've had some discussions about IPC before on the Discord. Something that's pretty important IMO is that it should be as newbie friendly as possible. Websockets seemed like the favorable choice since it's easily usable in basically every major language. We had a contributor who even started cooking up an implementation, but it's currently paused and unfinished. To figure out what to do about the IPC stuff, feel free to join the Discord server. If you'd prefer discussing on Github instead, I'm cool with that too |
Summary
This pull request introduces several new components to GlazeWM, including CPU Usage, GPU Usage, Memory Usage, Text File, and Weather Components. Additionally, a guide for creating custom bar components has been added. Lastly, an IPC subsystem based on ZeroMQ and UTF8 JSON is introduced, allowing for interprocess communication and remote updating of bar components.
Changes
Demo
Contains most of the new controls; in near-stock configuration.
Characteristics
Caveats
CPU Sensors
CPU Core Temperature
andPackage Power
have some caveats (noted in readme):LibreHardwareMonitor
to read these sensors directly.I cannot confirm these sensors will be correctly read on all processors; as the LHM API returns sensors using inconsistent naming [as strings]. One CPU might use
CPU Package
for power, while another usesPackage
. I can confirm it works for Ryzen 5000; cannot confirm for recent Intel platforms. I got the names for recent Intel CPUs based off of online screenshots ofLHM
.Another thing to note is using a high update rate might cause very high readouts after resume from sleep/suspend e.g. '20GHz Frequency'; especially if using polling rates greater than 1 per second. This isn't something we can do much about however; there isn't enough sensor data.
Extra Details
Improved Memory Efficiency
Old code in
GetProcessOfHandle
allocated a lot of memory because:This code would frequently get fired and unnecessarily enumerate all processes in the system; also adding latency to handling window open operations. Not to mention a lot of Gen0 garbage collections.
The line was simply replaced with:
Now GC is only fired once in a blue moon.
Components Can Now Extend Past Center
Left/Right components can now extend past the center of the bar.
Previously left/right bar components would get clipped at center, even if center and other side were completely empty.
Side Effect: Left/Center/Right can overlap now.
Bar Component: CPU Usage
Displays the current CPU usage.
Bar Component: GPU Usage
This component has high CPU requirement (compared to others); due to no efficient way to pull data from Windows API. Avoid using low refresh intervals.
If multiple GPUs are present; this will average loads between them. I lack a multi-GPU system to implement code to separate them.
Bar Component: Memory Usage
Displays the current Memory usage.
Bar Component: Text File
For displaying any content without a native integrated widget; updates in real time.
Bar Component: Weather
Uses Open-Meteo API, refreshes every hour.
IPC
GlazeWM includes a component for handling inter-process communication.
It is based ZeroMQ for message passing and UTF8 JSON for serialization, therefore should be portable across many languages.
Refer to Client Source for Possible Commands.
By default Port 49999 is used, you can override this in main bar config.
Bar Component: IPC Label
This component allows you to update its text and style remotely using interprocess communication:
To use this, make a new C# project and add a
Project Reference
toGlazeWM.IPC.Client
; then use it as follows:Usage from Other Programming Languages
If you are interfacing from another programming language, do equivalent of:
and simply send update messages.
Check the Messages. folder for list of available messages.
Example payload for IPC Label Component:
Misc Note
I made these changes over the course of some spare time I had last weekend (so over ~2 days); hopefully they prove useful.
I was also considering adding window backup/restore via IPC [using a watcher process] for surviving crashes; but people would probably have their own preferences as to detail of that implementation; so I'm leaving it out for now.