From 04a2c83eb89ff44ab96e674b597e9601b9bd6c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Fri, 31 Dec 2021 19:43:01 +0100 Subject: [PATCH] feat: moon age instead of moon percentage --- lib/i3status-rust.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/i3status-rust.nix b/lib/i3status-rust.nix index 71c4d87..ea8ec4a 100644 --- a/lib/i3status-rust.nix +++ b/lib/i3status-rust.nix @@ -105,7 +105,6 @@ in { import astral import astral.moon import astral.sun - import math moon_phases = { 0: "🌑", @@ -121,12 +120,10 @@ in { current_phase = astral.moon.phase() closest_phase = min(moon_phases.keys(), key=lambda x: abs(current_phase - x)) - moon_percentage = round(100 * math.sin(current_phase / 28 * math.pi), 1) - city = astral.LocationInfo("Berlin", "Germany", "${spacetime.time.timeZone}", ${toString spacetime.location.latitude}, ${toString spacetime.location.longitude}) sun = astral.sun.sun(city.observer, date=astral.today(), tzinfo=city.timezone) - print("🌅 {} 🌇 {} {} {}%".format(sun["sunrise"].strftime("%R"), sun["sunset"].strftime("%R"), moon_phases[closest_phase], moon_percentage)) + print("🌅 {} 🌇 {} {} {}".format(sun["sunrise"].strftime("%R"), sun["sunset"].strftime("%R"), moon_phases[closest_phase], round(current_phase, 1))) ''; } {