Closed kamilprusko closed 6 years ago
Wow, thanks for the contribution! I'm unfamiliar with actors in shell, do you know which is the minimum shell version this can be used with?
In the meantime I'll test the extension this week :)
Oh and while we're on it... How exactly can I reproduce the issue that the arrow is not removed w/ pomodoro? The reason why I am asking is that the CPU Power Manger always shows the drop down if enabled after my extension. I was hoping that your modification may fix this as well, but sadly it doesn't :/
"actor-added" is available since 3.0. This is more related to Clutter API than to GNOME Shell.
In Pomodoro issue can be reproduced with development version, master branch. Arrow is visible at all times.
CPU Power Manager first adds a container actor and then indicator contents. I see two approaches to handle cases like this:
Mainloop.idle_add
before calling recursiveEdit
, downside - it may show the arrow for a frame or twoI'll try to make a patch for this tomorrow.
You don't have to provide a patch :) I actually thought that the behavior is caused as the indicator is added after extension enablement in a callback to an external process. But this should be fixed already by your patch. I didn't know that the indicator itself is added in a container, tho.
For a solution I'd actually combine both approaches: only if an empty container is detected watch for the actor-added event.
Ok, I've added a hybrid solution and some code optimizations to limit recursion. For my use-case (Pomodoro + CPU Power Manager) it now performs 85 dropdown checks instead of 172. Turns out "actor-added" is also emitted when hovering over an indicator (swaps Texture actor), so I've opted for disconnecting checking handlers as soon as possible.
Used GLib.SOURCE_REMOVE
is available since GNOME Shell 3.12.
Thanks for your effort! I've quite a busy week, so cannot promise test & merge till next week. Just want to give a quick heads up that I'm really sorry about this...
No problem :)
Thanks for heads up.
@kamilprusko sorry that it took me so long, code changes looks OK. Will release a new version in the following days. Thanks for the rewrite :+1:
I'm a developer of the Pomodoro extension and recently saw a need to setup indicator after performing some async checks first.
With this patch, the extension will work with dynamically added indicators. It will no longer rely on extension status, just act right after an indicator is added.