summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ar/.config/shell/aliasrc3
-rwxr-xr-xar/.local/bin/statusbar/sb-clock11
2 files changed, 10 insertions, 4 deletions
diff --git a/ar/.config/shell/aliasrc b/ar/.config/shell/aliasrc
index 60db400..dbd0d69 100644
--- a/ar/.config/shell/aliasrc
+++ b/ar/.config/shell/aliasrc
@@ -469,6 +469,9 @@ alias w3m="w3m -config ${XDG_CONFIG_HOME:-${HOME}/.config}/w3m/config"
# xrandr
alias xauto='xrandr --auto'
+# xset
+alias xoff='xset s off -dpms'
+
# zathura
alias za='zathura'
diff --git a/ar/.local/bin/statusbar/sb-clock b/ar/.local/bin/statusbar/sb-clock
index e3ec9a4..25c6efb 100755
--- a/ar/.local/bin/statusbar/sb-clock
+++ b/ar/.local/bin/statusbar/sb-clock
@@ -43,12 +43,15 @@ else
fi
# Shows the current moon phase.
+LOCATION=$(curl -s http://ip-api.com/json | jq -r '[.regionName, .countryCode] | join(",")')
moonfile="${XDG_DATA_HOME:-${HOME}/.local/share}/wallpapers/moonphase"
-[ -s "$moonfile" ] && [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
- { curl -sf "wttr.in/?format=%m" >"$moonfile" || exit 1; }
+if [ ! -s "$moonfile" ] || [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ]; then
+ moon=$(curl -sf "wttr.in/$LOCATION?format=%m")
+ [ -n "$moon" ] && echo "$moon" >"$moonfile"
+fi
-moon="$(cat "$moonfile")"
+moonicon="$(cat "$moonfile")"
case $BLOCK_BUTTON in
1)
@@ -74,4 +77,4 @@ case $BLOCK_BUTTON in
esac
# Output the formatted date and time
-date "+${moon-$calendar}%a,%d $icon%H:%M"
+date "+${moonicon-$calendar}%a,%d $icon%H:%M"