diff options
Diffstat (limited to 'env/.config/i3blocks/bandwidth-wrapper.sh')
| -rwxr-xr-x | env/.config/i3blocks/bandwidth-wrapper.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/env/.config/i3blocks/bandwidth-wrapper.sh b/env/.config/i3blocks/bandwidth-wrapper.sh new file mode 100755 index 0000000..d78daa4 --- /dev/null +++ b/env/.config/i3blocks/bandwidth-wrapper.sh @@ -0,0 +1,14 @@ +#!/bin/bash +CACHE_FILE="/tmp/bandwidth.cache" + +# Primary bar updates the cache +if [ -n "$I3BLOCKS_PRIMARY" ]; then + ~/.config/i3blocks/bandwidth/bandwidth > "$CACHE_FILE" 2>/dev/null +fi + +# Both bars show from cache +if [ -f "$CACHE_FILE" ]; then + sleep 0.1 && cat "$CACHE_FILE" +else + echo "↓0 ↑0" +fi |
