Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generation progress to browser tab title #855

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<GlobalDialog />
<GlobalToast />
<UnloadWindowConfirmDialog />
<BrowserTabTitle />
</template>

<script setup lang="ts">
Expand All @@ -27,6 +28,7 @@ import NodeLibrarySidebarTab from './components/sidebar/tabs/NodeLibrarySidebarT
import GlobalDialog from './components/dialog/GlobalDialog.vue'
import GlobalToast from './components/toast/GlobalToast.vue'
import UnloadWindowConfirmDialog from './components/dialog/UnloadWindowConfirmDialog.vue'
import BrowserTabTitle from './components/BrowserTabTitle.vue'
import { api } from './scripts/api'
import { StatusWsMessageStatus } from './types/apiTypes'
import { useQueuePendingTaskCountStore } from './stores/queueStore'
Expand Down
18 changes: 18 additions & 0 deletions src/components/BrowserTabTitle.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<div>
<!-- This component does not render anything visible. -->
</div>
</template>

<script setup lang="ts">
import { useExecutionStore } from '@/stores/executionStore'
import { useTitle } from '@vueuse/core'
import { computed } from 'vue'

const executionStore = useExecutionStore()
const executionText = computed(() =>
executionStore.isIdle ? '' : `[${executionStore.executionProgress}%]`
)
const title = computed(() => executionText.value + 'ComfyUI')
useTitle(title)
</script>
8 changes: 8 additions & 0 deletions src/components/dialog/UnloadWindowConfirmDialog.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
<template>
<div>
<!-- This component does not render anything visible. It is used to confirm
the user wants to close the window, and if they do, it will call the
beforeunload event. -->
</div>
</template>

<script setup lang="ts">
import { useSettingStore } from '@/stores/settingStore'
import { onMounted, onUnmounted } from 'vue'
Expand Down
3 changes: 3 additions & 0 deletions src/stores/executionStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const useExecutionStore = defineStore('execution', () => {
return Object.values(activePrompt.value.nodes).length
})

const isIdle = computed(() => !activePromptId.value)

const nodesExecuted = computed(() => {
if (!activePrompt.value) return 0
return Object.values(activePrompt.value.nodes).filter(Boolean).length
Expand Down Expand Up @@ -102,6 +104,7 @@ export const useExecutionStore = defineStore('execution', () => {
}

return {
isIdle,
activePromptId,
queuedPrompts,
executingNodeId,
Expand Down
Loading