From be01e129c5ff1ea1328c45a6a1e916fdb5c9d222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Fri, 17 Apr 2020 23:21:06 +0100 Subject: [PATCH] make polybar scripts more portable --- nixos/i3/polybar/cpu-temp.sh | 14 ++++++++------ nixos/i3/polybar/openweathermap-fullfeatured.sh | 13 +++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/nixos/i3/polybar/cpu-temp.sh b/nixos/i3/polybar/cpu-temp.sh index f2243d16..83815e86 100755 --- a/nixos/i3/polybar/cpu-temp.sh +++ b/nixos/i3/polybar/cpu-temp.sh @@ -1,9 +1,11 @@ -#!/bin/sh -profile="$HOME/.nix-profile/bin/" -system="/run/current-system/sw/bin/" +#!/usr/bin/env bash +sensors=`which sensors` +egrep=`which egrep` +cut=`which cut` +sort=`which sort` +uniq=`which uniq` +tail=`which tail` -sensors="$profile/sensors" - -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` +max_temp=`$sensors | $egrep -o '[0-9][0-9]\.[0-9].*\(' | $cut -d' ' -f 1 | $sort | $uniq | $tail -n 1` echo "${max_temp}" diff --git a/nixos/i3/polybar/openweathermap-fullfeatured.sh b/nixos/i3/polybar/openweathermap-fullfeatured.sh index dac619c0..f6e56e47 100755 --- a/nixos/i3/polybar/openweathermap-fullfeatured.sh +++ b/nixos/i3/polybar/openweathermap-fullfeatured.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash source $HOME/.open-secrets.sh @@ -9,11 +9,12 @@ SYMBOL="°" API="https://api.openweathermap.org/data/2.5" -CURL="/run/current-system/sw/bin/curl -sf" -CUT="/run/current-system/sw/bin/cut" -DATE="/run/current-system/sw/bin/date" -JQ="$HOME/.nix-profile/bin/jq" -UNAME="/run/current-system/sw/bin/uname" +CURL=`which curl` +CURL="$CURL -sf" +CUT=`which cut` +DATE=`which date` +JQ=`which jq` +UNAME=`which uname` get_icon() { case $1 in