fix(stage-tamagotchi): guard background material by platform (#2235)

This commit is contained in:
Neko
2026-08-07 00:16:59 +08:00
committed by GitHub
parent dd4658bd41
commit 8df21d09d6
2 changed files with 6 additions and 1 deletions
@@ -6,6 +6,7 @@ import type { ElectronWindowLifecycleState } from '../../../shared/eventa'
import { defineInvokeHandler } from '@moeru/eventa'
import { bounds, startLoopGetBounds } from '@proj-airi/electron-eventa'
import { createRendererLoop, safeClose } from '@proj-airi/electron-vueuse/main'
import { isWindows } from 'std-env'
import {
electron,
@@ -97,7 +98,7 @@ export function createWindowService(params: { context: ReturnType<typeof createC
})
defineInvokeHandler(params.context, electron.window.setBackgroundMaterial, (backgroundMaterial, options) => {
if (backgroundMaterial && params.window.webContents.id === options?.raw.ipcMainEvent.sender.id) {
if (isWindows && backgroundMaterial && params.window.webContents.id === options?.raw.ipcMainEvent.sender.id) {
params.window.setBackgroundMaterial(backgroundMaterial[0])
}
})
@@ -4,11 +4,14 @@ import type { BackgroundMaterialType, VibrancyType } from '@proj-airi/electron-e
import { electron } from '@proj-airi/electron-eventa'
import { useElectronEventaInvoke } from '@proj-airi/electron-vueuse'
import { FieldCombobox } from '@proj-airi/ui'
import { useAsyncState } from '@vueuse/core'
import { ref, watch } from 'vue'
const getIsWindows = useElectronEventaInvoke(electron.app.isWindows)
const setVibrancy = useElectronEventaInvoke(electron.window.setVibrancy)
const setBackgroundMaterial = useElectronEventaInvoke(electron.window.setBackgroundMaterial)
const { state: isWindows } = useAsyncState(() => getIsWindows(), false)
const vibrancy = ref<NonNullable<VibrancyType>>()
const backgroundMaterial = ref<NonNullable<BackgroundMaterialType>>()
@@ -63,6 +66,7 @@ watch(
/>
<FieldCombobox
v-if="isWindows"
v-model="backgroundMaterial"
label="Background Material"
description="Set the background material of the window."