Add taskbar status icon stuff
This commit is contained in:
2 files changed
+28
-2
No files matched your search
@@ -19,6 +19,8 @@
|
|||||||
"core:window:allow-is-maximized",
|
"core:window:allow-is-maximized",
|
||||||
"core:window:allow-start-dragging",
|
"core:window:allow-start-dragging",
|
||||||
"core:window:allow-toggle-maximize",
|
"core:window:allow-toggle-maximize",
|
||||||
|
"core:window:allow-request-user-attention",
|
||||||
|
"core:window:allow-set-progress-bar",
|
||||||
"decorum:allow-show-snap-overlay",
|
"decorum:allow-show-snap-overlay",
|
||||||
"fs:default",
|
"fs:default",
|
||||||
"dialog:default",
|
"dialog:default",
|
||||||
|
|||||||
+26
-2
@@ -37,6 +37,11 @@ import DownloadsPopup from '@/componets/popups/Downloads'
|
|||||||
import VersionVersionPopup from '@/componets/popups/VersionVersion'
|
import VersionVersionPopup from '@/componets/popups/VersionVersion'
|
||||||
import { fetch } from '@tauri-apps/plugin-http'
|
import { fetch } from '@tauri-apps/plugin-http'
|
||||||
import { verifySignature } from '@/lib/Util'
|
import { verifySignature } from '@/lib/Util'
|
||||||
|
import {
|
||||||
|
getCurrentWindow,
|
||||||
|
ProgressBarStatus,
|
||||||
|
UserAttentionType
|
||||||
|
} from '@tauri-apps/api/window'
|
||||||
|
|
||||||
const roboto = Roboto({
|
const roboto = Roboto({
|
||||||
subsets: ['latin']
|
subsets: ['latin']
|
||||||
@@ -197,7 +202,7 @@ export default function RootLayout ({
|
|||||||
})
|
})
|
||||||
}).then(f => (unlistenProgress = f))
|
}).then(f => (unlistenProgress = f))
|
||||||
|
|
||||||
listen<string>('download-progress', event => {
|
listen<string>('download-progress', async event => {
|
||||||
const [displayName, progStr, totalSizeStr, speedStr, etaSecsStr] =
|
const [displayName, progStr, totalSizeStr, speedStr, etaSecsStr] =
|
||||||
event.payload.split(':')
|
event.payload.split(':')
|
||||||
const prog = Number(progStr)
|
const prog = Number(progStr)
|
||||||
@@ -217,6 +222,10 @@ export default function RootLayout ({
|
|||||||
}
|
}
|
||||||
return copy
|
return copy
|
||||||
})
|
})
|
||||||
|
getCurrentWindow().setProgressBar({
|
||||||
|
status: ProgressBarStatus.Normal,
|
||||||
|
progress: Math.floor(prog)
|
||||||
|
})
|
||||||
}).then(f => (unlistenProgress = f))
|
}).then(f => (unlistenProgress = f))
|
||||||
|
|
||||||
listen<string>('download-hash-checking', event => {
|
listen<string>('download-hash-checking', event => {
|
||||||
@@ -244,7 +253,7 @@ export default function RootLayout ({
|
|||||||
return () => {
|
return () => {
|
||||||
unlistenProgress?.()
|
unlistenProgress?.()
|
||||||
}
|
}
|
||||||
}, [])
|
}, [downloadProgress])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
;(async () => {
|
;(async () => {
|
||||||
@@ -387,6 +396,9 @@ export default function RootLayout ({
|
|||||||
'Download Failed',
|
'Download Failed',
|
||||||
`The download for version ${info.displayName} has failed.`
|
`The download for version ${info.displayName} has failed.`
|
||||||
)
|
)
|
||||||
|
await getCurrentWindow().requestUserAttention(
|
||||||
|
UserAttentionType.Critical
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -426,6 +438,9 @@ export default function RootLayout ({
|
|||||||
'Download Failed',
|
'Download Failed',
|
||||||
`The download for version ${info.displayName} has failed.`
|
`The download for version ${info.displayName} has failed.`
|
||||||
)
|
)
|
||||||
|
await getCurrentWindow().requestUserAttention(
|
||||||
|
UserAttentionType.Critical
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
setDownloadQueue(prev => prev.slice(1))
|
setDownloadQueue(prev => prev.slice(1))
|
||||||
@@ -451,6 +466,15 @@ export default function RootLayout ({
|
|||||||
) {
|
) {
|
||||||
notifyUser('Downloads Finished', 'All downloads have finished.')
|
notifyUser('Downloads Finished', 'All downloads have finished.')
|
||||||
setTimeout(() => closePopup(), 0)
|
setTimeout(() => closePopup(), 0)
|
||||||
|
;(async () => {
|
||||||
|
await getCurrentWindow().setProgressBar({
|
||||||
|
status: ProgressBarStatus.None,
|
||||||
|
progress: 0
|
||||||
|
})
|
||||||
|
await getCurrentWindow().requestUserAttention(
|
||||||
|
UserAttentionType.Informational
|
||||||
|
)
|
||||||
|
})()
|
||||||
}
|
}
|
||||||
previousQueueLength.current = downloadQueue.length + downloadProgress.length
|
previousQueueLength.current = downloadQueue.length + downloadProgress.length
|
||||||
}, [
|
}, [
|
||||||
|
|||||||
Reference in new issue
Block a user