MacOS permission fixes

This commit is contained in:
crschnick 2023-02-12 20:15:34 +00:00
parent 675cd69332
commit b851c1da11
3 changed files with 12 additions and 5 deletions

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;
}
}

View file

@ -224,7 +224,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
@Override
public void launch(String name, String command) throws Exception {
MacOsPermissions.waitFor();
MacOsPermissions.waitForAccessibilityPermissions();
try (ShellProcessControl pc = ShellStore.local().create().start()) {
var cmd = String.format(

View file

@ -90,7 +90,7 @@ key=Key
installConnector=Install Connector
konsole=Konsole
xfce=Xfce
macosTerminal=Terminal
macosTerminal=Terminal.app
iterm2=iTerm2
warp=Warp
custom=Custom