From 3ed3f6ff1c202f8499a811a30bbe808eec4b9fd4 Mon Sep 17 00:00:00 2001 From: Wiktor Zykubek Date: Fri, 15 May 2020 10:34:46 +0200 Subject: [PATCH] Edit 'torrent' module for better multi-torrent displaying --- .local/bin/scripts/dwmbar/torrent | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.local/bin/scripts/dwmbar/torrent b/.local/bin/scripts/dwmbar/torrent index 90a597b..ad0c710 100755 --- a/.local/bin/scripts/dwmbar/torrent +++ b/.local/bin/scripts/dwmbar/torrent @@ -1,18 +1,20 @@ #!/bin/sh echo "" - data() { transmission-remote -l | grep %; } -[ ! "$(data)" ] && { echo N; exit 1; } +[ ! "$(data)" ] && { echo ""; exit 1; } per="$(data | awk '{ print $2 }')" -[ "${per%?}" != 100 ] && echo "$per" || echo "" -data | \ - sed " +icon="$(data | sed " s/.*Stopped.*//g; s/.*Seeding.*//g; s/.*Idle.*//g; s/.*Uploading.*//g; s/.*%.*//g - " +")" + +for i in $(seq "$(data | wc -l)"); do + echo "$per" | awk -v n="$i" 'NR==n' | sed 's/100%//g' + echo "$icon" | awk -v n="$i" 'NR==n' +done