mpdeimos / gnome-shell-remove-dropdown-arrows

Removes the dropdown arrows from the AppMenu and SystemMenu (AggregateMenu) which were introduced in Gnome 3.10.
https://extensions.gnome.org/extension/800/remove-dropdown-arrows/
GNU General Public License v3.0
52 stars 11 forks source link

Connect to panels "actor-added" signals #8

Closed kamilprusko closed 6 years ago

kamilprusko commented 7 years ago

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.

mpdeimos commented 7 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 :)

mpdeimos commented 7 years ago

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 :/

kamilprusko commented 7 years ago

"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:

I'll try to make a patch for this tomorrow.

mpdeimos commented 7 years ago

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.

kamilprusko commented 7 years ago

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.

mpdeimos commented 7 years ago

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...

kamilprusko commented 7 years ago

No problem :)

Thanks for heads up.

mpdeimos commented 6 years ago

@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: