Closed gingerbeardman closed 3 months ago
Improved in https://github.com/gingerbeardman/stapler/commit/04398d830999ab03d37ac0430f6c9a5c20ee7030 for 1.2
This is still somewhat undesirable, as it has the side-effect of the items not launching if the app is already active when the document is opened.
Small change: https://github.com/gingerbeardman/stapler/commit/feaa002287e82e1d13f4cc4aac7ef4a35030c9c4
Will live with this for a while.
Reworked in and around commit https://github.com/gingerbeardman/stapler/commit/9fad23ce1ce9680f99ec9e1063e014b6a9a4d9db to check for the following scenarios:
// Define an enum for the different document opening scenarios
enum DocumentOpeningScenario {
case launchedWithDocument
case resumedBySystem
case openedThroughFileMenu
case openedFromFinderWhileRunning
case unknown
}
// ...lots more code
Currently the code to figure out whether the Stapler Document was opened from Finder is not really very good.
Basically, we're checking if the app is activated. That works, because the app does get activated when coming from Finder, but there are other ways the Document can be opened that result in the app being Activated.
So, we need to find a better way to do this. I ran out of time at this point.