如何从命令行设置/更改Pidgin即时通讯工具中的状态(如可用/忙/离)?我需要这样做才能确保我的状态变为“离开”状态。每当我锁定我的屏幕。我安装了' awayonlock'插件,但它似乎不适用于MATE桌面环境。
答案 0 :(得分:0)
我能够创建一个简单的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