Scopes
A scope encapsulates the concept of commands or command extensions only applying in certain scenarios such as when a certain application is active, or an arbitrary function evaluates to true
Registering a scope
The following registers and returns a Scope
instance:
Scope.register({
name: 'my-custom-scope',
// list of bundle ids(darwin)
applications: ['bundle.id'],
// or a single application
application: 'bundle.id',
// and/or condition(s)
conditions: function(input, context) {return true}
condition: function(input, context) {return true}
})
Check if scope is active
Scope.active('my-custom-scope') => Boolean
Scope.active({scope: 'my-custom-scope'}) => Boolean
Scope.active({something: 'irrelevant'}) => true
Scope.active(false) => true
Determine bundle id using commandline
osascript -e 'id of app "Eclipse"'