Small macOS fixes

This commit is contained in:
crschnick 2023-06-22 17:49:39 +00:00
parent 8261f6f7ec
commit a2364d6f47
3 changed files with 14 additions and 1 deletions

View file

@ -34,7 +34,7 @@ public class App extends Application {
// Set dock icon explicitly on mac
// This is necessary in case XPipe was started through a script as it will have no icon otherwise
if (OsType.getLocal().equals(OsType.MACOS) && AppProperties.get().isDeveloperMode() && !AppLogs.get().isWriteToFile()) {
if (OsType.getLocal().equals(OsType.MACOS) && AppProperties.get().isDeveloperMode() && AppLogs.get().isWriteToSysout()) {
try {
var iconUrl = Main.class.getResourceAsStream("resources/img/logo/logo_128x128.png");
if (iconUrl != null) {

View file

@ -43,6 +43,8 @@ public class AppLogs {
private final PrintStream originalSysOut;
private final PrintStream originalSysErr;
private final Path logDir;
@Getter
private final boolean writeToSysout;
@Getter

View file

@ -17,11 +17,22 @@ public class MacOsPermissions {
var state = new SimpleBooleanProperty(true);
try (var pc = LocalStore.getShell().start()) {
while (state.get()) {
// We can't wait in the platform thread, so just return instantly
if (Platform.isFxApplicationThread()) {
pc.osascriptCommand(
"""
tell application "System Events" to keystroke "t"
""")
.execute();
return true;
}
var success = pc.osascriptCommand(
"""
tell application "System Events" to keystroke "t"
""")
.executeAndCheck();
if (success) {
Platform.runLater(() -> {
if (alert.get() != null) {