On 08/19/2010 12:37 AM, Joe(theWordy)Philbrook wrote:
> 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????

There is usually a graceful way for some apps. You will have to 
individually treat each app, check whether it is running, and if it is 
running then use commands adapted to that particular app.

For example all gvim instances run as servers (vim probably doesn't by 
default) and you can send remote commands to them and make them save and 
quit. Similarly, many apps have dbus instances and often if you browse 
through the dbus tree, you will find that it has a quit command.

------------------------------------------------------------------------------
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