summaryrefslogtreecommitdiff
path: root/icon
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2026-03-06 09:47:26 +0100
committerxengineering <me@xengineering.eu>2026-03-06 11:34:56 +0100
commit5cff678780f2da003c529e6c9f918096bd90babf (patch)
tree1e94ae91849020df495efff6e7edcf64de9f7a0c /icon
parentb36edd08e69c07e22809c620dfd0706106b47f93 (diff)
downloadsia-app-5cff678780f2da003c529e6c9f918096bd90babf.tar
sia-app-5cff678780f2da003c529e6c9f918096bd90babf.tar.zst
sia-app-5cff678780f2da003c529e6c9f918096bd90babf.zip
icon: Add Linux icon generation
Since SVG files are optionally in Linux PNG files in multiple resolutions are a good fallback to support Linux. Thus in addition to icon/main.svg a Linux packager might use these generated PNG files.
Diffstat (limited to 'icon')
-rwxr-xr-xicon/convert.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/icon/convert.py b/icon/convert.py
index b550709..37fbba9 100755
--- a/icon/convert.py
+++ b/icon/convert.py
@@ -5,6 +5,7 @@ import argparse
import dataclasses
import os
import pathlib
+import shutil
import subprocess
import sys
@@ -13,6 +14,7 @@ SCRIPT = pathlib.Path(__file__).resolve()
ICON = SCRIPT.parent
MAIN = ICON / "main.svg"
ANDROID = ICON / "android"
+LINUX = ICON / "linux"
def main() -> None:
@@ -23,6 +25,16 @@ def main() -> None:
inkscape(MAIN, ANDROID / "foreground.png", ids=("foreground",))
inkscape(MAIN, ANDROID / "background.png", ids=("background",))
+ os.makedirs(LINUX, exist_ok=True)
+ shutil.copyfile(MAIN, LINUX / "scalable.svg")
+ inkscape(MAIN, LINUX / "16.png", size=16)
+ inkscape(MAIN, LINUX / "32.png", size=32)
+ inkscape(MAIN, LINUX / "48.png", size=48)
+ inkscape(MAIN, LINUX / "64.png", size=64)
+ inkscape(MAIN, LINUX / "128.png", size=128)
+ inkscape(MAIN, LINUX / "256.png", size=256)
+ inkscape(MAIN, LINUX / "512.png", size=512)
+
@dataclasses.dataclass(frozen=True, kw_only=True)
class Arguments:
@@ -40,8 +52,7 @@ def inkscape(
source: pathlib.Path,
sink: pathlib.Path,
ids: tuple[str, ...] = ("foreground", "background"),
- width: int = 1024,
- height: int = 1024,
+ size: int = 1024,
) -> None:
subprocess.run(
(
@@ -50,8 +61,8 @@ def inkscape(
"--export-filename", str(sink),
"--export-area-page",
"--export-id", ";".join(ids),
- "--export-width", str(width),
- "--export-height", str(height),
+ "--export-width", str(size),
+ "--export-height", str(size),
"--export-id-only",
# fmt: on
),