mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 03:01:54 +00:00
Allow users to opt-out of changing favicon
This commit is contained in:
@@ -1,23 +1,41 @@
|
|||||||
import { useFavicon } from '@vueuse/core'
|
import { useFavicon } from '@vueuse/core'
|
||||||
import { watch } from 'vue'
|
import { type WatchHandle, ref, watch } from 'vue'
|
||||||
|
|
||||||
import { useExecutionStore } from '@/stores/executionStore'
|
import { useExecutionStore } from '@/stores/executionStore'
|
||||||
|
import { useSettingStore } from '@/stores/settingStore'
|
||||||
|
|
||||||
export const useProgressFavicon = () => {
|
export const useProgressFavicon = () => {
|
||||||
const defaultFavicon = '/assets/images/favicon_progress_16x16/frame_9.png'
|
const defaultFavicon = '/assets/images/favicon_progress_16x16/frame_9.png'
|
||||||
const favicon = useFavicon(defaultFavicon)
|
const favicon = useFavicon(defaultFavicon)
|
||||||
const executionStore = useExecutionStore()
|
const executionStore = useExecutionStore()
|
||||||
|
const settingsStore = useSettingStore()
|
||||||
const totalFrames = 10
|
const totalFrames = 10
|
||||||
|
|
||||||
watch(
|
const watchHandle = ref<WatchHandle>()
|
||||||
[() => executionStore.executionProgress, () => executionStore.isIdle],
|
|
||||||
([progress, isIdle]) => {
|
function watchProgress() {
|
||||||
if (isIdle) {
|
watchHandle.value = watch(
|
||||||
favicon.value = defaultFavicon
|
[() => executionStore.executionProgress, () => executionStore.isIdle],
|
||||||
} else {
|
([progress, isIdle]) => {
|
||||||
const frame = Math.floor(progress * totalFrames)
|
if (isIdle) {
|
||||||
favicon.value = `/assets/images/favicon_progress_16x16/frame_${frame}.png`
|
favicon.value = defaultFavicon
|
||||||
|
} else {
|
||||||
|
const frame = Math.floor(progress * totalFrames)
|
||||||
|
favicon.value = `/assets/images/favicon_progress_16x16/frame_${frame}.png`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => settingsStore.get('Comfy.Window.TabIconProgress'),
|
||||||
|
(showProgress) => {
|
||||||
|
if (showProgress) {
|
||||||
|
watchProgress()
|
||||||
|
} else {
|
||||||
|
watchHandle.value?.stop()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -828,5 +828,14 @@ export const CORE_SETTINGS: SettingParams[] = [
|
|||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
versionAdded: '1.19.1'
|
versionAdded: '1.19.1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'Comfy.Window.TabIconProgress',
|
||||||
|
name: 'Browser tab icon shows progress',
|
||||||
|
tooltip:
|
||||||
|
'Updates the browser tab icon to show the progress of the current task.',
|
||||||
|
type: 'boolean',
|
||||||
|
defaultValue: true,
|
||||||
|
versionAdded: '1.20.0'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -463,7 +463,8 @@ const zSettings = z.object({
|
|||||||
'main.sub.setting.name': z.any(),
|
'main.sub.setting.name': z.any(),
|
||||||
'single.setting': z.any(),
|
'single.setting': z.any(),
|
||||||
'LiteGraph.Node.DefaultPadding': z.boolean(),
|
'LiteGraph.Node.DefaultPadding': z.boolean(),
|
||||||
'LiteGraph.Pointer.TrackpadGestures': z.boolean()
|
'LiteGraph.Pointer.TrackpadGestures': z.boolean(),
|
||||||
|
'Comfy.Window.TabIconProgress': z.boolean()
|
||||||
})
|
})
|
||||||
|
|
||||||
export type EmbeddingsResponse = z.infer<typeof zEmbeddingsResponse>
|
export type EmbeddingsResponse = z.infer<typeof zEmbeddingsResponse>
|
||||||
|
|||||||
Reference in New Issue
Block a user