diff --git a/src/main/events/misc/index.ts b/src/main/events/misc/index.ts index 029ae5c6..65ae8dd5 100644 --- a/src/main/events/misc/index.ts +++ b/src/main/events/misc/index.ts @@ -7,6 +7,7 @@ import "./get-hydra-decky-plugin-info"; import "./hydra-api-call"; import "./install-common-redist"; import "./install-hydra-decky-plugin"; +import "./is-main-window-open"; import "./open-checkout"; import "./open-external"; import "./open-main-window"; diff --git a/src/main/events/misc/is-main-window-open.ts b/src/main/events/misc/is-main-window-open.ts new file mode 100644 index 00000000..f2da3fb3 --- /dev/null +++ b/src/main/events/misc/is-main-window-open.ts @@ -0,0 +1,12 @@ +import { registerEvent } from "../register-event"; +import { WindowManager } from "@main/services"; + +const isMainWindowOpen = async () => { + return ( + WindowManager.mainWindow !== null && + !WindowManager.mainWindow.isDestroyed() && + WindowManager.mainWindow.isVisible() + ); +}; + +registerEvent("isMainWindowOpen", isMainWindowOpen); diff --git a/src/preload/index.ts b/src/preload/index.ts index 6da68bf0..d2b4baf4 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -679,6 +679,7 @@ contextBridge.exposeInMainWorld("electron", { showGameLauncherWindow: () => ipcRenderer.invoke("showGameLauncherWindow"), closeGameLauncherWindow: () => ipcRenderer.invoke("closeGameLauncherWindow"), openMainWindow: () => ipcRenderer.invoke("openMainWindow"), + isMainWindowOpen: () => ipcRenderer.invoke("isMainWindowOpen"), /* LevelDB Generic CRUD */ leveldb: { diff --git a/src/renderer/src/pages/game-launcher/game-launcher.scss b/src/renderer/src/pages/game-launcher/game-launcher.scss index ec4c439c..549e1b5e 100644 --- a/src/renderer/src/pages/game-launcher/game-launcher.scss +++ b/src/renderer/src/pages/game-launcher/game-launcher.scss @@ -12,6 +12,36 @@ position: relative; overflow: hidden; + &__background { + position: absolute; + top: -20px; + left: -20px; + right: -20px; + bottom: -20px; + background-size: cover; + background-position: center; + background-repeat: no-repeat; + filter: blur(20px); + transform: scale(1.1); + z-index: 0; + } + + &__overlay { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: linear-gradient( + 135deg, + rgba(0, 0, 0, 0.75) 0%, + rgba(0, 0, 0, 0.85) 50%, + rgba(0, 0, 0, 0.9) 100% + ); + pointer-events: none; + z-index: 1; + } + &__glow { position: absolute; top: 0; @@ -24,14 +54,14 @@ transparent 50% ); pointer-events: none; - z-index: 0; + z-index: 2; } &__logo-badge { position: absolute; top: calc(globals.$spacing-unit * 2); right: calc(globals.$spacing-unit * 2); - z-index: 3; + z-index: 10; svg { width: 28px; @@ -48,7 +78,7 @@ -webkit-app-region: no-drag; min-height: 0; position: relative; - z-index: 1; + z-index: 5; } &__cover { @@ -85,7 +115,7 @@ flex-direction: column; justify-content: center; flex: 1; - gap: calc(globals.$spacing-unit / 2); + gap: calc(globals.$spacing-unit); } &__title { @@ -167,7 +197,7 @@ display: flex; align-items: center; justify-content: center; - margin-top: calc(globals.$spacing-unit); + margin-top: calc(globals.$spacing-unit * 2); &:hover { background-color: #dadbe1; diff --git a/src/renderer/src/pages/game-launcher/game-launcher.tsx b/src/renderer/src/pages/game-launcher/game-launcher.tsx index 3d22cfff..2a9fc870 100644 --- a/src/renderer/src/pages/game-launcher/game-launcher.tsx +++ b/src/renderer/src/pages/game-launcher/game-launcher.tsx @@ -25,6 +25,7 @@ export default function GameLauncher() { const [colorExtracted, setColorExtracted] = useState(false); const [colorError, setColorError] = useState(false); const [windowShown, setWindowShown] = useState(false); + const [isMainWindowOpen, setIsMainWindowOpen] = useState(false); const formatPlayTime = useCallback( (playTimeInMilliseconds = 0) => { @@ -50,6 +51,10 @@ export default function GameLauncher() { setGameAssets(assets); }); } + + window.electron.isMainWindowOpen().then((isOpen) => { + setIsMainWindowOpen(isOpen); + }); }, [shop, objectId]); useEffect(() => { @@ -128,6 +133,13 @@ export default function GameLauncher() { return (
+ {coverImage && ( +
+ )} +
@@ -166,13 +178,15 @@ export default function GameLauncher() {

- + {!isMainWindowOpen && ( + + )}
{(playTime > 0 || achievementCount > 0) && (