Skip to content

Conversation

@ucswift
Copy link
Member

@ucswift ucswift commented Jan 28, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved Windows installer and application icon rendering for better visual quality and compatibility.
  • Chores

    • Added automated icon generation to ensure consistent Windows ICO assets across builds.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

📝 Walkthrough

Walkthrough

This PR switches Windows icon references in the Electron Builder config from PNG to ICO and adds a new Node.js script that generates a 256x256 ICO from an existing PNG using PowerShell and manual ICO binary construction.

Changes

Cohort / File(s) Summary
Electron Builder Configuration
electron-builder.config.js
Updated Windows-related icon paths: win.icon, nsis.installerIcon, nsis.uninstallerIcon, nsis.installerHeaderIcon now point to assets/icon.ico instead of PNGs.
Icon Conversion Utility
scripts/generate-ico.js
Added script that resizes a PNG to 256x256 via PowerShell, reads the PNG bytes, constructs ICO header + directory entry, concatenates image data to produce assets/icon.ico, cleans temp files, and logs errors.
UI component formatting
src/components/ui/bottomsheet/index.tsx
Minor whitespace/formatting tweaks in default context handlers and keydown handler; no behavior or API changes.

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer
  participant Node as Node script (generate-ico.js)
  participant PS as PowerShell
  participant FS as Filesystem

  Dev->>Node: run scripts/generate-ico.js
  Node->>PS: spawn PowerShell to resize PNG -> temp PNG (256x256)
  PS-->>Node: resized PNG file path
  Node->>FS: read resized PNG bytes
  Node->>Node: build ICO header + directory entry
  Node->>FS: write `assets/icon.ico`
  Node->>FS: remove temp PNG
  Node-->>Dev: exit status / logs
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • RU-T47 Build fix #206: Modifies the same Electron Builder Windows icon settings (switched icon format between .ico and .png), directly related to build/icon configuration changes.

Suggested reviewers

  • github-actions

Poem

🐰✨
From PNG fields to ICO's snug embrace,
I resize with PowerShell, stitch bytes in place.
No extra crates, just headers aligned,
A tidy icon for builds refined.
Hop, click, build—our app wears a new face. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is vague and generic, using non-descriptive terms like 'Fixing build' without conveying meaningful information about the specific changes (icon format conversion and script addition). Provide a more specific title that describes the main change, such as 'Convert Windows icons from PNG to ICO format in Electron Builder config' or similar.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@scripts/generate-ico.js`:
- Around line 31-33: The variable size in generate-ico.js is assigned but never
used (const size = 256); remove this unused declaration to satisfy linting (or
if you intended to use it for resizing/ico creation, apply it where pngBuffer is
processed). Update the code around the console.log('Generating ICO file...') /
pngBuffer = fs.readFileSync(tempPng) block by deleting the unused size constant
(or replace its usage appropriately).
- Around line 1-7: Add the Node.js ESLint environment directive so ESLint
recognizes Node globals used in this file (e.g., __dirname, require, Buffer).
Modify the top of generate-ico.js to include the Node env directive (so linting
won't flag the globals used when creating paths like inputPng/outputIco/tempPng
and when using Buffer later around the Buffer usage in the ~lines 39–63 region).
Ensure the directive targets node environment only and is the first comment in
the file.
🧹 Nitpick comments (2)
scripts/generate-ico.js (2)

66-73: Ensure temp PNG cleanup even on failure.

If an error occurs after the temp file is created, it won’t be removed. Move cleanup to finally and guard with existsSync.

🧽 Cleanup in finally
-  // Clean up
-  fs.unlinkSync(tempPng);
-
   console.log(`Successfully created ${outputIco}`);
-
 } catch (error) {
   console.error('Error generating ICO:', error);
   process.exit(1);
+} finally {
+  if (fs.existsSync(tempPng)) {
+    fs.unlinkSync(tempPng);
+  }
 }

9-25: Add platform guard for clarity on tool dependencies.

This script is never invoked in any build or CI process (assets/icon.ico is pre-committed), but it should guard against accidental execution on non-Windows systems with an explicit error message rather than relying on PowerShell absence to fail cryptically.

✅ Suggested guard
+if (process.platform !== 'win32') {
+  console.error('generate-ico.js requires Windows PowerShell and is intended for local development only.');
+  process.exit(1);
+}
+
 try {
   console.log('Resizing icon to 256x256 using PowerShell...');

@ucswift
Copy link
Member Author

ucswift commented Jan 28, 2026

Approve

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is approved.

@ucswift ucswift merged commit 4ebd2b4 into master Jan 28, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants