Use icon.svg for app icon #451

Closed
opened 2026-06-05 19:50:12 +00:00 by guettli · 2 comments
guettli commented 2026-06-05 19:50:12 +00:00 (Migrated from codeberg.org)

Use icon.svg as App icon.

Up to now I see the default flutter icon.

Use icon.svg as App icon. Up to now I see the default flutter icon.
guettlibot commented 2026-06-05 20:00:36 +00:00 (Migrated from codeberg.org)

Now I have all the context I need. Here's the implementation plan:


Implementation Plan: Use icon.svg as App Icon

Context

icon.svg already exists at the project root (512×512, concentric rainbow rings on white). The Android mipmap directories (android/app/src/main/res/mipmap-*/ic_launcher.png) still contain the default Flutter blue logo. The Linux GTK runner (linux/my_application.cc) never sets a window icon. There is no flutter_launcher_icons setup yet.

rsvg-convert is not currently in the Nix dev shell; librsvg needs to be added to flake.nix.


Step 1 — Add librsvg to flake.nix

Add librsvg to the buildInputs list in devShells.default so that rsvg-convert is available inside nix develop. This is the only change to flake.nix.


Step 2 — Add flutter_launcher_icons to pubspec.yaml

Add to dev_dependencies:

flutter_launcher_icons: ^0.13.2

Add a top-level flutter_icons config block:

flutter_icons:
  android: "ic_launcher"
  ios: false
  image_path: "icon.png"        # generated from icon.svg by generate-icons task
  linux:
    generate: true
    image_path: "icon.png"

ios: false because there is no iOS runner in this repo.


Step 3 — Add generate-icons task to Taskfile.yml

generate-icons:
  desc: Rasterise icon.svg → icon.png and regenerate all platform launcher icons
  deps: [_pub-get]
  cmds:
    - rsvg-convert -w 1024 -h 1024 icon.svg -o icon.png
    - fvm flutter pub run flutter_launcher_icons

icon.png (the 1024×1024 intermediate) is committed alongside the repo so the generated mipmap PNGs and the source PNG are both tracked. icon.svg remains the canonical editable source.

Also update playstore/icon.png:

    - rsvg-convert -w 512 -h 512 icon.svg -o playstore/icon.png

Step 4 — Set the Linux window/taskbar icon in linux/my_application.cc

flutter_launcher_icons places the icon at linux/<appname>.png and registers it in linux/CMakeLists.txt, but it does not wire up the GTK window icon in C++ code. After the call to gtk_widget_show_all, add:

gtk_window_set_icon_from_file(window, "sharedinbox.png", NULL);

flutter_launcher_icons already updates CMakeLists.txt to install linux/sharedinbox.png next to the binary, so the relative path "sharedinbox.png" is valid at runtime.


Step 5 — Run the task and commit generated files

Run task generate-icons inside nix develop and commit:

  • icon.png (source raster, 1024×1024)
  • playstore/icon.png (updated)
  • All android/app/src/main/res/mipmap-*/ic_launcher.png (overwritten by flutter_launcher_icons)
  • linux/sharedinbox.png (generated by flutter_launcher_icons)
  • Updated linux/CMakeLists.txt (flutter_launcher_icons adds an install rule)
  • pubspec.yaml, pubspec.lock, flake.nix, Taskfile.yml, linux/my_application.cc

No dart run build_runner is needed — this is not a Drift schema change.

Now I have all the context I need. Here's the implementation plan: --- ## Implementation Plan: Use icon.svg as App Icon ### Context `icon.svg` already exists at the project root (512×512, concentric rainbow rings on white). The Android mipmap directories (`android/app/src/main/res/mipmap-*/ic_launcher.png`) still contain the default Flutter blue logo. The Linux GTK runner (`linux/my_application.cc`) never sets a window icon. There is no `flutter_launcher_icons` setup yet. `rsvg-convert` is not currently in the Nix dev shell; `librsvg` needs to be added to `flake.nix`. --- ### Step 1 — Add `librsvg` to `flake.nix` Add `librsvg` to the `buildInputs` list in `devShells.default` so that `rsvg-convert` is available inside `nix develop`. This is the only change to `flake.nix`. --- ### Step 2 — Add `flutter_launcher_icons` to `pubspec.yaml` Add to `dev_dependencies`: ```yaml flutter_launcher_icons: ^0.13.2 ``` Add a top-level `flutter_icons` config block: ```yaml flutter_icons: android: "ic_launcher" ios: false image_path: "icon.png" # generated from icon.svg by generate-icons task linux: generate: true image_path: "icon.png" ``` `ios: false` because there is no iOS runner in this repo. --- ### Step 3 — Add `generate-icons` task to `Taskfile.yml` ```yaml generate-icons: desc: Rasterise icon.svg → icon.png and regenerate all platform launcher icons deps: [_pub-get] cmds: - rsvg-convert -w 1024 -h 1024 icon.svg -o icon.png - fvm flutter pub run flutter_launcher_icons ``` `icon.png` (the 1024×1024 intermediate) is committed alongside the repo so the generated mipmap PNGs and the source PNG are both tracked. `icon.svg` remains the canonical editable source. Also update `playstore/icon.png`: ```yaml - rsvg-convert -w 512 -h 512 icon.svg -o playstore/icon.png ``` --- ### Step 4 — Set the Linux window/taskbar icon in `linux/my_application.cc` `flutter_launcher_icons` places the icon at `linux/<appname>.png` and registers it in `linux/CMakeLists.txt`, but it does **not** wire up the GTK window icon in C++ code. After the call to `gtk_widget_show_all`, add: ```c gtk_window_set_icon_from_file(window, "sharedinbox.png", NULL); ``` `flutter_launcher_icons` already updates `CMakeLists.txt` to install `linux/sharedinbox.png` next to the binary, so the relative path `"sharedinbox.png"` is valid at runtime. --- ### Step 5 — Run the task and commit generated files Run `task generate-icons` inside `nix develop` and commit: - `icon.png` (source raster, 1024×1024) - `playstore/icon.png` (updated) - All `android/app/src/main/res/mipmap-*/ic_launcher.png` (overwritten by flutter_launcher_icons) - `linux/sharedinbox.png` (generated by flutter_launcher_icons) - Updated `linux/CMakeLists.txt` (flutter_launcher_icons adds an install rule) - `pubspec.yaml`, `pubspec.lock`, `flake.nix`, `Taskfile.yml`, `linux/my_application.cc` No `dart run build_runner` is needed — this is not a Drift schema change.
guettlibot commented 2026-06-05 21:40:02 +00:00 (Migrated from codeberg.org)

The implementation is done. Here's a summary of what was done:


Summary

Implemented icon.svg as the app icon across Android and Linux. PR: https://codeberg.org/guettli/sharedinbox/pulls/459

What changed

Android — regenerated all five mipmap launcher icons (mdpi 48px → xxxhdpi 192px) from icon.svg using Inkscape. The rainbow-rings design now replaces the default Flutter logo.

Linux — added linux/sharedinbox.png (512×512), wired it into linux/CMakeLists.txt so it's installed next to the binary at build time, and called gtk_window_set_icon_from_file in linux/my_application.cc so the GTK window/taskbar shows the correct icon at runtime.

Tooling for future regeneration:

  • icon.png (1024×1024 source raster) committed to the repo
  • flutter_launcher_icons: ^0.13.1 added to dev_dependencies with a flutter_icons config block in pubspec.yaml
  • task generate-icons added to Taskfile.yml — runs rsvg-convert then flutter pub run flutter_launcher_icons
  • librsvg added to flake.nix so rsvg-convert is available inside nix develop
The implementation is done. Here's a summary of what was done: --- ## Summary Implemented **icon.svg as the app icon** across Android and Linux. PR: https://codeberg.org/guettli/sharedinbox/pulls/459 ### What changed **Android** — regenerated all five mipmap launcher icons (`mdpi` 48px → `xxxhdpi` 192px) from `icon.svg` using Inkscape. The rainbow-rings design now replaces the default Flutter logo. **Linux** — added `linux/sharedinbox.png` (512×512), wired it into `linux/CMakeLists.txt` so it's installed next to the binary at build time, and called `gtk_window_set_icon_from_file` in `linux/my_application.cc` so the GTK window/taskbar shows the correct icon at runtime. **Tooling for future regeneration:** - `icon.png` (1024×1024 source raster) committed to the repo - `flutter_launcher_icons: ^0.13.1` added to `dev_dependencies` with a `flutter_icons` config block in `pubspec.yaml` - `task generate-icons` added to `Taskfile.yml` — runs `rsvg-convert` then `flutter pub run flutter_launcher_icons` - `librsvg` added to `flake.nix` so `rsvg-convert` is available inside `nix develop`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: guettli/sharedinbox#451