Turn the lock screen into an unfolding glass dashboard
At rest the lock screen shows the date, glass clock and Now Playing. Typing or clicking opens a glass card with avatar, name, status and password, then wings unfold: weather (with the next forecasts) and system usage on the left, notifications and media with Cava on the right, reusing the desktop widget faces. Adds a Caps Lock warning, power controls behind a corner button, and Dashboard and Notification previews settings. The screenshot backdrop is now always fully blurred and dimmed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4fa0c2c042
commit
b96b0cb683
12 files changed
+1114
-330
No files matched your search
@@ -1,6 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Current weather from wttr.in as compact JSON: {ok, place, temperature, feels, code, description}."""
|
||||
import json, sys, urllib.parse, urllib.request
|
||||
"""Current weather from wttr.in as compact JSON: {ok, place, celsius, feelsCelsius, code, description, humidity, wind, hourly}."""
|
||||
import datetime, json, sys, urllib.parse, urllib.request
|
||||
|
||||
def upcoming(data, now, count=4):
|
||||
"""The next `count` three-hourly forecasts: [{hour, celsius, code}]. wttr.in
|
||||
usually omits the local observation time, so this machine's clock stands in."""
|
||||
try:
|
||||
observed = datetime.datetime.strptime(now['localObsDateTime'], '%Y-%m-%d %I:%M %p')
|
||||
except (KeyError, ValueError):
|
||||
observed = datetime.datetime.now()
|
||||
slots = []
|
||||
for day in data.get('weather') or []:
|
||||
for slot in day.get('hourly') or []:
|
||||
try:
|
||||
at = datetime.datetime.strptime(day['date'], '%Y-%m-%d') + datetime.timedelta(hours=int(slot['time']) // 100)
|
||||
if at > observed:
|
||||
slots.append(dict(hour=at.hour, celsius=float(slot['tempC']), code=int(slot['weatherCode'])))
|
||||
except (KeyError, ValueError):
|
||||
continue
|
||||
return slots[:count]
|
||||
|
||||
def main():
|
||||
location = sys.argv[1] if len(sys.argv) > 1 else ''
|
||||
@@ -13,7 +31,7 @@ def main():
|
||||
place = (area.get('areaName') or [{'value': ''}])[0]['value']
|
||||
print(json.dumps(dict(ok=True, place=place or location, celsius=float(now['temp_C']), feelsCelsius=float(now['FeelsLikeC']),
|
||||
code=int(now['weatherCode']), description=now['weatherDesc'][0]['value'].strip(),
|
||||
humidity=int(now['humidity']), wind=float(now['windspeedKmph']))))
|
||||
humidity=int(now['humidity']), wind=float(now['windspeedKmph']), hourly=upcoming(data, now))))
|
||||
except Exception as error: # Network, HTTP and format errors all surface as a message.
|
||||
print(json.dumps(dict(ok=False, error=str(error))))
|
||||
|
||||
|
||||
Reference in new issue
Block a user