mirror of
https://gitlab.com/futo-org/fcast.git
synced 2025-08-04 16:27:02 +00:00
Electron: Added support for changing main window background
This commit is contained in:
parent
e7168b0a74
commit
62e430c080
5 changed files with 69 additions and 2 deletions
|
@ -43,6 +43,24 @@ if (TARGET === 'electron') {
|
|||
preloadData.subscribedKeys.keyUp = value.keyUp;
|
||||
})
|
||||
|
||||
electronAPI.ipcRenderer.on('update-background', (_event, path: string, isVideo: boolean) => {
|
||||
const imageBackground = document.getElementById('image-background') as HTMLImageElement;
|
||||
const videoBackground = document.getElementById('video-player') as HTMLVideoElement;
|
||||
|
||||
if (isVideo) {
|
||||
videoBackground.src = path;
|
||||
|
||||
imageBackground.style.display = 'none';
|
||||
videoBackground.style.display = 'block';
|
||||
}
|
||||
else {
|
||||
imageBackground.src = path;
|
||||
|
||||
imageBackground.style.display = 'block';
|
||||
videoBackground.style.display = 'none';
|
||||
}
|
||||
})
|
||||
|
||||
electronAPI.ipcRenderer.on('toast', (_event, message: string, icon: ToastIcon = ToastIcon.INFO, duration: number = 5000) => {
|
||||
toast(message, icon, duration);
|
||||
})
|
||||
|
|
|
@ -9,6 +9,13 @@ body, html {
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
#image-background {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: none;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.video {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue