diff --git a/electron/gameWindow.js b/electron/gameWindow.js index 71854def6..39fdaea0e 100644 --- a/electron/gameWindow.js +++ b/electron/gameWindow.js @@ -32,6 +32,8 @@ async function createWindow(killall) { // and open every other protocols on the browser e.preventDefault(); shell.openExternal(url); + + global.app_playerOpenedExternalLink = true; }); window.webContents.backgroundThrottling = false; diff --git a/electron/main.js b/electron/main.js index b1f95e6bd..489f5b078 100644 --- a/electron/main.js +++ b/electron/main.js @@ -1,6 +1,6 @@ /* eslint-disable no-process-exit */ /* eslint-disable @typescript-eslint/no-var-requires */ -const { app } = require("electron"); +const { app, dialog } = require("electron"); const log = require("electron-log"); const greenworks = require("./greenworks"); const api = require("./api-server"); @@ -32,6 +32,18 @@ function setStopProcessHandler(app, window, enabled) { // Shutdown the http server api.disable(); + // Because of a steam limitation, if the player has launched an external browser, + // steam will keep displaying the game as "Running" in their UI as long as the browser is up. + // So we'll alert the player to close their browser. + if (global.app_playerOpenedExternalLink) { + await dialog.showMessageBox({ + title: 'Bitburner', + message: 'You may have to close your browser to properly exit the game.', + detail: 'Steam will keep tracking Bitburner as "Running" if any process started within the game is still running.' + + ' This includes launching an external link, which opens up your browser.', + type: 'warning', buttons: ['OK'] + }); + } // We'll try to execute javascript on the page to see if we're stuck let canRunJS = false; window.webContents.executeJavaScript('window.stop(); document.close()', true)