System
Ubuntu Raring Ringtail (13.04) from fresh installation.
Purpose
Main: Change gsetting (desktop wallpaper) with script on user logout.
What's I've Done : (carefully read)
I try to stop an application named variety (this one) on Logout that I've put my workarounds inside. Variety is an autostart app, so it just started everytime I'm logging in. Variety has a function on_quit()
and force_quit_thread()
that are called when the app process stopped. So, I added my python script line inside, that execute my real script (normalize
). When I tried to quit variety normally, it does what I want! I though, when the system log me out, any process that I started should also be stopped. But then, I realized, it is not. So, I couldn't use this way.
This let me thing to use another way to kill variety process manually when I logging out. I have tried ~/.bash_logout
(I doubt it, because I know autostart does not run on bash); ~/etc/gdm/PostSession/Default
(But, I'm not use gdm); ~/etc/lightdm/lightdm.conf
(This one doesn't work either! How come?); pam_script / pam-script (I don't know how to work with it. Really different.)
Happened
But, the problem comes when I try to log out my account. It neither execute on_quit() nor force_quit_thread(). And the log I captured from ~/nohup.out
see last line, here you are:
.... bla-bla ... [only see last line]
IOError: [Errno socket error] [Errno 2] No such file or directory
(variety:15627): Gdk-WARNING **: variety: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
They lost available resources, right? Not quit-ed normally then and means, gsetting not changed.
Details
Added script inside
quit functions
It is on
/opt/extras.ubuntu.com/variety/variety/VarietyWindow.py
:bashCommand = "/home/abdillah/Toolbox/command/normalize" os.system(bashCommand)
Script inside normalize
Purpose: changing wallpaper when variety quit.
echo $(cat "${HOME}"/.self-log)"| normalize" > "${HOME}"/.self-log #append log wallpaper=$(cat /home/abdillah/.wallpaper) filename="file://"$wallpaper configname=${filename/'#'/"%23"} gsettings set org.gnome.desktop.background picture-uri $configname #the most important
LightDM config file
The one that make me confuse is that in it's documentation, there isn't a statement mentioned
session-cleanup-script
. It is deprecated?[SeatDefaults] user-session=ubuntu greeter-session=unity-greeter autologin-user= session-cleanup-script=/home/abdillah/Toolbox/command/logoff
logoff file contains:
.self-log file still empty => fail
#!/bin/bash echo $(cat "${HOME}"/.self-log)" |fail? (OnScript)" > "${HOME}"/.self-log #append log killall variety /opt/extras.ubuntu.com/variety/bin/variety -q echo $(cat "${HOME}"/.self-log)" |Success? (OnScript)" > "${HOME}"/.self-log #log exit 0
Question
When anyone think, above condition is very specific, just answer the following question.
- How to executing script directly on logout (CMIW the ways above. If not, any suggestion please), or
- How I can stop variety properly when I logged out? (So on_quit() called)
Possible Solution
- Start variety with [StartUpApplication]
in bash
and use ~/.bash_logout script to stop. But, how?
Ok. its long. But, I try to make as clear as possible. Because out there, there are lots of question related with this that I've read.
gsettings reset org.gnome.desktop.background picture-uri
might be a little better.