如何从命令行Pidgin Instant Messenger中设置/更改我的状态(例如可用/忙/远)?我需要这个,以确保每当我锁定屏幕时,我的状态会更改为"离开"。我安装了" AwayOnlock"插件,但似乎不适用于Mate桌面环境。
我能够创建一个简单的python脚本来做到这一点:
set_im_status.py
#!/usr/local/bin/python
import sys
import dbus, gobject
from dbus.mainloop.glib import DBusGMainLoop
dbus_loop = DBusGMainLoop()
bus = dbus.SessionBus(mainloop=dbus_loop)
dbus_obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
purple = dbus.Interface(dbus_obj, "im.pidgin.purple.PurpleInterface")
status = sys.argv[1]
# Available
if status == "a":
status_id = dbus.String(u'available')
# Busy
elif status == "b":
status_id = dbus.String(u'unavailable')
# Away
elif status == "w":
status_id = dbus.String(u'away')
# Invisible
elif status == "i":
status_id = dbus.String(u'invisible')
# Offline
elif status == "f":
status_id = dbus.String(u'offline')
else:
status_id = dbus.String(u'available')
status_type = purple.PurplePrimitiveGetTypeFromId(status_id)
saved = purple.PurpleSavedstatusNew("", status_type)
purple.PurpleSavedstatusActivate(saved)
现在将状态设置为"忙",运行:% python set_im_status.py b