mate-desktop / mate-polkit

Authentication Agent for PolicyKit and MATE
https://mate-desktop.org
Other
14 stars 14 forks source link

status notifier icon keeps showing after dropping elevated privileges #35

Closed lukefromdc closed 6 years ago

lukefromdc commented 7 years ago

When mate-polkit is complied with appindicator support and run with mate-panel 1.19, a popup menu with one menu item "drop all elevated privileges" is used rather than clicking on the icon to revoke priviliges. Clicking on the menu item does drop priviliges, but the status icon does not disappear, it continues to show until the panel is restarted. The menu pops up and down normally

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/45668158-status-notifier-icon-keeps-showing-after-dropping-elevated-privileges?utm_campaign=plugin&utm_content=tracker%2F1587117&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1587117&utm_medium=issues&utm_source=github).
raveit65 commented 7 years ago

Yes, for this reason i don't use libappindicator for fedora builds. For me libindicator status icon should be use the same behaviour than normal build.

lukefromdc commented 7 years ago

I will try to debug this myself, if I am not successful I will also disable it in my builds. At the moment using it to work on a PR for the panel, https://github.com/mate-desktop/mate-panel/pull/583 at it showed that the new status-nofifier work does not include the panel menu theme support work I did two years ago, and thus menus come up mismatched if the theme sets a different panel menu theme (as mine does)

lukefromdc commented 6 years ago

https://github.com/lukefromdc/mate-polkit/commit/4303d60a2dc218fd66ae823eb76c6f0f11d4a236 is a rough workaround for this. It quits the whole application and lets it respawn. This occurs only when build with appindicator support, the tray icon codepath is unchanged. NO PR as of now, but I am using it.

Mate-polkit from master works fine in gnome-panel, but https://github.com/mate-desktop/mate-panel/commit/36c54308f7b0e05f24b9b90fb2f79546608667b2#diff-6ef0fc6b7e60a4b669e65fa5a7c84435 causes "passive" items to always show, and thus prevents the icon from being removed. I tested reverting this, and was even able to test for the icon name to limit it to mate-polkit, only to find that either permitted the icon to show and be removed once, then it would not show again. Would show again fine in gnome-panel, something didn't update correctly in mate-panel.

Thus, three possible fixes exist: 1: Special case this in the tray sn-notifier/tray applet and fix that failure to update. Best possible way, but I have no idea in the world where that failure to update on

2: Kill the whole app and let is respawn. Apparently the icon will persist as "passive" even after the app_indicator structure is unref'ed and nulled out, so long as the app is running.

3: Create an "null icon" of zero (or maybe 1x1 transparent?) pixel width and height so it does not take up space or show up but with a filename, and reset the icon to that on dropping privileges, then set it back if they are raised again. I tested setting the icon to NULL, but that hits an assertation, and setting the icon to an invalid name brpught up the missing icon icon. Downside here is some users might notice the tray being 1px wider after they have raised privileges oncel

Is anyone using mate-polkit from the command line or in one-shot start sessions? If so, I will rework this to use the empty icon that takes no space instead of stopping and restarting.

lukefromdc commented 6 years ago

Finally found a way to fix this right, but this required changes in both mate-panel https://github.com/mate-desktop/mate-panel/pull/669 to hide this icon when passive and no others and in mate-polkit https://github.com/mate-desktop/mate-polkit/pull/38 to keep the same app_indicator alive so the icon could be shown more than once.