There exist programs like Cfosspeed and Netlimiter that allow high-speed websurfing while transferring files but they are not freeware, consume memory, and don't give perfect speeds like next script:
Powerful solution is to start/stop transfers when using webrowser.
Little script runs in background and stops transfers while webrowser is active. Script keeps surf speed perfect.
Run this bash script at (linux) startup:
#!/bin/bash
while true
while true
do
sleep 12
b=$(printf '%x\n' $(xdotool getactivewindow))
a=0x0
ab=$a$b
#echo $ab
browserID=$(wmctrl -l | grep -m 1 "Firefox" | awk '{ print $1 }')
#echo $browserID
if [ "$ab" = "$browserID" ]
then
#echo browser active, shutting down transmisssion
(ps ax | grep -v grep | grep transmission) #check if transmission
if [ "$?" -eq 0 ];
then
b=$(xwininfo -name Transmission | grep Window\ id:\ | awk '{print $4}') #get progr$
xvkbd -xsendevent -window $b -text "\Cq" #send keystroke to quit program
echo off send to transmission
sleep 100
fi
else
#echo browser not active
(ps ax | grep -v grep | grep transmission) #check if transmission
if [ "$?" -ne 0 ];
then
nohup transmission&
sleep 8
echo
fi
fi
echo
done
Please change Transmission to yout p2p-clients name and Firefox to your browser.
To make application start invisibly send it to other desktop:
transmissio&
altdesktop=`wmctrl -d | grep "-" | awk '{ print $1 }'`
sleep 0.5
#repeat next lines few times
wmctrl -R Transmission -t $altdesktop&
wmctrl -r Transmission -t $altdesktop&
sleep 0.1
0 comments:
Post a Comment