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/config | 11 ++--------- 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 +- 7 files changed, 13 insertions(+), 19 deletions(-) (limited to 'config/i3blocks') diff --git a/config/i3blocks/config b/config/i3blocks/config index 6b8acc8..d60834a 100644 --- a/config/i3blocks/config +++ b/config/i3blocks/config @@ -1,16 +1,14 @@ # i3blocks config file -command=/usr/libexec/i3blocks/$BLOCK_NAME +command=~/.config/i3blocks/scripts/$BLOCK_NAME separator_block_width=10 markup=none [mpd] -command=~/.config/i3blocks/scripts/mpd interval=5 signal=12 -[volume] +[volume-pipewire] label=♪ -instance=Master interval=once signal=10 @@ -23,7 +21,6 @@ interval=10 [gpu] label=gpu: -command=~/.config/i3blocks/scripts/gpu interval=1 [disk] @@ -37,12 +34,10 @@ instance=/home2 interval=30 [iface] -command=~/.config/i3blocks/scripts/iface interval=2 separator=false [bandwidth] -command=~/.config/i3blocks/scripts/bandwidth interval=2 [ssid] @@ -62,12 +57,10 @@ markup=pango interval=30 [allsync] -command=~/.config/i3blocks/scripts/allsync interval=120 signal=13 [email] -command=~/.config/i3blocks/scripts/email interval=30 signal=13 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