open every permission pane the app needs

This commit is contained in:
bea
2026-09-29 12:20:15 +02:00
parent ca99bc0533
commit e65adc314c
2 changed files with 22 additions and 17 deletions
+1 -1
View File
@@ -32,7 +32,7 @@
**macos .app bundle** **macos .app bundle**
- on macos, run `mvn clean package -Pmac-app`: you will find `autosqueal.app` in `target/jpackage/`. - on macos, run `mvn clean package -Pmac-app`: you will find `autosqueal.app` in `target/jpackage/`.
- the first time you run it, grant it the accessibility and screen recording permissions in system settings, like any other java app. - the first time you run it, grant it the device control and data access permission (called "accessibility" on older macos versions) and the screen recording one, in system settings, like any other java app.
## support ## support
| category | info | | category | info |
@@ -176,23 +176,26 @@ public class MainWindow
} }
/** /**
* Explains that the app cannot work without its permissions, and offers * Explains which permissions the app needs and offers to open each pane.
* a shortcut to the right system settings pane. the hook is retried on * the hook is retried on demand, so the app can start working without a
* demand, so the app can start working without a restart. must be called * restart. must be called on the EDT, after the window is visible.
* on the EDT, after the window is visible.
*/ */
public void showPermissionsHelp() { public void showPermissionsHelp() {
Object[] options = {"Open System Settings", "Try Again", "Close"}; Object[] options = {"Open Device Control Settings", "Open Screen Recording Settings", "Try Again", "Close"};
while (true) { while (true) {
int choice = JOptionPane.showOptionDialog(frame, int choice = JOptionPane.showOptionDialog(frame,
"autosqueal needs the accessibility permission to move the mouse and to\n" "autosqueal needs three separate permissions to work:\n\n"
+ "listen for the ctrl+alt hotkey, and the screen recording one to\n" + "1. device control and data access — called \"accessibility\" on older macos\n"
+ "show the screen preview.\n\n" + " versions — lets the app listen for the ctrl+alt hotkey.\n"
+ "grant them in privacy & security, then press \"try again\".\n" + " if the pane shows a separate \"events\" switch for autosqueal, turn\n"
+ "if autosqueal already appears in the list, remove it with the\n" + " that on too: it is what lets the app move the mouse and click.\n\n"
+ "minus button and allow it again: every rebuild looks like a\n" + "2. screen recording — lets the app take the screenshot shown\n"
+ "different app to the system.", + " in the main window.\n\n"
+ "open each pane, unlock it, and make sure autosqueal is listed and switched on.\n"
+ "if it is already listed, remove it with the minus button and re-add it:\n"
+ "every rebuild looks like a different app to the system.\n"
+ "when you are done, press \"try again\".",
"permissions needed", "permissions needed",
JOptionPane.DEFAULT_OPTION, JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE, JOptionPane.WARNING_MESSAGE,
@@ -201,8 +204,10 @@ public class MainWindow
options[0]); options[0]);
if (choice == 0) { if (choice == 0) {
openPrivacySettings(); openPrivacyPane("Privacy_Accessibility");
} else if (choice == 1) { } else if (choice == 1) {
openPrivacyPane("Privacy_ScreenCapture");
} else if (choice == 2) {
if (Main.registerJNativeHook()) { if (Main.registerJNativeHook()) {
LOGGER.info("The native hook was registered on a later attempt!"); LOGGER.info("The native hook was registered on a later attempt!");
return; return;
@@ -215,15 +220,15 @@ public class MainWindow
} }
} }
/** Opens the privacy & security pane at the accessibility section. */ /** Opens the privacy & security pane for the given anchor. */
private void openPrivacySettings() { private void openPrivacyPane(String privacyAnchor) {
if (SystemUtil.getHostSystem() != SystemUtil.OperatingSystem.MAC_OS) { if (SystemUtil.getHostSystem() != SystemUtil.OperatingSystem.MAC_OS) {
return; return;
} }
try { try {
new ProcessBuilder("open", new ProcessBuilder("open",
"x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility") "x-apple.systempreferences:com.apple.preference.security?" + privacyAnchor)
.start(); .start();
} catch (IOException ex) { } catch (IOException ex) {
LOGGER.error("Could not open the system settings", ex); LOGGER.error("Could not open the system settings", ex);