It would appear that on Aug 17, James Bowlin did say:

> On Tue, Aug 17, 2010 at 05:53 PM, Joe(theWordy)Philbrook said:
> > If it was because my user account didn't have permission to run these
> > shutdown commands (without a sudo password prompt) then I wonder why
> > they succeed in shutting down the x server???
> 
> IIUC, e16 can either just shutdown ("eesh exit") or shutdown by
> via exec'ing some program ("eesh exit exec $SOME_PROGRAM").  Even
> if that program is bogus, e16 is already shut down before there
> is even an attempt to run the program.  If you launched e16 via
> "startx" or "initx" then the X server will get shut down when e16
> exits regardless of what the exec program does.  If you started
> e16 via a program like xdm or kdm or gdm then you should just end
> up back at the *dm login screen when e16 exits.  The X server and
> *dm should not shut down unless the program that is exec'ed shuts
> them down. 

Yeah, I'm a dedicated startx nut who strongly dislikes any/all
{expletive deleted} graphical login screens (in fact I insist on a text
based grub menu && NO splash image because dealing with the graphical
images inserted by some distros into their default grub menu before I
decide to start the gui makes me nauseous...) so when the X server dies I do
in fact wind up in a virtual console.

> > [...]  ... But I'm curious. If e16 relies on the system
> > reboot and poweroff commands, does that mean that applications
> > like openoffice.org wouldn't get to ask me if I wanted to save
> > any changes??? 
> 
> I'm glad you asked.  My understanding is that regardless of the
> poweroff and reboot commands, when e16 shuts down, all open
> windows get annihilated.  So if you just do an "eesh exit" you
> will either get back to a virtual console (like doing a
> Ctrl-Alt-F1 -- Ctrl-Alt-F6) or you will get back to the xdm, kdm,
> gdm login screen and in either case all the windows you had
> opened will have been annihilated.
 
That figures... 

> I wrote a little shell script that allows e16 to exit more
> gracefully.  You can already exit more gracefully by putting your
> own shutdown scripts in the ~/.e16/Stop directory.  You could have
> a script that looks for active open-office programs and then
> shuts them down gracefully if found.

So then, assuming I come up with a working test for active programs script
that somehow tells the applications (kill -15???) that they need to ask
about unsaved changes && quit, Then simply by putting said script in
~/.e16/Stop/scriptname or maybe ~/.e16/Stop/scriptname.sh then 
executing "eesh exit" will automatically run (and wait for said script to
finish before actually exiting e16??

> I wanted to "save state" during the shutdown process so all open
> terminal windows, GVim windows, and browser windows would be
> saved and regenerated when e16 starts up again.  (I wasn't
> completely successful).  E16 can kinda sorta do this already with
> the "remember" functionality but I couldn't figure out how to get
> it to do exactly what I wanted, for example: automatically remembering
> browser tabs, terminal tabs, and GVim tabs.
> 
> When I tried to do this myself via ~/.e16/Stop scripts, I found
> out that if the scripts are blocking e16 (which they have to be in
> order to save window information before e16 shuts down) then any
> calls to eesh cause e16 to hang.  I was using eesh to get
> position, size, and desktop information about the windows I
> wanted to save and restore.
> 
> I got around this problem by writing my own e16-logout script.
> The script will run all the scripts in the ~/.e16/Logout directory
> and then when they are all done it will run either:
> 
>     eesh exit
> 
> or
> 
>     chvt 1
>     eesh exit exec /sbin/poweroff
> 
> or
> 
>     chvt 1
>     eesh exit exec /sbin/reboot
> 
> depending on what command line parameter passed in.  This
> allows me to run scripts that call eesh at shutdown time without
> locking up the system.
> 
> This works great.  I posted an early version of e16-logout here:
> http://forum.enlightenment.org/comments.php?DiscussionID=495&page=1#Item_4
> 
> I think the only thing missing is the chvt commands that switch
> the user to one of the virtual consoles.
> 
> If you don't need to call eesh during your graceful shutdown then
> don't bother with my script and just put your shutdown scripts in
> the ~/.e16/Stop/ directory.  Make sure they are executable and if
> you want them to block e16 (which you probably do) then the
> filenames of the script(s) must end in ".sh".  They don't have to
> be shell scripts.  Perl scripts, or even binaries will work fine
> as long as the name ends in ".sh".

I don't know how to write a script that checks if an application is running
and then tells it to gracefully quit. But I'm thinking it would have to
do something like (using OpenOffice as an example):

piD=$(ps -A| grep soffice.bin |cut -d' ' -f2)
if [ "$piD" != "" ]
        then 
        kill -15 $piD
fi


Except that:


problem 1) kill 15 only preserves the unsaved changes in OO.o docs via it's
           crash/recovery process... (I can't find a signal that causes it
           to ask me about unsaved changes...

problem 2) If I grep for abiword instead of soffice.bin, there is no
           crash/recovery and I still can't find a signal that actually
           causes abiword to prompt about unsaved changes...

problem 3) And of course I can't even imagine how to gracefully close 
           the assorted terminal programs I use such as vim & alpine
           without manually switching to the appropriate terminal window(s) and
           saving any changes. {sigh} But at least I know I always open
           alpine in my second virtual desktop area.  And vim will check for for
           an existing swapfile the next time I open the same document. And few,
           if any, other terminal apps that I'm likely to use are likely to
           have unsaved data to worry about.

           So I really only need to quickly check my 2nd desktop area 
           to see if I was in the middle of a compose session. before I hit
           the three fingered salute... Though when I'm not pressed for
           time I'm likely to walk through all 9 desktop areas looking for
           things to close first...

But surely there must be a more graceful way to close gui apps than kill -15????

-- 
|    ~-~   ~-~     Guess I just don't know how.
|    <?>   <?>     Joseph (the Wordy) Philbrook
|        ^                  J(tWdy)P
|       ___             <[email protected]>

       <sigh>


------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
enlightenment-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-users

Reply via email to