summaryrefslogtreecommitdiff
path: root/arch/eww
diff options
context:
space:
mode:
authorsteven-na <noreply.github@stvnc.dev>2026-05-01 03:42:24 -0700
committersteven-na <noreply.github@stvnc.dev>2026-05-01 03:42:24 -0700
commit3e4d5813f5e7122d400ec1afa154535ebc441fae (patch)
treeda21e4d1d23bebf1dbda6255eba328b8842bddcf /arch/eww
parent2ef9b580fc0cbdbff93ae01caecf586df4d35894 (diff)
fix weather/nvim, copy script start
Diffstat (limited to 'arch/eww')
-rwxr-xr-xarch/eww/.config/eww/scripts/day-with-suffix6
-rwxr-xr-xarch/eww/.config/eww/scripts/weather-fetch11
-rwxr-xr-xarch/eww/.config/eww/scripts/weather-notify11
3 files changed, 18 insertions, 10 deletions
diff --git a/arch/eww/.config/eww/scripts/day-with-suffix b/arch/eww/.config/eww/scripts/day-with-suffix
index f7c2243..111bd37 100755
--- a/arch/eww/.config/eww/scripts/day-with-suffix
+++ b/arch/eww/.config/eww/scripts/day-with-suffix
@@ -1,10 +1,10 @@
-#!/bin/sh
+#!/usr/bin/env bash
DaySuffix() {
- case `date +%d` in
+ case `date +%-d` in
1|21|31) echo "st";;
2|22) echo "nd";;
3|23) echo "rd";;
*) echo "th";;
esac
}
-echo $(date +%d)`DaySuffix`
+echo $(date +%-d)`DaySuffix`
diff --git a/arch/eww/.config/eww/scripts/weather-fetch b/arch/eww/.config/eww/scripts/weather-fetch
index 8fa53ac..9191edd 100755
--- a/arch/eww/.config/eww/scripts/weather-fetch
+++ b/arch/eww/.config/eww/scripts/weather-fetch
@@ -12,12 +12,15 @@ temp=$(echo "$data" | jq -r '.current_condition[0].temp_F')
code=$(echo "$data" | jq -r '.current_condition[0].weatherCode')
# ── Night check ────────────────────────────────────────────────────────────
-sunset_raw=$(echo "$data" | jq -r '.weather[0].astronomy[0].sunset')
-sunset_epoch=$(date -d "today $sunset_raw" +%s 2>/dev/null)
+sunrise_raw=$(echo "$data" | jq -r '.weather[0].astronomy[0].sunrise')
+sunset_raw=$(echo "$data" | jq -r '.weather[0].astronomy[0].sunset')
+
+sunrise_epoch=$(date -d "today $sunrise_raw" +%s)
+sunset_epoch=$(date -d "today $sunset_raw" +%s)
now_epoch=$(date +%s)
-is_night=false
-[[ $now_epoch -ge $sunset_epoch ]] && is_night=true
+is_night=false
+[[ $now_epoch -ge $sunset_epoch || $now_epoch -lt $sunrise_epoch ]] && is_night=true
# ── Moon phase ─────────────────────────────────────────────────────────────
moon_icon() {
local ref; ref=$(date -d "2000-01-06" +%s) # known new moon
diff --git a/arch/eww/.config/eww/scripts/weather-notify b/arch/eww/.config/eww/scripts/weather-notify
index fc95df0..9710ad4 100755
--- a/arch/eww/.config/eww/scripts/weather-notify
+++ b/arch/eww/.config/eww/scripts/weather-notify
@@ -15,10 +15,15 @@ high=$(echo "$data" | jq -r '.weather[0].maxtempF')
low=$(echo "$data" | jq -r '.weather[0].mintempF')
# ── Night / moon ───────────────────────────────────────────────────────────
-sunset_raw=$(echo "$data" | jq -r '.weather[0].astronomy[0].sunset')
-sunset_epoch=$(date -d "today $sunset_raw" +%s 2>/dev/null)
+sunrise_raw=$(echo "$data" | jq -r '.weather[0].astronomy[0].sunrise')
+sunset_raw=$(echo "$data" | jq -r '.weather[0].astronomy[0].sunset')
+
+sunrise_epoch=$(date -d "today $sunrise_raw" +%s)
+sunset_epoch=$(date -d "today $sunset_raw" +%s)
+now_epoch=$(date +%s)
+
is_night=false
-[[ $(date +%s) -ge $sunset_epoch ]] && is_night=true
+[[ $now_epoch -ge $sunset_epoch || $now_epoch -lt $sunrise_epoch ]] && is_night=true
moon_phase() {
local ref; ref=$(date -d "2000-01-06" +%s)