My high-level goal is to add support for Game Mode in a Java game, which launches via a macOS "launcher" app that runs the actual java
game as a separate process (e.g. using the java
command line tool).
I asked this over in the Graphics & Games section and was told this, which is why I'm reposting this here.
I'm uncertain how to speak to CLI tools and Java games launched from a macOS app. These sound like security and sandboxing questions which we recommend you ask about in those sections of the forums.
The system seems to decide whether to enable Game Mode based on values in the Info.plist (e.g. for LSApplicationCategoryType
and GCSupportsGameMode
). However, the child process can't seem to see these values. Is there a way to change that?
(The rest of this post is copied from my other forums post to provide additional context.)
Imagine a native macOS app that acts as a "launcher" for a Java game.** For example, the "launcher" app might use the Swift Process API or a similar method to run the java command line tool (lets assume the user has installed Java themselves) to run the game.
I have seen How to Enable Game Mode. If the native launcher app's Info.plist has the following keys set:
LSApplicationCategoryType
set topublic.app-category.games
LSSupportsGameMode
set totrue
(for macOS 26+)GCSupportsGameMode
set totrue
The launcher itself can cause Game Mode to activate if the launcher is fullscreened. However, if the launcher opens a Java process that opens a window, then the Java window is fullscreened, Game Mode doesn't seem to activate. In this case activating Game Mode for the launcher itself is unnecessary, but you'd expect Game Mode to activate when the actual game in the Java window is fullscreened.
Is there a way to get Game Mode to activate in the latter case?
** The concrete case I'm thinking of is a third-party Minecraft Java Edition launcher, but the issue can also be demonstrated in a sample project (FB13786152). It seems like the official Minecraft launcher is able to do this, though it's not clear how. (Is its bundle identifier hardcoded in the OS to allow for this? Changing a sample app's bundle identifier to be the same as the official Minecraft launcher gets the behavior I want, but obviously this is not a practical solution.)
No.
Info.plist
properties are set in one of two ways:
-
If the code is bundled, there’s an
Info.plist
file in that bundle. -
For a standalone executable, you can embed an
Info.plist
in the__TEXT
/__info_plist
section of the executable.
Unlike entitlements, these properties are not directly tied to the process. Rather, some code in the system has to consult the properties. This is common done from within the process — code in a system framework gets the current processe’s bundle and fetches properties from that — but it can also be done from outside.
Given that design, there’s no inheritance. If you want something to be effective, you have set it on that program’s Info.plist
. And that makes the Java thing tricky because you don’t control it’s Info.plist
.
Having said that, Java isn’t built in to the system, so you could potentially build your own copy with a custom Info.plist
that has these properties set.
However, it’s hard to say whether that’ll actually achieve your final goal because it’s gonna depend on exactly how the relevant frameworks are checking for these properties. And I don’t have enough expertise in this properties to offer an opinion as to whether that’s likely to work or not.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"