Skip to content

core: migrate to Hyprutils::CAsyncResourceGatherer and improve resource handling#879

Merged
PointerDilemma merged 19 commits intohyprwm:mainfrom
PointerDilemma:new-resource-manager
Oct 8, 2025
Merged

core: migrate to Hyprutils::CAsyncResourceGatherer and improve resource handling#879
PointerDilemma merged 19 commits intohyprwm:mainfrom
PointerDilemma:new-resource-manager

Conversation

@PointerDilemma
Copy link
Collaborator

This PR utilizes Hyprutils::CAsyncResourceGatherer (hyprwm/hyprgraphics#36) and adds some hyprlock specific stuff on top.

Because of this rewrite I decided to make two significant changes concerning the interface between the gatherer and the widgets:

Resource ids and avoiding duplicate resources

Resource ids are not strings anymore, but instead they are a hash of what was requested.
Before the caller (usually widgets) had to come up with a unique string. Now the resource id is returned when requesting a resource.

Together with the fact that the resources now have a ref count, we avoid having duplicate resources in the resource manager. This is nice to have because when monitor="" there is one widget per monitor that needs the same resource.

onAssetUpdate virtual method for widgets

Before we had to capture a weak reference to a widget in a lambda to safely call the asset callbacks.
Now we don't store a lambda as a callback, but only the weak widget reference. When the resource is finished, we call the virtual onAssetUpdate method on it.

This is implemented using a vector to allow for multiple widget callbacks for a single resource.

@PointerDilemma
Copy link
Collaborator Author

There it is. Currently still testing it too.

@vaxerski
Copy link
Member

in general looks fine, just needs testing

use a simple counter instead of a timestamp to allow the same
widget on a different monitor to reuse a text cmd resource.

I didn't do this before, because I was worried about two labels that use
the same command with different reload times. I mitigated that by just
incrementing the revision by the time interval. This should be sufficent
to avoid clashes.
another much improvement for multi monitor setups.
allows updating within the same frame for most labels.
I tested and it seems like the resource manager revision makes
the nvidia workaround obsolete.
@PointerDilemma
Copy link
Collaborator Author

I tested this on the nvidia machine yesterday and the PR seems to have made this dump workaround we had obsolete.

Also checked asan and ubsan and tested all the widgets.

Some of this code might be changed soon again, when trying to use some of hyprtoolkits implementations.

It should improve idle time quite a bit and reduce rendered assets especially when using multiple monitors.

@PointerDilemma PointerDilemma merged commit de2cc5b into hyprwm:main Oct 8, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants