Skip to content

fix(stage-tamagotchi): programmtical resize#913

Merged
nekomeowww merged 4 commits intomoeru-ai:mainfrom
abr-Projects:cannot-resize-on-windows
Jan 8, 2026
Merged

fix(stage-tamagotchi): programmtical resize#913
nekomeowww merged 4 commits intomoeru-ai:mainfrom
abr-Projects:cannot-resize-on-windows

Conversation

@abr-Projects
Copy link
Contributor

Description

Electron windows with transparent: true and frame: false cannot be resized due to a bug. This approach is based on the approach used in Cherry Studio

Linked Issues

https://github.com/CherryHQ/cherry-studio/pull/11766/files

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @abr-Projects, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request provides a workaround for a known Electron bug affecting transparent, frameless windows by implementing a custom, manual resizing solution. It establishes a robust communication channel between the renderer and main processes, allowing the user interface to control window dimensions directly. This change restores essential window management functionality, ensuring a consistent user experience despite the underlying platform limitation.

Highlights

  • Manual Window Resizing: Introduced a custom manual window resizing mechanism for Electron windows on Windows, specifically addressing a bug where transparent: true and frame: false windows cannot be resized natively.
  • IPC Communication for Resizing: Implemented an Inter-Process Communication (IPC) pipeline between the renderer and main processes. The renderer detects mouse movements on custom resize handles and sends resize requests to the main process, which then updates the window's bounds.
  • Renderer-side Resize Components: Added a new ResizeHandler Vue component and a useResize composable to the renderer process. These provide visual resize handles around the window's perimeter and manage the client-side logic for initiating and tracking resize operations.
  • Main Process Integration: Integrated the setupManualResize function into the main window's initialization, ensuring the IPC handler for resizing is correctly registered when the window is created and unregistered when it is closed.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a manual window resizing mechanism for frameless, transparent Electron windows, which is a solid workaround for a known platform-specific bug. The implementation spans the main process, a preload script, and new Vue components on the renderer side. My review focuses on a few key areas to enhance the code's robustness and maintainability. I've identified a potential bug in the preload script that could lead to API conflicts, an opportunity to improve type safety by removing a @ts-ignore, and a suggestion regarding constant placement for better visibility. Addressing these points will make the solution more robust and easier to maintain.

Comment on lines +52 to +53
const minWidth = 100
const minHeight = 200
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While it's good that you've used constants for minWidth and minHeight, these could be defined at the module level (outside the function) to make them more visible and to signal that they are static configuration values for this functionality. This improves maintainability by grouping constants together.

Comment on lines +19 to +20
// @ts-ignore
window.api?.resizeWindow(deltaX, deltaY, direction)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The use of @ts-ignore should be avoided. To ensure type safety for the API exposed via contextBridge, you should declare the shape of window.api in a global d.ts file. This will provide TypeScript with the necessary information to type-check the call and offer autocompletion, improving developer experience and code quality.

For example, you could add a file like src/renderer/api.d.ts with:

export interface IPreloadApi {
  resizeWindow: (deltaX: number, deltaY: number, direction: string) => Promise<void>;
}

declare global {
  interface Window {
    api: IPreloadApi;
  }
}
Suggested change
// @ts-ignore
window.api?.resizeWindow(deltaX, deltaY, direction)
window.api?.resizeWindow(deltaX, deltaY, direction)

@nekomeowww nekomeowww changed the title Fix: added a manual window resize for window fix: added a manual window resize for window Jan 8, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

⏳ Approval required for deploying to Cloudflare Workers (Preview) for stage-web.

Name Link
🔭 Waiting for approval For maintainers, approve here

Hey, @nekomeowww, @sumimakito, @luoling8192, @LemonNekoGH, kindly take some time to review and approve this deployment when you are available. Thank you! 🙏

@nekomeowww nekomeowww changed the title fix: added a manual window resize for window fix(stage-tamagotchi): manual resize for Windows Jan 8, 2026
@nekomeowww nekomeowww changed the title fix(stage-tamagotchi): manual resize for Windows fix(stage-tamagotchi): manual resize Jan 8, 2026
@nekomeowww nekomeowww changed the title fix(stage-tamagotchi): manual resize fix(stage-tamagotchi): programmtical resize Jan 8, 2026
@nekomeowww nekomeowww merged commit f858a44 into moeru-ai:main Jan 8, 2026
@abr-Projects abr-Projects deleted the cannot-resize-on-windows branch January 8, 2026 15:45
leaft pushed a commit to leaft/airi that referenced this pull request Jan 9, 2026
---------

Co-authored-by: Neko Ayaka <neko@ayaka.moe>
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