Is there a terminal command that can change Gnome 3's Chat Status?

Tags:

Answer: 1

20 hours ago

I am working o a script that will automatically change the Gnome Shell integrated chat/messaging status to "unavailable" when the screen is locked, or the gnome-screensaver is activated.

Anyone knows what is the terminal command that sets the gnome messaging system status to "available" or "unavailable"?

I have tried addons on pidgin and empathy, but it seems like the gnome messaging status does not depend on these.

Added by: Kassandra Renner

Answer: 2

36 hours ago

got it to work! simple python script:

#!/usr/bin/python

import os
import time
import dbus
session_bus = dbus.SessionBus()
from gi.repository import TelepathyGLib as Tp
from gi.repository import GObject
loop = GObject.MainLoop()
am = Tp.AccountManager.dup()
am.prepare_async(None, lambda *args: loop.quit(), None)
loop.run()

screensaver_started = 0
running = 0

while 1:
        active = 0
    out = ""
    pid = 0

    if screensaver_started == 0:
        # Don't do anything if the screensaver isn't running
        s = os.popen("pidof gnome-screensaver")
        spid = s.read()
        s.close()
        if len(spid) > 0:
            screensaver_started = 1
    else:
        h = os.popen("gnome-screensaver-command -q", "r")
        out = h.read()
        active = out.find("inactive")
        h.close()

        if active < 0 and running == 0:
            am.set_all_requested_presences(Tp.ConnectionPresenceType.OFFLINE, 'Offline', "")
            running = 1
        elif active > 0 and running == 1:
            am.set_all_requested_presences(Tp.ConnectionPresenceType.AVAILABLE, 'available', "")
            running = 0
        time.sleep(3)

this script will automatically set status to "unavailable" when screen is locked or screensaver is activated, and will bring it back to available (online) when screensaver is closed!

Added by: Einar Haley

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9