ænd*_*rük 12 empathy instant-messaging autostart 11.04 memenu
这是我登录后做的第一件事:
我怎样才能让它自动发生?
Kus*_*hal 14
要在您登录时自动启动默认的 Ubuntu IM 应用程序 Empathy,以下说明来自OMG Ubuntu:
Empathy 需要一点点刺激才能继续登录。
如果您认为选中 Empathy 首选项中的“启动时自动连接”框与在系统登录时启动有关,那是情有可原的。不是,在这种情况下,启动是指 Empathy 的启动——而不是您的计算机的启动。
我们可以通过转到系统>首选项>启动应用程序>新项目并在相关字段中输入以下信息来使其在登录时启动:
名称:同理心
命令:同理心 -h
此脚本会在屏幕锁定或屏幕保护程序激活时自动将状态设置为“不可用”,并在屏幕保护程序关闭时将其恢复为可用(在线)!
#!/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)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3472 次 |
最近记录: |