Add taskbar status icon stuff

This commit is contained in:
Lncvrt committed 2026-02-28 20:10:10 -07:00
1 parent 9d9c6147c5
commit dc55c7549d
2 files changed
+28 -2

No files matched your search

+26 -2
View File
@@ -37,6 +37,11 @@ import DownloadsPopup from '@/componets/popups/Downloads'
import VersionVersionPopup from '@/componets/popups/VersionVersion'
import { fetch } from '@tauri-apps/plugin-http'
import { verifySignature } from '@/lib/Util'
import {
getCurrentWindow,
ProgressBarStatus,
UserAttentionType
} from '@tauri-apps/api/window'
const roboto = Roboto({
subsets: ['latin']
@@ -197,7 +202,7 @@ export default function RootLayout ({
})
}).then(f => (unlistenProgress = f))
listen<string>('download-progress', event => {
listen<string>('download-progress', async event => {
const [displayName, progStr, totalSizeStr, speedStr, etaSecsStr] =
event.payload.split(':')
const prog = Number(progStr)
@@ -217,6 +222,10 @@ export default function RootLayout ({
}
return copy
})
getCurrentWindow().setProgressBar({
status: ProgressBarStatus.Normal,
progress: Math.floor(prog)
})
}).then(f => (unlistenProgress = f))
listen<string>('download-hash-checking', event => {
@@ -244,7 +253,7 @@ export default function RootLayout ({
return () => {
unlistenProgress?.()
}
}, [])
}, [downloadProgress])
useEffect(() => {
;(async () => {
@@ -387,6 +396,9 @@ export default function RootLayout ({
'Download Failed',
`The download for version ${info.displayName} has failed.`
)
await getCurrentWindow().requestUserAttention(
UserAttentionType.Critical
)
return
}
@@ -426,6 +438,9 @@ export default function RootLayout ({
'Download Failed',
`The download for version ${info.displayName} has failed.`
)
await getCurrentWindow().requestUserAttention(
UserAttentionType.Critical
)
}
setDownloadQueue(prev => prev.slice(1))
@@ -451,6 +466,15 @@ export default function RootLayout ({
) {
notifyUser('Downloads Finished', 'All downloads have finished.')
setTimeout(() => closePopup(), 0)
;(async () => {
await getCurrentWindow().setProgressBar({
status: ProgressBarStatus.None,
progress: 0
})
await getCurrentWindow().requestUserAttention(
UserAttentionType.Informational
)
})()
}
previousQueueLength.current = downloadQueue.length + downloadProgress.length
}, [