mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-07 16:40:05 +00:00
Improve desktop settings UX - window style
- No longer requires app restart on window style change
This commit is contained in:
@@ -386,6 +386,8 @@ export const CORE_SETTINGS: SettingParams[] = [
|
||||
category: ['Comfy', 'Menu', 'UseNewMenu'],
|
||||
defaultValue: 'Top',
|
||||
name: 'Use new menu',
|
||||
tooltip:
|
||||
'(Desktop, Windows only): When using custom window style, only Top is supported',
|
||||
type: 'combo',
|
||||
options: ['Disabled', 'Top', 'Bottom'],
|
||||
migrateDeprecatedValue: (value: string) => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { t } from '@/i18n'
|
||||
import { app } from '@/scripts/app'
|
||||
import { useDialogService } from '@/services/dialogService'
|
||||
import { useSettingStore } from '@/stores/settingStore'
|
||||
import { electronAPI as getElectronAPI, isElectron } from '@/utils/envUtil'
|
||||
|
||||
;(async () => {
|
||||
if (!isElectron()) return
|
||||
|
||||
@@ -49,9 +49,12 @@ import { electronAPI as getElectronAPI, isElectron } from '@/utils/envUtil'
|
||||
) => {
|
||||
if (!oldValue) return
|
||||
|
||||
electronAPI.Config.setWindowStyle(newValue)
|
||||
// Custom window mode requires the Top menu.
|
||||
if (newValue === 'custom' && oldValue !== newValue) {
|
||||
useSettingStore().set('Comfy.UseNewMenu', 'Top')
|
||||
}
|
||||
|
||||
onChangeRestartApp(newValue, oldValue)
|
||||
electronAPI.Config.setWindowStyle(newValue)
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -190,4 +193,21 @@ import { electronAPI as getElectronAPI, isElectron } from '@/utils/envUtil'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
// TODO: Replace monkey patch with API or replace UX.
|
||||
// If the user changes frontend menu type, ensure custom window style is disabled.
|
||||
const menuSetting = useSettingStore().settingsById['Comfy.UseNewMenu']
|
||||
if (menuSetting) {
|
||||
const { onChange } = menuSetting
|
||||
menuSetting.onChange = (
|
||||
newValue: 'Disabled' | 'Top' | 'Bottom',
|
||||
oldValue?: 'Disabled' | 'Top' | 'Bottom'
|
||||
) => {
|
||||
const style = useSettingStore().get('Comfy-Desktop.WindowStyle')
|
||||
if (oldValue === 'Top' && newValue !== oldValue && style === 'custom') {
|
||||
useSettingStore().set('Comfy-Desktop.WindowStyle', 'default')
|
||||
}
|
||||
return onChange?.(newValue, oldValue)
|
||||
}
|
||||
}
|
||||
})()
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
},
|
||||
"Comfy-Desktop_WindowStyle": {
|
||||
"name": "Window Style",
|
||||
"tooltip": "Choose custom option to hide the system title bar",
|
||||
"tooltip": "Custom: Replace the system title bar with ComfyUI's Top menu",
|
||||
"options": {
|
||||
"default": "default",
|
||||
"custom": "custom"
|
||||
"default": "Default",
|
||||
"custom": "Custom"
|
||||
}
|
||||
},
|
||||
"Comfy_ConfirmClear": {
|
||||
@@ -312,4 +312,4 @@
|
||||
"pysssss_SnapToGrid": {
|
||||
"name": "Always snap to grid"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user