Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I ask to immediately open the app after the installation then it makes several windows of other hidden apps visible again. #102

Open
shannah opened this issue Mar 20, 2023 · 2 comments

Comments

@shannah
Copy link
Owner

shannah commented Mar 20, 2023

No description provided.

@shannah
Copy link
Owner Author

shannah commented Mar 20, 2023

Strange. Here is the relevant code:

Runtime.getRuntime().exec(new String[]{"open", installedApp.getAbsolutePath()});

Really not much going on here. Not sure why calling open would open hidden apps.

@shannah
Copy link
Owner Author

shannah commented Mar 26, 2023

I am able to reproduce this. It is caused by the "Add to dock" step, which needs to quit and reactivate the dock:

String[] commands = new String[]{
                        "/usr/bin/defaults write com.apple.dock persistent-apps -array-add \"<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>"+myapp+"</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>\"",
                        "/usr/bin/osascript -e 'tell application \"Dock\" to quit'",
                        "/usr/bin/osascript -e 'tell application \"Dock\" to activate'"

                };

NOTE: This doesn't affect apps that had been hidden using "Hide application / Command-H". Just windows that had been minimized onto the dock.

It uses the strategy described here

I don't know of a way to improve on this currently. Found this tool for adding/removing items from the dock using command-line: https://github.com/kcrawford/dockutil

It looks like it still "restarts" the dock after adding items, but it is possible that it found a way to retain or restore transient state like minimized windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant