Are the SessionMenu's LogOut, Shutdown and Restart functions tightly intergrated into Gala/Unity?

Asked by Lee Hyde on 2014-06-12

I suppose that this is a slightly inappropriate question to ask, as it's asked with the intent of repairing my mixed pantheon-compiz session. However ask I will. :-)

I have for some time now favoured Compiz, with it much greater feature set, to Gala (no offence intended) and am this running an up to date pantheon session wherein Compiz replaces Gala. Aside from a few visual and power management glitches, it runs rather well.

The power management glitches however, are annoying. Under a pure pantheon session (i.e. with Gala) the log-out, shutdown and restart entries in the session menu work as expected, displaying what appear to be libgranite confirmation dialogues. Similarly, under Unity, these session menu functions run perfectly. Displaying what appear to be lubunity confirmation dialogues. Under compiz proper however nothing happens. I assume that this is because these entries now call some bus or somesuch to which compiz is not listening (but to which Unity and Gala are listening, and respond to by displaying a confirmation dialogue).

Is this the case? If so, is there any way to provide that functionality under a pantheon-compiz session? Maybe some sort of script, a hack or something. As much as I like Gala, for me it's not ready for prime time use. Depending on the sensibilities of its developers (i.e. light weight vs feature rich) it may never be. I simply abandon Compiz's extensive feature set too much and couldn't very well expect Gala's developers to implement even a fraction of that (though I have been intending to gather together a list of a few key features to file blueprints and bugs against Gala to see wherethe devs stand).

Anyway, I'm rambling. Any assisatance and/or advice would be greatly appreciated.

Lee Hyde.

Tom Beckmann (tombeckmann) said : #1

The problem is actually that plank registers itself at the unity dbus to get the badges and so on and the indicator then assumes that "a unity" is running. Gala also provides "a unity", so that's not a problem. I broke the relevant part out of gala's code and made it standalone:
Just have this run everytime you login and you should get the dialogs similarly to those in gala. A proper fix would be telling the indicator that there's not actually a unity running, but that'd require patching. Compilation instructions are included in the file, you'll need a valac and libgranite-dev. I haven't actually tested shutting down my machine, but it should work.

Lee Hyde (anubeon) said : #2

That is brilliant (and very informative) Tom, thank you greatly. :-)

I should be able to get that compiled and hopefully all will be well with pantheon-compiz again. Well, all except compiz's window decorators inability to render elementaryOS grey properly. *sigh*

Lee Hyde (anubeon) said : #3

PS: I wonder whether this would work for or be any use to the denizens of bug #1242112. I'll mention it to them once I've confirmed that your fix works for me. :-)

Lee Hyde (anubeon) said : #4

If I had one litte niggle, it'd be that your fix doesn't seem to throw a confirmation dialogue for suspend (The computer just suspends, no confirmation dialogue). Then again, I don't know whether Gala does either. Any ideas why this is?

Tom Beckmann (tombeckmann) said : #5

I checked the indicator's source. Apparently they don't request a dialog for suspend and hibernate and just have the action start immediately. So you won't get the chance to confirm with gala or unity either.

Lee Hyde (anubeon) said : #6

Well that seems like bad practice to me, especially with respect to hibernation (not that I can get hibernation to work under Ubuntu!). Thanks for the ultra-swift heads up though. :-)

quequotion (quequotion) said : #7

I'd like to suggest Tom's broken out, separate daemon as a better solution for this issue than integrating the code into gala.

My reasons are as follows:

Gala is a window-manager, not a session manager, and this code covers interaction between indicator-session and the session manager. The code does not belong in the window manager, which is only one of the desktop environment's components, but in something that negotiates between the session manager and the desktop environment. If anywhere in pantheon, I feel this might be cerbere. In truth, I'd rather see the indicator-session forked to remove the unity-specific components and the need for this block of code entirely.

The pantheon components (wingpanel, plank, slingshot-launcher, cerbere) are wonderfully portable and modular; they can be used in almost any DE. Canonical's indicators are neither portable nor modular due to tight integration with unity. Tightening integration of indicator-session with gala reduces the portability and modularity of wingpanel, as indicator-session will depend on gala to function. This reduces the capability of pantheon to be adopted in other distributions and desktop environments.

Tighter integration with indicator-session increases the likelyhood that gala will have to be modified to keep up with upstream API changes from canonical. It would be easier to keep this code separate from your own projects so it can be more easily updated without digging through unrelated code.