Re: Programmatically shutdown and start KMail?

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

 



On Wednesday 04 August 2021 11:13:56 am Slávek Banko wrote:
> Dne st 4. srpna 2021 Michael napsal(a):
> > Is there a dcop, or other way, to have KMail gracefully shutdown from a
> > bash script?
> >
> > I want to turn it off while nightly backups are running…
>
> dcop kmail MainApplication-interface quit

On Wednesday 04 August 2021 11:18:09 am dep wrote:
> said Michael:
> | What was the name of the dcop GUI thingy?
>
> kdcop

Thanks Slávek and dep!

Maybe a difference in language pack(s) installed (or an upper/lower case 
typo?)?, but between dep giving the GUI program and Slávek's command I worked 
out this:

dcop kmail MainApplication-Interface quit

Note: "dcop kmail.MainApplication-Interface.quit()" as implied by the kdcop 
GUI does not work on the command line...

I always liked dcop, if you can figure it out you can do amazing things with 
it (e.g. programmatically add contacts to KMail)

Since I ultimately didn’t want to quit KMail (messes up its location in the 
panel), I had it suspend operations until the backup was complete.  Here’s 
the two pieces of code for anyone who’s interested:

Best All,
Michael

# # KMail, stop checking mail
# Don't want to quit KMail as that changes its place in the taskbar
# dcop kmail MainApplication-Interface quit
# To check mail
# dcop kmail KMailIface checkMail
# To 'pause' KMail, run both
# dcop kmail KMailIface stopNetworkJobs
# dcop kmail KMailIface pauseBackgroundJobs
KMailOn=1
dcop kmail KMailIface stopNetworkJobs
EXITCODE="$?"
if [ $EXITCODE -eq 0 ] ; then
  dcop kmail KMailIface pauseBackgroundJobs
  CurrDateTime=$(date +"%y-%m-%d %H:%M:%S")
  echo "$CurrDateTime: KMail set offline"
else
  CurrDateTime=$(date +"%y-%m-%d %H:%M:%S")
  echo "$CurrDateTime: KMail was not running?"
  KMailOn=0
fi


# # KMail, re-start checking mail
# If KMail wasn't running, don't start it.
# nice -n 2 /opt/trinity/bin/kmail & >/dev/null 2>/dev/null
if [ $KMailOn -eq 1 ] ; then
  dcop kmail KMailIface resumeNetworkJobs
  dcop kmail KMailIface resumeBackgroundJobs
  CurrDateTime=$(date +"%y-%m-%d %H:%M:%S")
  echo "$CurrDateTime: KMail set online"
fi
____________________________________________________
tde-users mailing list -- users@xxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxx
Web mail archive available at https://mail.trinitydesktop.org/mailman3/hyperkitty/list/users@xxxxxxxxxxxxxxxxxx




[Index of Archives]     [Trinity Devel]     [KDE]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]     [Trinity Desktop Environment]

  Powered by Linux