hyprlock: disable fingerprint, add battery/weather/notifications
- Disable fingerprint auth (GDM holds the device; hyprlock can't claim it, blocking the auth thread). - Fix date format escaping (single quotes). - Add battery, weather, and latest mako notification labels. - Add hyprlock wrapper (crash guard), battery script, notifications script, and weather script.
This commit is contained in:
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# Print the current weather as a short icon+temp string, e.g. "🌦️ +83°F".
|
||||
# Caches the wttr.in response for CACHE_MAX_AGE seconds so the lock screen and
|
||||
# waybar don't hit the network on every refresh. Override the location with
|
||||
# WEATHER_CITY or edit CITY below.
|
||||
set -u
|
||||
|
||||
CITY="${WEATHER_CITY:-Denver}"
|
||||
CACHE_DIR="${XDG_RUNTIME_DIR:-/tmp}"
|
||||
CACHE="${CACHE_DIR}/wttr.cache"
|
||||
CACHE_MAX_AGE=1800 # 30 minutes
|
||||
URL="https://wttr.in/${CITY}?format=%c+%t"
|
||||
|
||||
cache_age() {
|
||||
[ -f "${CACHE}" ] || return 1
|
||||
now=$(date +%s)
|
||||
mtime=$(stat -c %Y "${CACHE}")
|
||||
[ "$(( now - mtime ))" -lt "${CACHE_MAX_AGE}" ]
|
||||
}
|
||||
|
||||
if cache_age; then
|
||||
cat "${CACHE}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TMP="${CACHE}.tmp.$$"
|
||||
if curl -fsS --max-time 10 "${URL}" > "${TMP}" 2>/dev/null; then
|
||||
mv "${TMP}" "${CACHE}"
|
||||
cat "${CACHE}"
|
||||
else
|
||||
rm -f "${TMP}" || true
|
||||
# Offline: fall back to whatever we cached last, even if stale.
|
||||
[ -f "${CACHE}" ] && cat "${CACHE}"
|
||||
fi
|
||||
Reference in New Issue
Block a user