Add 'torrent' module for bar and 'torradd' script
This commit is contained in:
parent
3426f02017
commit
b55baa6af7
@ -1,16 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
sym="|"
|
sym="|"
|
||||||
|
[ "$(transmission-remote -l | grep %)" ] && delay="10s" || delay="1m"
|
||||||
|
|
||||||
cd "$HOME/.local/bin/scripts/dwmbar/" || exit 1
|
cd "$HOME/.local/bin/scripts/dwmbar/" || exit 1
|
||||||
|
|
||||||
status() {
|
status() {
|
||||||
echo "$(./disk) $sym $(./internet) $sym $(./lamp) $sym $(./music) $sym" \
|
echo "$(./torrent) $sym $(./disk) $sym $(./internet) $sym $(./lamp) $sym $(./music) $sym" \
|
||||||
"$(./alsa) $sym $(./packages) $sym $(./date) $sym $(./clock)"
|
"$(./alsa) $sym $(./packages) $sym $(./date) $sym $(./clock)"
|
||||||
}
|
}
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
xsetroot -name " $(status | tr '\n' ' ')"
|
xsetroot -name " $(status | tr '\n' ' ')"
|
||||||
|
|
||||||
sleep 1m
|
sleep "$delay"
|
||||||
done
|
done
|
||||||
|
18
.local/bin/scripts/dwmbar/torrent
Executable file
18
.local/bin/scripts/dwmbar/torrent
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
data() { transmission-remote -l | grep %; }
|
||||||
|
[ ! "$(data)" ] && { echo N; exit 1; }
|
||||||
|
|
||||||
|
per="$(data | awk '{ print $2 }')"
|
||||||
|
[ "${per%?}" != 100 ] && echo "$per" || echo ""
|
||||||
|
|
||||||
|
data | \
|
||||||
|
sed "
|
||||||
|
s/.*Stopped.*//g;
|
||||||
|
s/.*Seeding.*//g;
|
||||||
|
s/.*Idle.*//g;
|
||||||
|
s/.*Uploading.*//g;
|
||||||
|
s/.*%.*//g
|
||||||
|
"
|
6
.local/bin/scripts/torradd
Executable file
6
.local/bin/scripts/torradd
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
pidof transmission-daemon >/dev/null || \
|
||||||
|
(transmission-daemon && notify-send "Starting transmission daemon...")
|
||||||
|
|
||||||
|
transmission-remote -a "$@" && notify-send " Torrent added."
|
Loading…
x
Reference in New Issue
Block a user