Skip to content

Commit

Permalink
ignore fullscreen if no-gui (#1596)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nocccer authored Jul 20, 2022
1 parent c3b1c9a commit 3608cc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion electron/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const isMac = platform() === 'darwin'
const isWindows = platform() === 'win32'
const isLinux = platform() === 'linux'
const isSteamDeckGameMode = process.env.XDG_CURRENT_DESKTOP === 'gamescope'
const isCLINoGui = process.argv.includes('--no-gui')
const isFlatpak = Boolean(env.FLATPAK_ID)
const currentGameConfigVersion: GameConfigVersion = 'v0'
const currentGlobalConfigVersion: GlobalConfigVersion = 'v0'
Expand Down Expand Up @@ -214,5 +215,6 @@ export {
tsStore,
fontsStore,
isSteamDeckGameMode,
runtimePath
runtimePath,
isCLINoGui
}
9 changes: 5 additions & 4 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ import {
fontsStore,
heroicConfigPath,
isMac,
isSteamDeckGameMode
isSteamDeckGameMode,
isCLINoGui
} from './constants'
import { handleProtocol } from './protocol'
import { logError, logInfo, LogPrefix, logWarning } from './logger/logger'
Expand Down Expand Up @@ -154,7 +155,7 @@ async function createWindow(): Promise<BrowserWindow> {
}
})

if (isSteamDeckGameMode) {
if (isSteamDeckGameMode && !isCLINoGui) {
logInfo(
'Heroic started via Steam-Deck gamemode. Switching to fullscreen',
LogPrefix.Backend
Expand Down Expand Up @@ -394,7 +395,7 @@ if (!gotTheLock) {
}

const { startInTray } = await GlobalConfig.get().getSettings()
const headless = process.argv.includes('--no-gui') || startInTray
const headless = isCLINoGui || startInTray
if (!headless) {
mainWindow.show()
}
Expand Down Expand Up @@ -948,7 +949,7 @@ ipcMain.handle(
})

// Exit if we've been launched without UI
if (process.argv.includes('--no-gui')) {
if (isCLINoGui) {
app.exit()
}
})
Expand Down

0 comments on commit 3608cc1

Please sign in to comment.