[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: command line saving session



On Saturday 23 January 2010, Kevin Krammer wrote:
> On Friday, 2010-01-22, roberto wrote:
> > hello
> > i am searching for a command line way to save the kde session,
> > since i'd like to place it into a script along with the command to
> > suspend the pc
> >
> > i've found this command:
> > dcop ksmserver ksmserver saveCurrentSession
> >
> > do you think it is right ?
> 
> Yes, that looks right for KDE3, the KDE4 equivalent should be
> qdbus org.kde.ksmserver /KSMServer
> org.kde.KSMServerInterface.saveCurrentSession

Thanks for this! I've long been looking for a way to periodically save 
the session state as I've been annoyed by crashes destroying my setup.

So, below is a script I'm now having cron run every 5 minutes.

Michael


#! /bin/sh

. /usr/share/acpi-support/power-funcs
# for getXuser

for x in /tmp/.X11-unix/* ; do
  displaynum=`echo $x | sed s,/tmp/.X11-unix/X,,`
  getXuser
  if [ x"$XAUTHORITY" != x"" ] ; then
    export DISPLAY=":$displaynum"
    qdbus org.kde.ksmserver \
      /KSMServer org.kde.KSMServerInterface.saveCurrentSession > 
/dev/null
  fi
done

exit 0

-- 
Michael Schuerig
mailto:michael@schuerig.de
http://www.schuerig.de/michael/


Reply to: