From b810758e6a418db3eb6c5d1ab504273f01b7b00d Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Fri, 18 Mar 2022 10:17:09 -0600 Subject: Minor fixes to weather and bluetooth scripts. --- extras/HOME/.xmonad/xmobar-bluetooth | 24 +++++++++++-------- extras/HOME/.xmonad/xmobar-weather | 46 ++++++++++++++++++------------------ 2 files changed, 37 insertions(+), 33 deletions(-) diff --git a/extras/HOME/.xmonad/xmobar-bluetooth b/extras/HOME/.xmonad/xmobar-bluetooth index 9b4f5cc..16a6d70 100755 --- a/extras/HOME/.xmonad/xmobar-bluetooth +++ b/extras/HOME/.xmonad/xmobar-bluetooth @@ -2,17 +2,21 @@ cur="" -bluetoothctl -- info | while read line ; do - key=${line%%: *} - value=${line//*: } +if [ -d /sys/class/bluetooth ] ; then - if [ "$key" == "Name" ] ; then - cur="$value" - fi + bluetoothctl -- info | while read line ; do + key=${line%%: *} + value=${line//*: } - if [ "$key" == "Connected" -a "$value" == "yes" ] ; then - exec echo "$cur │ " - fi -done + if [ "$key" == "Name" ] ; then + cur="$value" + fi + + if [ "$key" == "Connected" -a "$value" == "yes" ] ; then + exec echo "$cur │ " + fi + done + +fi exec echo "│ " diff --git a/extras/HOME/.xmonad/xmobar-weather b/extras/HOME/.xmonad/xmobar-weather index 6b5c409..0fee524 100755 --- a/extras/HOME/.xmonad/xmobar-weather +++ b/extras/HOME/.xmonad/xmobar-weather @@ -69,30 +69,30 @@ if ($current_str gt $sunrise_str and $current_str lt $sunset_str) { $dir=%directions{$wind_direction}; %conditions_day = ( - clear => "", - sunny => "", - mostly_clear => "", - mostly_sunny => "", - partly_sunny => "", - fair => "🌑", - cloudy =>"摒", - overcast =>"", - partly_cloudy => "杖", - mostly_cloudy => "", - considerable_cloudiness => "ﭽ" ); + clear => "", + sunny => "", + mostly_clear => "", + mostly_sunny => "", + partly_sunny => "", + fair => "🌑", + cloudy =>"摒", + overcast =>"", + partly_cloudy => "杖", + mostly_cloudy => "", + considerable_cloudiness => "ﭽ" ); %conditions_night = ( - clear => "", - sunny => "", - mostly_clear => "", - mostly_sunny => "", - partly_sunny => "", - fair => "🌑", - cloudy =>"摒", - overcast =>"", - partly_cloudy => "", - mostly_cloudy => "", - considerable_cloudiness => "ﭽ" ); + clear => "", + sunny => "", + mostly_clear => "", + mostly_sunny => "", + partly_sunny => "", + fair => "🌑", + cloudy =>"摒", + overcast =>"", + partly_cloudy => "", + mostly_cloudy => "", + considerable_cloudiness => "ﭽ" ); if ($is_day) { $conditions = %conditions_day{$sky_conditions}; @@ -100,4 +100,4 @@ if ($is_day) { $conditions = %conditions_night{$sky_conditions}; } -printf("$city $dir ${wind_speed} $conditions %.0f°F\n", $temp); +printf("$city $dir ${wind_speed} $conditions %.0f°F\n", $temp); -- cgit