commit ba4f5feeaf8d9b45540577d5878fd8f38865a3a4 parent 8234c4a8ec63225831ab5545be5f24bd2d90c4d7 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Thu, 13 Jun 2019 13:11:42 +0200 Simplify refresh script Diffstat:
M | .local/bin/dwmstatus-refresh | | | 11 | +++-------- |
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/.local/bin/dwmstatus-refresh b/.local/bin/dwmstatus-refresh @@ -1,10 +1,5 @@ #!/bin/sh +# Modified from lukesmithxyz/voidrice -# Originally from lukesmithxyz/voidrice - -pid="$(pstree -lp | grep -- '-dwmstatus([0-9]' |\ - sed "s/.*sleep(\([0-9]\+\)).*/\1/")" - -if echo "$pid" | grep -E -q '^[0-9]+$'; then - kill "$pid" -fi +pid="$(pstree -lp | sed -n 's/.*-dwmstatus(.*-sleep(\([0-9]\+\))/\1/p')" +[ -n "$pid" ] && kill "$pid"