Skip to content

Conversation

@beyondkmp
Copy link
Collaborator

@beyondkmp beyondkmp commented Dec 20, 2025

beyondkmp and others added 2 commits December 20, 2025 11:49
Add a setting in Display Settings that allows Linux users to switch
between custom title bar (frameless window with WindowControls) and
native system title bar. The setting requires app restart to take effect
since Electron's frame option cannot be changed at runtime.

- Add useSystemTitleBar config key and getter/setter in ConfigManager
- Add IPC channel and handler for setting persistence
- Add Redux state and action for useSystemTitleBar
- Add UI toggle in DisplaySettings (Linux only)
- Hide WindowControls when system title bar is enabled on Linux
- Modify WindowService to check setting when creating window on Linux
- Add translations for all supported locales

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Move WindowControls inside NavbarContainer as a flex item instead of
using fixed positioning. This ensures the window controls are properly
positioned adjacent to the navbar content when using the left navbar
layout.

- Remove position: fixed from WindowControlsContainer styling
- Include WindowControls as last child of NavbarContainer
- Remove extra padding-right from NavbarRight since controls are now
  in the flex layout

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copilot AI review requested due to automatic review settings December 20, 2025 06:35
@beyondkmp beyondkmp requested a review from 0xfullex as a code owner December 20, 2025 06:35
@beyondkmp beyondkmp marked this pull request as draft December 20, 2025 06:35
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 adds a new setting option for Linux users to enable the system title bar instead of the custom frameless window with custom controls. The feature requires an app restart to take effect and is platform-specific (Linux only).

Key changes:

  • Added useSystemTitleBar Redux state with default value of false
  • Integrated a new UI toggle in Display Settings (Linux only) with restart confirmation dialog
  • Modified window creation logic to conditionally use native frames on Linux based on the setting
  • Adjusted WindowControls component positioning from fixed to inline flow layout

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/renderer/src/store/settings.ts Added useSystemTitleBar state, action, and initialization
src/renderer/src/pages/settings/DisplaySettings/DisplaySettings.tsx Added UI toggle for the system title bar setting with restart confirmation
src/renderer/src/pages/home/Navbar.tsx Simplified paddingRight to static value since WindowControls are no longer fixed positioned
src/renderer/src/i18n/translate/*.json Added translations with placeholder text for non-English locales
src/renderer/src/i18n/locales/zh-cn.json Added Chinese translations for the new setting
src/renderer/src/i18n/locales/en-us.json Added English translations for the new setting
src/renderer/src/hooks/useSettings.ts Added setUseSystemTitleBar hook function
src/renderer/src/components/app/Navbar.tsx Moved WindowControls from fixed positioning to inline, removed conditional rendering based on navbar position
src/renderer/src/components/WindowControls/index.tsx Added logic to hide controls when using system title bar on Linux
src/renderer/src/components/WindowControls/WindowControls.styled.ts Removed fixed positioning styles, converted to inline flex layout
src/renderer/src/components/Tab/TabContainer.tsx Added conditional padding for Windows/Linux to accommodate WindowControls
src/preload/index.ts Added IPC bridge for setUseSystemTitleBar
src/main/services/WindowService.ts Modified window creation to conditionally use native frame on Linux
src/main/services/ConfigManager.ts Added getter/setter methods for useSystemTitleBar config
src/main/ipc.ts Added IPC handler for setting the useSystemTitleBar value
packages/shared/IpcChannel.ts Added App_SetUseSystemTitleBar IPC channel

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

flex: activeTopicOrSession === 'topic' ? 1 : 'none',
position: 'relative',
paddingRight: isWin || isLinux ? '144px' : '15px',
paddingRight: '8px',
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

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

The paddingRight is now hardcoded to '8px' for all platforms, but this might not provide enough space for the WindowControls on Windows and Linux when the system title bar is not being used. Consider making this conditional based on the platform and useSystemTitleBar setting to ensure proper spacing for the window controls.

Suggested change
paddingRight: '8px',
paddingRight:
typeof navigator !== 'undefined' && /Windows|Win32|Linux/i.test(navigator.userAgent)
? '80px'
: '8px',

Copilot uses AI. Check for mistakes.
gap: 5px;
padding-left: ${({ $isFullscreen }) => (!$isFullscreen && isMac ? 'calc(env(titlebar-area-x) + 4px)' : '15px')};
padding-right: ${({ $isFullscreen }) => ($isFullscreen ? '12px' : '0')};
padding-right: ${({ $isFullscreen }) => ($isFullscreen ? '12px' : isWin || isLinux ? '8px' : '0')};
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

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

The paddingRight for TabsBar includes hardcoded values for Linux ('8px') when not in fullscreen mode. This padding should be conditional based on whether the system title bar is being used on Linux. When useSystemTitleBar is true on Linux, the custom window controls won't be displayed (they return null), so the padding calculation might need adjustment. Consider making the padding conditional to match whether WindowControls will actually be rendered.

Suggested change
padding-right: ${({ $isFullscreen }) => ($isFullscreen ? '12px' : isWin || isLinux ? '8px' : '0')};
padding-right: ${({ $isFullscreen }) => ($isFullscreen ? '12px' : isWin ? '8px' : '0')};

Copilot uses AI. Check for mistakes.
beyondkmp and others added 2 commits December 22, 2025 14:15
Remove the 8px padding-right for Windows/Linux in TabsBar that was
causing window controls to not be flush against the window edge.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@beyondkmp beyondkmp marked this pull request as ready for review January 15, 2026 08:39
@beyondkmp
Copy link
Collaborator Author

beyondkmp commented Jan 15, 2026

Note

This comment was translated by Claude.

Done referencing VSCode, indeed having a native title bar on Linux makes some operations more convenient.

image
Original Content

参照vscode做的,确实在linux下面有native title bar有些操作更加方便。

image

flex: activeTopicOrSession === 'topic' ? 1 : 'none',
position: 'relative',
paddingRight: isWin || isLinux ? '144px' : '15px',
paddingRight: '8px',
Copy link
Collaborator

@DeJeune DeJeune Jan 20, 2026

Choose a reason for hiding this comment

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

Note

This issue/comment/review was translated by Claude.

Why was this changed?


Original Content

这里为啥要改

Copy link
Collaborator Author

@beyondkmp beyondkmp Jan 21, 2026

Choose a reason for hiding this comment

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

Note

This comment was translated by Claude.

  1. WindowControls positioning has changed

Previously (main branch):

position: fixed;
top: 0;
right: 0;

The window control buttons were fixed in the top-right corner of the window, so Navbar.tsx needed paddingRight: 144px to prevent content from being obscured.

Currently (feature branch):

/* Removed fixed positioning */
display: flex;

