MacOS permission fixes

This commit is contained in:
crschnick 2023-02-12 20:15:34 +00:00
parent a4b3729896
commit 642d5c44ec

View file

@ -1,13 +1,20 @@
package io.xpipe.app.util;
import io.xpipe.core.store.ShellStore;
import io.xpipe.extension.util.ThreadHelper;
public class MacOsPermissions {
public static boolean waitFor() throws Exception {
public static boolean waitForAccessibilityPermissions() throws Exception {
try (var pc = ShellStore.local().create().start()) {
pc.executeSimpleCommand("tell application \"System Events\" to keystroke \"t\"");
while (true) {
var success = pc.executeBooleanSimpleCommand("osascript -e 'tell application \"System Events\" to keystroke \"t\"'");
if (success) {
return true;
}
ThreadHelper.sleep(1000);
}
}
return true;
}
}