diff --git a/src/constants/coreSettings.ts b/src/constants/coreSettings.ts index e3765740e..7d9efdae1 100644 --- a/src/constants/coreSettings.ts +++ b/src/constants/coreSettings.ts @@ -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) => { diff --git a/src/extensions/core/electronAdapter.ts b/src/extensions/core/electronAdapter.ts index 678c4dc5a..1b18c07f8 100644 --- a/src/extensions/core/electronAdapter.ts +++ b/src/extensions/core/electronAdapter.ts @@ -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) + } + } })() diff --git a/src/locales/en/settings.json b/src/locales/en/settings.json index 471e86678..85cb646e1 100644 --- a/src/locales/en/settings.json +++ b/src/locales/en/settings.json @@ -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" } -} \ No newline at end of file +}