The window control buttons have become flex children, directly placed inside the NavbarContainer.

  1. Navbar structure has also changed

Previously: WindowControls was outside the NavbarContainer, using fixed positioning

Currently: WindowControls is inside the NavbarContainer, naturally arranged as flex children

Conclusion

So paddingRight: '8px' is correct! Because:

  • The window control buttons are now part of the flex layout and will automatically take up space
  • No need to manually reserve 144px of space anymore
  • Both Windows and Linux use the same flex layout approach

However, I've unified it to use 15px as before, which has been corrected.


Original Content
  1. WindowControls 定位方式改变了

之前(main 分支):
position: fixed;
top: 0;
right: 0;
窗口控制按钮是固定定位在窗口右上角的,所以 Navbar.tsx 需要 paddingRight: 144px 来避免内容被遮挡。

现在(feature 分支):
/* 移除了 fixed 定位 */
display: flex;
窗口控制按钮变成了 flex 子元素,直接放在 NavbarContainer 里面。

  1. Navbar 结构也改变了

之前:WindowControls 在 NavbarContainer 外面,使用 fixed 定位
现在:WindowControls 在 NavbarContainer 里面,作为 flex 子元素自然排列

结论

所以 paddingRight: '8px' 是正确的!因为:

  • 窗口控制按钮现在是 flex 布局的一部分,会自动占据空间
  • 不再需要手动预留 144px 的空间
  • Windows 和 Linux 都使用同样的 flex 布局方式

不过还是和之前统一下使用15 px, 已经修正了。

@beyondkmp
Copy link
Collaborator Author

image

@beyondkmp beyondkmp requested a review from DeJeune January 21, 2026 06:21
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.

[错误]: linux 端浅色、深色切换和适配问题

3 participants