From c5510367db582d1c0683f182dd0e151ea0ab3b5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Fri, 10 Jun 2022 14:14:22 +0200 Subject: Improvements for NixOS --- config/i3blocks/scripts/allsync | 9 ++++++--- config/i3blocks/scripts/bandwidth | 2 +- config/i3blocks/scripts/email | 2 +- config/i3blocks/scripts/gpu | 4 +--- config/i3blocks/scripts/iface | 2 +- config/i3blocks/scripts/mpd | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) (limited to 'config/i3blocks/scripts') 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)" -- cgit v1.2.3