app: let the settings hide limit windows and give the app an icon (#18)

The developer asked for an option to hide Claude's Fable week and for an
app icon that Windows can use (2026-11-04).

- Core: each provider's settings hold hidden limit windows by window
  series, so a hidden Codex week stays hidden across slot moves (D7, D8).
  Older settings files load with nothing hidden. Hidden windows give no
  pace popups.
- App: Settings → Providers lists each provider's limit windows with a
  Show checkbox, including hidden windows that are absent right now. The
  panel drops hidden windows in one place before it renders and queries
  history; the snapshot and history keep every window (D9).
- App: a usage gauge in the provider colours is the executable's icon,
  the window icon and the tray icon. tools/icon/make_icon.py renders it
  with Pillow, a development-only dependency, into a multi-size ICO and a
  PNG.

Closes #17
This commit was merged in pull request #18.
This commit is contained in:
2026-11-04 19:41:44 +01:00
parent 82fece85f5
commit c02829e2e1
17 changed files with 384 additions and 19 deletions
+67
View File
@@ -0,0 +1,67 @@
#!/usr/bin/env python3
"""D8: render the shared usage gauge. Requires development-only Pillow 11.3.0."""
import argparse
from pathlib import Path
from PIL import Image, ImageDraw
SIZES = (16, 20, 24, 32, 40, 48, 64, 128, 256)
ASSETS = Path(__file__).resolve().parents[2] / 'src' / 'FinalToken.App' / 'Assets'
def render(size):
scale = size * 8
image = Image.new('RGBA', (scale, scale))
draw = ImageDraw.Draw(image)
def box(a, b, c, d):
return tuple(round(n * scale) for n in (a, b, c, d))
draw.rounded_rectangle(box(.025, .025, .975, .975), radius=round(.20 * scale),
fill='#1a1a19', outline='#52514e', width=round(.025 * scale))
gauge = box(.17, .17, .83, .83)
width = round(.115 * scale)
draw.arc(gauge, 135, 405, fill='#383835', width=width)
draw.arc(gauge, 135, 265, fill='#d95926', width=width)
draw.arc(gauge, 267, 353, fill='#3987e5', width=width)
# One chunky pointer survives the 16 px downsample; there are no small-size hairlines.
draw.line(box(.50, .53, .64, .37), fill='#f0efec', width=round(.075 * scale))
draw.ellipse(box(.445, .475, .555, .585), fill='#f0efec')
return image.resize((size, size), Image.Resampling.LANCZOS)
def write_assets(output):
output.mkdir(parents=True, exist_ok=True)
images = [render(size) for size in SIZES]
images[-1].save(output / 'FinalToken.ico', sizes=[(s, s) for s in SIZES], append_images=images[:-1])
images[-1].save(output / 'FinalToken.png')
def contact_sheet(path):
sizes = (16, 24, 32, 48, 256)
sheet = Image.new('RGB', (512, 640))
draw = ImageDraw.Draw(sheet)
for column, background in enumerate(('#f9f9f7', '#0d0d0d')):
left = column * 256
draw.rectangle((left, 0, left + 255, 639), fill=background)
y = 24
for size in sizes:
icon = render(size)
sheet.paste(icon, (left + (256 - size) // 2, y), icon)
y += size + 32
path.parent.mkdir(parents=True, exist_ok=True)
sheet.save(path)
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--out', type=Path, default=ASSETS)
parser.add_argument('--contact-sheet', type=Path)
args = parser.parse_args()
write_assets(args.out)
if args.contact_sheet:
contact_sheet(args.contact_sheet)
if __name__ == '__main__':
main()
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
"""Check all ICO frames and reproducible committed icon assets."""
from pathlib import Path
import subprocess
import sys
import tempfile
import unittest
from PIL import Image
from make_icon import ASSETS, SIZES, render
class IconTests(unittest.TestCase):
def test_ico_contains_every_size_and_its_rendered_pixels(self):
with Image.open(ASSETS / 'FinalToken.ico') as icon:
self.assertEqual({(s, s) for s in SIZES}, icon.ico.sizes())
for size in SIZES:
frame = icon.ico.getimage((size, size))
self.assertEqual(render(size).tobytes(), frame.tobytes())
def test_fresh_run_reproduces_committed_files_byte_for_byte(self):
with tempfile.TemporaryDirectory() as temporary:
subprocess.run([sys.executable, '-B', str(Path(__file__).with_name('make_icon.py')),
'--out', temporary], check=True)
for name in ('FinalToken.ico', 'FinalToken.png'):
self.assertEqual((ASSETS / name).read_bytes(), (Path(temporary) / name).read_bytes(), name)
if __name__ == '__main__':
unittest.main()