Inoculado
Power Member
Achei por bem meter esta dica aqui ,em x de outro post para assim poder partilhar com todos os interessados.
I use the Transmission BitTorrent client, and it’s pretty cool. However, it’s irritating when it eats my bandwidth while I’m trying to do stuff. So, one obvious hack would be to disable it when the screensaver is off (i.e., I’m using the computer) and enable it only when the screensaver is on (i.e., I’m in bed). Fortunately, Transmission has an API (which you have to enable by turning on the web interface in Preferences) and you can watch the Gnome screensaver for changes. So, a quick Python script later, and throw that Python script and Transmission itself into your session Startup Programs to make them run whenever you log in, and Bob’s your uncle. the script: #!/usr/bin/env python
import dbus, urllib
from dbus.mainloop.glib import DBusGMainLoop
se quiserem podem colocar a traduçao por baixo .
I use the Transmission BitTorrent client, and it’s pretty cool. However, it’s irritating when it eats my bandwidth while I’m trying to do stuff. So, one obvious hack would be to disable it when the screensaver is off (i.e., I’m using the computer) and enable it only when the screensaver is on (i.e., I’m in bed). Fortunately, Transmission has an API (which you have to enable by turning on the web interface in Preferences) and you can watch the Gnome screensaver for changes. So, a quick Python script later, and throw that Python script and Transmission itself into your session Startup Programs to make them run whenever you log in, and Bob’s your uncle. the script: #!/usr/bin/env python
import dbus, urllib
from dbus.mainloop.glib import DBusGMainLoop
FonteSTART_TORRENTS = "http://localhost:9091/transmission/rpc?method=torrent-start"
STOP_TORRENTS = "http://localhost:9091/transmission/rpc?method=torrent-stop"
DBusGMainLoop(set_as_default=True)
sess=dbus.SessionBus()
def sig(screensaverActive):
if screensaverActive:
data = urllib.urlopen(START_TORRENTS).read()
else:
data = urllib.urlopen(STOP_TORRENTS).read()
sess.add_signal_receiver(sig, 'ActiveChanged','org.gnome.ScreenSaver')
import gobject
loop = gobject.MainLoop()
loop.run()
se quiserem podem colocar a traduçao por baixo .