make polybar scripts more portable

This commit is contained in:
Cyryl Płotnicki 2020-04-17 23:21:06 +01:00
parent f5a39e348e
commit be01e129c5
2 changed files with 15 additions and 12 deletions

View file

@ -1,9 +1,11 @@
#!/bin/sh #!/usr/bin/env bash
profile="$HOME/.nix-profile/bin/" sensors=`which sensors`
system="/run/current-system/sw/bin/" egrep=`which egrep`
cut=`which cut`
sort=`which sort`
uniq=`which uniq`
tail=`which tail`
sensors="$profile/sensors" max_temp=`$sensors | $egrep -o '[0-9][0-9]\.[0-9].*\(' | $cut -d' ' -f 1 | $sort | $uniq | $tail -n 1`
max_temp=`$sensors | $system/egrep -o '[0-9][0-9]\.[0-9].*\(' | $system/cut -d' ' -f 1 | $system/sort | $system/uniq | $system/tail -n 1`
echo "${max_temp}" echo "${max_temp}"

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env bash
source $HOME/.open-secrets.sh source $HOME/.open-secrets.sh
@ -9,11 +9,12 @@ SYMBOL="°"
API="https://api.openweathermap.org/data/2.5" API="https://api.openweathermap.org/data/2.5"
CURL="/run/current-system/sw/bin/curl -sf" CURL=`which curl`
CUT="/run/current-system/sw/bin/cut" CURL="$CURL -sf"
DATE="/run/current-system/sw/bin/date" CUT=`which cut`
JQ="$HOME/.nix-profile/bin/jq" DATE=`which date`
UNAME="/run/current-system/sw/bin/uname" JQ=`which jq`
UNAME=`which uname`
get_icon() { get_icon() {
case $1 in case $1 in