Skip to content

refactor electron style setting for mac only#1508

Open
Douglasymlai wants to merge 1 commit intomainfrom
electron-style-refactor
Open

refactor electron style setting for mac only#1508
Douglasymlai wants to merge 1 commit intomainfrom
electron-style-refactor

Conversation

@Douglasymlai
Copy link
Contributor

@Douglasymlai Douglasymlai commented Mar 20, 2026

Related Issue

Closes #

Description

Refactor electron style change for windows & old version mac

  • Support transparent style only for M chip Mac

Testing Evidence (REQUIRED)

  • I have included human-verified testing evidence in this PR.
  • This PR includes frontend/UI changes, and I attached screenshot(s) or screen recording(s).
  • No frontend/UI changes in this PR.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Contribution Guidelines Acknowledgement

@Douglasymlai Douglasymlai requested review from 4pmtong and Copilot March 20, 2026 15:10
@Douglasymlai Douglasymlai self-assigned this Mar 20, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors Electron “transparent/vibrancy” styling so it’s only enabled on Apple Silicon Macs, and updates the renderer settings UI to only offer the transparent theme when supported.

Changes:

  • Expose getArch() via the Electron preload bridge and add corresponding TypeScript declarations.
  • Gate transparent/vibrancy window settings in the main process to Apple Silicon Macs only.
  • Update Settings → General appearance options to hide “transparent” unless running on Apple Silicon, and force a fallback to dark when unsupported.

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/types/electron.d.ts Adds getArch() typings (but introduces/extends a mismatch with what window.ipcRenderer actually exposes).
src/pages/Setting/General.tsx Uses platform+arch to conditionally include the transparent theme and falls back from previously-selected transparent mode.
electron/preload/index.ts Exposes getArch() to the renderer via window.electronAPI.
electron/main/index.ts Restricts BrowserWindow transparency/vibrancy/rounded-corners behavior to Apple Silicon Macs.
.gitignore Ignores .claude directory.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 83 to +87
useEffect(() => {
const platform = window.electronAPI.getPlatform();
console.log(platform);
const arch = window.electronAPI.getArch();
const isAppleSilicon = platform === 'darwin' && arch === 'arm64';

Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

This effect reads appearance and calls setAppearance, but the dependency array is empty. With the repo’s enabled react-hooks/exhaustive-deps rule, this will trigger a lint warning and can also lock in a stale appearance value if the store hydrates after mount. Consider either (a) including appearance and setAppearance in the deps (and structuring the logic to avoid unnecessary re-runs), or (b) reading the current appearance from the store inside the effect and documenting with an eslint-disable comment.

Copilot uses AI. Check for mistakes.
roundedCorners: !isWindows,
// Rounded corners on Apple Silicon Macs (transparent mode)
roundedCorners: supportsTransparency,
// Non-transparent platforms need a frame except macOS (which uses hidden titleBarStyle)
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

The comment says “Non-transparent platforms need a frame except macOS”, but the code sets frame to false on Linux (isMac false, isWindows false). If frameless Linux is intentional, please adjust the comment to match; otherwise set frame: true for Linux/non-mac platforms.

Suggested change
// Non-transparent platforms need a frame except macOS (which uses hidden titleBarStyle)
// Use frameless window on macOS and Linux; Windows uses a standard framed window

Copilot uses AI. Check for mistakes.
Comment on lines +2755 to +2760
// Only use transparency on Apple Silicon Macs (older Macs/Windows/Linux have rendering issues)
transparent: supportsTransparency,
// Solid background for non-transparent mode, fully transparent on Apple Silicon for native vibrancy
backgroundColor: supportsTransparency
? '#00000000'
: nativeTheme.shouldUseDarkColors
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

This change makes transparent false on Linux as well (previously it was enabled on non-Windows). The PR title/description focuses on macOS/Windows, so please confirm Linux is intentionally included and update the PR description accordingly (or gate this to macOS only if Linux should keep transparency).

Copilot uses AI. Check for mistakes.
@4pmtong 4pmtong force-pushed the electron-style-refactor branch from fedc958 to aa22180 Compare March 22, 2026 16:27
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