Jas-SinghFSU / HyprPanel

A Bar/Panel for Hyprland with extensive customizability.
448 stars 32 forks source link

Volume/brightness notification lag #105

Open Anas-Hamdane opened 1 month ago

Anas-Hamdane commented 1 month ago

When I continuously increase or decrease the volume or brightness (e.g., by long-pressing the buttons), multiple notifications should appear. However, these notifications aren't showing up because AGS has crashed

Message displayed in the terminal

(com.github.Aylur.ags:14355): Gjs-CRITICAL **: 19:54:27.449: Attempting to run a JS callback during garbage collection. This is most likely caused by destroying a Clutter actor or GTK widget with ::destroy signal connected, or using the destroy(), dispose(), or remove() vfuncs. Because it would crash the application, it has been blocked.
The offending callback was SourceFunc().
== Stack trace for context 0x626df093a880 ==
#0   626df0a03358 i   resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266 (abc0437d560 @ 139)

https://github.com/user-attachments/assets/a6cd888b-0d3e-4c96-b699-8e377b8fa702

Jas-SinghFSU commented 1 month ago

Could you please put this in your script that is sending those notifications:

notify-send -r 989898

The -r 989898 will give your volume notifications an id so that every subsequent notification you send will replace the last one rather than spawning 10s or hundreds of them.

See if that improves it for you.

Anas-Hamdane commented 1 month ago

As you mentioned, there's now one notification but the lag issue remains unchanged

this is my notification part

notify-send -r 989898 -e -h int:value:"$(get_volume | sed 's/%//')" -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" "Volume: $(get_volume)"

And without the -r 989898 option swaync works perfectly by replacing the last one

Jas-SinghFSU commented 1 month ago

Different notifications daemons handle replacing notifications in their own ways. For the AGS notification service -r is the flag that provides the id.

As for the lag, after testing, it seems that the AGS notification service isn't able to handle the high frequency of calls that are made on volume events such as the ones you're running into and it overwhelms it.

This is a big reason the OSD to indicate volume levels and brigthness was created. I can look further into it but since HyprPanel doesn't handle the notification service, I'm not sure there's much that can be done for now.

You can disable the notification script and just use the OSD if you like but I'm afraid the high frequency of events that the volume event spawns is overwhelming the service, causing some lag.

Anas-Hamdane commented 1 month ago

Anyways Thank you for your perfect work 👍🙂