feat(SelectionService): update toolbar window settings for macOS and Windows

- Set the toolbar window to be hidden in Mission Control and accept the first mouse click on macOS.
- Adjusted visibility settings for the toolbar window to ensure it appears correctly on all workspaces, including full-screen mode.
- Refactored the MacProcessTrustHintModal component to improve layout and styling of buttons in the modal footer.
This commit is contained in:
fullex
2025-06-27 15:19:42 +08:00
parent 210586f2e9
commit f4367f5589
2 changed files with 11 additions and 7 deletions
+7 -3
View File
@@ -397,6 +397,7 @@ export class SelectionService {
this.toolbarWindow = new BrowserWindow({
width: toolbarWidth,
height: toolbarHeight,
show: false,
frame: false,
transparent: true,
alwaysOnTop: true,
@@ -404,6 +405,7 @@ export class SelectionService {
resizable: false,
minimizable: false,
maximizable: false,
fullscreenable: false, // [macOS] must be false
movable: true,
hasShadow: false,
thickFrame: false,
@@ -414,8 +416,9 @@ export class SelectionService {
// [macOS] DO NOT set type to 'panel', it will not work because it conflicts with other settings
// [macOS] DO NOT set focusable to false, it will make other windows bring to front together
...(isWin ? { type: 'toolbar', focusable: false } : {}),
hiddenInMissionControl: true, // [macOS only]
acceptFirstMouse: true, // [macOS only]
show: false,
webPreferences: {
preload: join(__dirname, '../preload/index.js'),
contextIsolation: true,
@@ -503,10 +506,11 @@ export class SelectionService {
// [macOS] force the toolbar window to be visible on current desktop
if (isMac) {
this.toolbarWindow!.setVisibleOnAllWorkspaces(true)
this.toolbarWindow!.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true })
}
// [macOS] must use showInactive() to prevent other windows bring to front together
// [macOS] MUST use `showInactive()` to prevent other windows bring to front together
// [Windows] is OK for both `show()` and `showInactive()` because of `focusable: false`
this.toolbarWindow!.showInactive()
/**
@@ -1,4 +1,4 @@
import { Button, Modal, Space, Typography } from 'antd'
import { Button, Modal, Typography } from 'antd'
import { FC } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import styled from 'styled-components'
@@ -29,14 +29,14 @@ const MacProcessTrustHintModal: FC<MacProcessTrustHintModalProps> = ({ open, onC
open={open}
onCancel={onClose}
footer={
<Space>
<Button onClick={handleOpenAccessibility}>
<div style={{ display: 'flex', justifyContent: 'space-between', width: '100%' }}>
<Button type="link" style={{ color: 'var(--color-text-3)', fontSize: 12 }} onClick={handleOpenAccessibility}>
{t('selection.settings.enable.mac_process_trust_hint.button.open_accessibility_settings')}
</Button>
<Button type="primary" onClick={handleConfirm}>
{t('selection.settings.enable.mac_process_trust_hint.button.go_to_settings')}
</Button>
</Space>
</div>
}
centered
destroyOnClose>