Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

2.2 KB
Raw Blame
#!/usr/bin/env python3
"""Regenerates the Android launcher and notification icons from the desktop app's icon.svg,
so every platform shows the same dotted Codync face. Run from apps/android."""
import pathlib
import re

ROOT = pathlib.Path(__file__).resolve().parent.parent
svg = (ROOT / "../desktop/resources/icon.svg").read_text()
dots = [tuple(map(float, m)) for m in re.findall(r'cx="([\d.]+)" cy="([\d.]+)" r="([\d.]+)"', svg)]


def path(scale: float, dx: float) -> str:
    out = []
    for cx, cy, r in dots:
        x, y, rr = cx * scale + dx, cy * scale + dx, r * scale
        out.append(f"M{x - rr:.3f},{y:.3f}a{rr:.3f},{rr:.3f} 0 1,0 {2 * rr:.3f},0a{rr:.3f},{rr:.3f} 0 1,0 {-2 * rr:.3f},0")
    return "".join(out)


def vector(size: int, data: str, color: str) -> str:
    return ('<?xml version="1.0" encoding="utf-8"?>\n<!-- Generated by tools/launcher_icon.py from desktop/resources/icon.svg. -->\n'
            f'<vector xmlns:android="http://schemas.android.com/apk/res/android"\n'
            f'    android:width="{size}dp" android:height="{size}dp" android:viewportWidth="{size}" android:viewportHeight="{size}">\n'
            f'    <path android:fillColor="{color}" android:pathData="{data}"/>\n</vector>\n')


res = ROOT / "app/src/main/res"
# Adaptive icons draw on 108 dp and the mask shows the middle 72 dp; the face keeps its iOS proportion
# inside round masks too.
(res / "drawable/ic_launcher_foreground.xml").write_text(vector(108, path(64 / 256, 22), "#FFFFFFFF"))
# The status bar icon: the face alone, filling its 24 dp box.
(res / "drawable/ic_notification.xml").write_text(vector(24, path(24 / 196, -128 * 24 / 196 + 12), "#FFFFFFFF"))
(res / "mipmap-anydpi-v26").mkdir(exist_ok=True)
for name in ("ic_launcher", "ic_launcher_round"):
    (res / f"mipmap-anydpi-v26/{name}.xml").write_text(
        '<?xml version="1.0" encoding="utf-8"?>\n<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">\n'
        '    <background android:drawable="@color/ic_launcher_background"/>\n'
        '    <foreground android:drawable="@drawable/ic_launcher_foreground"/>\n'
        '    <monochrome android:drawable="@drawable/ic_launcher_foreground"/>\n</adaptive-icon>\n')
print(f"{len(dots)} dots")