frossi, Saturday 18 January 2014 à 17:28
|
|
Subscription date : 18 January 2014
Messages : 5
|
Hi,
Thanks a lot for Cairo Dock, it was my salvation when unity and gnome shell happened :-).
Under version 3.3.2, I'm trying to use a custom shutdown script using the option in the log out applet, but it seems the script is never called. I've looked into applet-logout.c and according to the code of _shut_down(), it seems that the user script is only called when myData.bCanStop is false (line 664). I'm not sure to understand everything in the code but I'm under the impression that this will be only false in situations where the current user is not allowed to shutdown. In other words, if one is allowed to shutdown, then the specified shutdown script will not be used. This seems a bug (again, if I understand correctly!).
As a side note, I wanted to use this functionality in order to have .bash_logout called on shutdown. I'm using lightdm's session-cleanup-script to have it called when a user logs out, but it seems lightdm is not killed cleanly when a user ask for a reboot or a shudown, and the session cleanup script is not called in those two cases. I doubt it's cairo dock related, but there is a cairo dock way to have something called when a user quits a session (in all possible ways), I'd like to be referred to it.
Thanks a lot and keep up the good work!
Fabrice |
matttbe, Saturday 18 January 2014 à 18:50
|
|
Subscription date : 24 January 2009
Messages : 12573
|
Yes, it's a fallback option: the dock will first try to shutdown your computer by using logind (or consolekit) and if it's not possible, it will then use your custom command or gnome-session, etc.
I think we did that because the support of logind (and consolekit) has been added after.
As a side note, I wanted to use this functionality in order to have .bash_logout called on shutdown.
Maybe we can add this a feature ("called a script before shutting down your computer") but I'm not sure that this task should be done by the dock because 'logout' applet is not the only way to shut down/restart/logout, etc.
If you're using logind, you can be notified via a D-Bus signal when the computer is being shutting down. E.g. you can download this python script here, then:
- Replace PrepareForSleep by PrepareForShutdown
- Replace
def on_received_signal_login1 (bSuspend): print ("on_received_signal:", bSuspend)
if (not bSuspend):
restart_dock ()
by def on_received_signal_login1 (bShutdown): print ("on_received_signal:", bShutdown)
if (bShutdown):
os.system ("/PATH/TO/YOUR/SCRIPT")
But note that when shutting down your computer, the time will be limited... Maybe it's better to launch a script to do an action and then it will automatically shutdown/restart/logout... by using logind (or UPower/Consolekit)
PS: @fabounet: do you think that logout can give the possibility to launch a script before shutting down the computer? Or should we improve the description of the fallback option? |
Guest, Saturday 18 January 2014 à 21:00
|
|
|
Hi,
Thanks for the quick answer.
Yes, it's a fallback option: the dock will first try to shutdown your computer by using logind (or consolekit) and if it's not possible, it will then use your custom command or gnome-session, etc.
I think we did that because the support of logind (and consolekit) has been added after.
Ok, then maybe the documentation texts could include something about that (as you suggest in the message to fabounet (by the way, I'm French and my first name is also Fabrice ;-). I was under the impression one could replace the commands (logout, etc.) by something else in any case.
About the shutdown, I think I had some permission problems because I just checked again after fixing permission and it seems lightdm does indeed call the session cleanup script even in case of reboot/shutdown. Sorry for the noise about that. Considering it's then easily done under lightdm, there might be no particular reason to had this kind of facility to Cairo Dock (this is also easily done with gdm, I think).
Fabrice |
matttbe, Saturday 18 January 2014 à 22:54
|
|
frossi, Sunday 19 January 2014 à 14:44
|
|
Subscription date : 18 January 2014
Messages : 5
|
While my official nickname is Boubou I do go by Fabounet from times to times ;-). But unfortunately, my C is quite rusted and I've not particular idea to contribute as an applet (all the D-Bus infrastructure is amazing, by the way). I will however try to report some of the small glitches I've encountered. Not bug per se but unexpected behaviour like this custom log out action.
F. |
matttbe, Sunday 19 January 2014 à 20:53
|
|
Subscription date : 24 January 2009
Messages : 12573
|
Reporting bugs/glitches/ideas is also a way to contribute to this project |
|