aboutsummaryrefslogtreecommitdiff
path: root/config/i3blocks/scripts
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-06-10 14:14:22 +0200
committerKarel Kočí <cynerd@email.cz>2022-06-10 14:14:22 +0200
commitc5510367db582d1c0683f182dd0e151ea0ab3b5f (patch)
treee43d7d6a4eae8d586ac8b43ef436ae178465bcfe /config/i3blocks/scripts
parent3c905d717a331b9be6d7036624378d0617234a82 (diff)
downloadmyconfigs-c5510367db582d1c0683f182dd0e151ea0ab3b5f.tar.gz
myconfigs-c5510367db582d1c0683f182dd0e151ea0ab3b5f.tar.bz2
myconfigs-c5510367db582d1c0683f182dd0e151ea0ab3b5f.zip
Improvements for NixOS
Diffstat (limited to 'config/i3blocks/scripts')
-rwxr-xr-xconfig/i3blocks/scripts/allsync9
-rwxr-xr-xconfig/i3blocks/scripts/bandwidth2
-rwxr-xr-xconfig/i3blocks/scripts/email2
-rwxr-xr-xconfig/i3blocks/scripts/gpu4
-rwxr-xr-xconfig/i3blocks/scripts/iface2
-rwxr-xr-xconfig/i3blocks/scripts/mpd2
6 files changed, 11 insertions, 10 deletions
diff --git a/config/i3blocks/scripts/allsync b/config/i3blocks/scripts/allsync
index 211799d..472954f 100755
--- a/config/i3blocks/scripts/allsync
+++ b/config/i3blocks/scripts/allsync
@@ -1,6 +1,9 @@
-#!/bin/bash
-if allsync enabled; then
+#!/usr/bin/env bash
+if allsync enabled 2>/dev/null; then
echo "sync"
+else
echo
- echo "#ffff00"
fi
+
+echo
+echo "#ffff00"
diff --git a/config/i3blocks/scripts/bandwidth b/config/i3blocks/scripts/bandwidth
index 9b92274..d45f127 100755
--- a/config/i3blocks/scripts/bandwidth
+++ b/config/i3blocks/scripts/bandwidth
@@ -38,7 +38,7 @@ if [[ -z $INTERFACE ]] && [[ -n $BLOCK_INSTANCE ]]; then
INTERFACE=$BLOCK_INSTANCE
elif [[ -z $INTERFACE ]]; then
for version in 4 6; do
- INTERFACE=$(ip -$version r | sed -n 's/^default.*dev \([^ ]*\).*/\1/p')
+ INTERFACE=$(ip -$version r | sed -n 's/^default.*dev \([^ ]*\).*/\1/p' | head -1)
[ -z "$INTERFACE" ] || break
done
fi
diff --git a/config/i3blocks/scripts/email b/config/i3blocks/scripts/email
index d2213e0..01cb5af 100755
--- a/config/i3blocks/scripts/email
+++ b/config/i3blocks/scripts/email
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
filter=("tag:unread" "and" "not" "tag:killed")
part=()
diff --git a/config/i3blocks/scripts/gpu b/config/i3blocks/scripts/gpu
index 5153dba..cc257c1 100755
--- a/config/i3blocks/scripts/gpu
+++ b/config/i3blocks/scripts/gpu
@@ -1,4 +1,2 @@
-#!/bin/bash
+#!/usr/bin/env bash
echo "$(cat /sys/class/drm/card0/device/gpu_busy_percent)%"
-echo
-echo
diff --git a/config/i3blocks/scripts/iface b/config/i3blocks/scripts/iface
index ffa576e..5daffa6 100755
--- a/config/i3blocks/scripts/iface
+++ b/config/i3blocks/scripts/iface
@@ -20,7 +20,7 @@
# Use the provided interface, otherwise the device used for the default route.
IF="${IFACE:-$BLOCK_INSTANCE}"
for version in 4 6; do
- IF="${IF:-$(ip -$version route | sed -n 's/^default.*dev \([^ ]*\).*/\1/p')}"
+ IF="${IF:-$(ip -$version route | sed -n 's/^default.*dev \([^ ]*\).*/\1/p' | head -1)}"
done
# Exit if there is no default route
diff --git a/config/i3blocks/scripts/mpd b/config/i3blocks/scripts/mpd
index 0f3764d..d179511 100755
--- a/config/i3blocks/scripts/mpd
+++ b/config/i3blocks/scripts/mpd
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
status="$(mpc -f "♫ %artist%, %album%, %title%" status)"