Skip to content

Commit 4c07157

Browse files
Support additional gamescope options (#3476)
* Support additional gamescope options * review comments * switch back to onChange * fix * fix lint
1 parent cc14ab9 commit 4c07157

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

public/locales/en/translation.json

+2
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@
320320
},
321321
"gamemode": "Feral GameMode applies automatic and temporary tweaks to the system when running games. Enabling may improve performance.",
322322
"gamescope": {
323+
"additionalOptions": "Additional commandline flags to pass into gamescope.",
323324
"fpsLimiter": "The amount of frames gamescope should limit to. E.g. 60",
324325
"fpsLimiterNoFocus": "The frame rate limit gamescope should limit per second if the game is not focused.",
325326
"gameHeight": "The height resolution used by the game. A 16:9 aspect ratio is assumed by gamescope.",
@@ -502,6 +503,7 @@
502503
"title": "Game Arguments (To run after the command):"
503504
},
504505
"gamescope": {
506+
"additionalOptions": "Additional Options",
505507
"borderless": "Borderless",
506508
"fpsLimiter": "FPS Limiter",
507509
"fpsLimiterNoFocus": "FPS Limiter (No Focus)",

src/backend/launcher.ts

+4
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ async function prepareLaunch(
214214
}
215215
}
216216

217+
gameScopeCommand.push(
218+
...shlex.split(gameSettings.gamescope.additionalOptions ?? '')
219+
)
220+
217221
// Note: needs to be the last option
218222
gameScopeCommand.push('--')
219223
}

src/common/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ interface GameScopeSettings {
751751
upscaleMethod: string
752752
fpsLimiter: string
753753
fpsLimiterNoFocus: string
754+
additionalOptions: string
754755
}
755756

756757
export type InstallInfo =

src/frontend/screens/Settings/components/Gamescope.tsx

+32-1
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@ const Gamescope = () => {
2525
upscaleWidth: '',
2626
upscaleMethod: 'fsr',
2727
fpsLimiter: '',
28-
fpsLimiterNoFocus: ''
28+
fpsLimiterNoFocus: '',
29+
additionalOptions: ''
2930
})
3031
const [fetching, setFetching] = useState(true)
3132
const [isInstalled, setIsInstalled] = useState(false)
3233

34+
const [additionalOptions, setAdditionalOptions] = useState(
35+
gamescope.additionalOptions
36+
)
37+
3338
useEffect(() => {
3439
setFetching(true)
3540
window.api
@@ -356,6 +361,32 @@ const Gamescope = () => {
356361
/>
357362
</div>
358363
)}
364+
{/* Additional Options */}
365+
<TextInputField
366+
label={t('options.gamescope.additionalOptions', 'Additional Options')}
367+
htmlId="additionalOptions"
368+
placeholder=""
369+
value={additionalOptions}
370+
afterInput={
371+
<FontAwesomeIcon
372+
className="helpIcon"
373+
icon={faCircleInfo}
374+
title={t(
375+
'help.gamescope.additionalOptions',
376+
'Additional commandline flags to pass into gamescope.'
377+
)}
378+
/>
379+
}
380+
onChange={(event: ChangeEvent<HTMLInputElement>) => {
381+
setAdditionalOptions(event.currentTarget.value)
382+
}}
383+
onBlur={(event: ChangeEvent<HTMLInputElement>) =>
384+
setGamescope({
385+
...gamescope,
386+
additionalOptions: event.currentTarget.value
387+
})
388+
}
389+
/>
359390
</div>
360391
)
361392
}

0 commit comments

Comments
 (0)