#plugins.core.action.activator
This module provides provides a way of activating choices provided by action handlers. It also provide support for making a particular action a favourite, returning results based on popularity, and completely hiding particular actions, or categories of action.
Activators are accessed via the action manager like so:
local activator = actionManager.getActivator("foobar") activator:disableHandler("videoEffect") activator:show()
Any changes made to the settings of a finder (such as calling disableHandler
above) will be preserved for future loads of the finder with the same ID. They are also local to instances of this activator, so disabling "videoEffect" in the "foobar" activator will not affect the "yadayada" activator.
#API Overview
Fields - Variables which can only be accessed from an object returned by a constructor
- activeHandlers
- allowedHandlers
- configurable
- favoriteChoices
- hiddenChoices
- lastQueryRemembered
- lastQueryValue
- lastRows
- popularChoices
- query
- reducedTransparency
- searchSubText
- showHidden
Methods - API calls which can only be made on an object returned by a constructor
- activate
- activeChoices
- allChoices
- allowHandlers
- chooser
- disableAllHandlers
- disableHandler
- enableAllHandlers
- enableHandler
- enableHandlers
- favoriteChoice
- findChoice
- getActiveHandler
- getPopularity
- hide
- hideChoice
- id
- incPopularity
- isDisabledHandler
- isHiddenChoice
- isVisible
- onActivate
- preloadChoices
- refresh
- refreshChooser
- rightClickAction
- rightClickMain
- setBundleID
- show
- sortChoices
- toggle
- toolbarIcons
- unfavoriteChoice
- unhideChoice
- updateSelectedToolbarIcon
#API Documentation
#Fields
Signature | plugins.core.action.activator.activeHandlers <cp.prop: table of handlers> |
Type | Field |
Description | Contains the table of active handlers. A handler is active if it is both allowed and enabled. |
Notes | None |
Source | src/plugins/core/action/manager/activator.lua line 214 |
Signature | plugins.core.action.activator:allowedHandlers <cp.prop: table of handlers; read-only> |
Type | Field |
Description | Contains all handlers that are allowed in this activator. |
Notes | None |
Source | src/plugins/core/action/manager/activator.lua line 185 |
Signature | plugins.core.action.activator.configurable <cp.prop: boolean> |
Type | Field |
Description | If true (the default), the activator can be configured by right-clicking on the main chooser. |
Notes | None |
Source | src/plugins/core/action/manager/activator.lua line 275 |
Signature | plugins.core.action.activator.favoriteChoices <cp.prop: table of booleans> |
Type | Field |
Description | Contains the set of choice IDs which are favorites in this activator, mapped to a boolean value. |
Notes | None |
Source | src/plugins/core/action/manager/activator.lua line 257 |
Signature | plugins.core.action.activator.hiddenChoices <cp.prop: table of booleans> |
Type | Field |
Description | Contains the set of choice IDs which are hidden in this activator, mapped to a boolean value. |
Notes | None |
Source | src/plugins/core/action/manager/activator.lua line 249 |
Signature | plugins.core.action.activator.lastQueryRemembered <cp.prop: boolean> |
Type | Field |
Description | If true , remember the last query. |
Notes | None |
Source | src/plugins/core/action/manager/activator.lua line 141 |
Signature | plugins.core.action.activator.lastQueryValue <cp.prop: string> |
Type | Field |
Description | The last query value. |
Notes | None |
Source | src/plugins/core/action/manager/activator.lua line 148 |
Signature | plugins.core.action.activator.lastRows <cp.prop: number> |
Type | Field |
Description | The last width of the Search Console. Defaults to 40. |
Notes | None |
Source | src/plugins/core/action/manager/activator.lua line 162 |
Signature | plugins.core.action.activator.popularChoices <cp.prop: table of integers> |
Type | Field |
Description | Keeps track of how popular particular choices are. Returns a table of choice IDs |
Notes | None |
Source | src/plugins/core/action/manager/activator.lua line 266 |
Signature | plugins.core.action.activator.query <cp.prop: string> |
Type | Field |
Description | The current "query" value for the activator. |
Notes | None |
Source | src/plugins/core/action/manager/activator.lua line 241 |
Signature | plugins.core.action.activator.reducedTransparency <cp.prop: boolean> |
Type | Field |
Description | A property which will be true if the 'reduce transparency' mode is enabled. |
Notes | None |
Source | src/plugins/core/action/manager/activator.lua line 984 |
Signature | plugins.core.action.activator.searchSubText <cp.prop: boolean> |
Type | Field |
Description | If true , allow users to search the subtext value. |
Notes | None |
Source | src/plugins/core/action/manager/activator.lua line 134 |
Signature | plugins.core.action.activator.showHidden <cp.prop: boolean> |
Type | Field |
Description | If true , hidden items are shown. |
Notes | None |
Source | src/plugins/core/action/manager/activator.lua line 169 |
#Methods
Signature | plugins.core.action.activator:activate(result) -> none |
Type | Method |
Description | Triggered when the chooser is closed. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 1518 |
Signature | plugins.core.action.activator:activeChoices() -> table |
Type | Method |
Description | Returns a table with active choices. If a query is set, only choices containing the provided substring are returned. If showHidden is set to true hidden items are returned, otherwise they are not. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 815 |
Signature | plugins.core.action.activator:allChoices() -> table |
Type | Method |
Description | Returns a table of all available choices, even if hidden. Choices from disabled action handlers are not included. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 799 |
Signature | plugins.core.action.activator:allowHandlers(...) -> self |
Type | Method |
Description | Specifies that only the handlers with the specified IDs will be active in this activator. By default all handlers are allowed. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 326 |
Signature | plugins.core.action.activator:chooser() -> hs.chooser object |
Type | Method |
Description | Gets a hs.chooser |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 1069 |
Signature | plugins.core.action.activator:disableAllHandlers([groupID]) -> none |
Type | Method |
Description | Disables the all allowed handlers. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 455 |
Signature | plugins.core.action.activator:disableHandler(id) -> boolean |
Type | Method |
Description | Disables the handler with the specified ID. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 363 |
Signature | plugins.core.action.activator:enableAllHandlers([groupID]) -> none |
Type | Method |
Description | Enables the all allowed handlers. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 428 |
Signature | plugins.core.action.activator:enableHandler(id) -> boolean |
Type | Method |
Description | Enables the handler with the specified ID. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 383 |
Signature | plugins.core.action.activator:enableHandlers(groupID) -> none |
Type | Method |
Description | Enables the all allowed handlers of a specific group, and disables the everything else. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 403 |
Signature | plugins.core.action.activator:favoriteChoice(id) -> boolean |
Type | Method |
Description | Marks the choice with the specified ID as a favorite. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 601 |
Signature | plugins.core.action.activator:findChoice(id) -> choice |
Type | Method |
Description | Gets a choice |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 500 |
Signature | plugins.core.action.activator:getActiveHandler(id) -> handler |
Type | Method |
Description | Returns the active handler with the specified ID, or nil if not available. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 313 |
Signature | plugins.core.action.activator:getPopularity(id) -> boolean |
Type | Method |
Description | Returns the popularity of the specified choice. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 652 |
Signature | plugins.core.action.activator:hide() -> none |
Type | Method |
Description | Hides a chooser listing the available actions. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 1432 |
Signature | plugins.core.action.activator:hideChoice(id) -> boolean |
Type | Method |
Description | Hides the choice with the specified ID. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 518 |
Signature | plugins.core.action.activator:id() -> string |
Type | Method |
Description | Returns the activator's unique ID. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 300 |
Signature | plugins.core.action.activator:incPopularity(choice, id) -> boolean |
Type | Method |
Description | Increases the popularity of the specified choice. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 669 |
Signature | plugins.core.action.activator:isDisabledHandler(id) -> boolean |
Type | Method |
Description | Returns true if the specified handler is disabled. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 486 |
Signature | plugins.core.action.activator:isHiddenChoice(id) -> boolean |
Type | Method |
Description | Checks if the specified choice is hidden. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 587 |
Signature | plugins.core.action.activator:isVisible() -> boolean |
Type | Method |
Description | Checks if the chooser is currently displayed. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 1329 |
Signature | plugins.core.action.activator:onActivate(activateFn) -> activator |
Type | Method |
Description | Registers the provided function to handle 'activate' actions, when the user selects an item in the main chooser. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 1477 |
Signature | plugins.core.action.activator:preloadChoices([afterSeconds]) -> activator |
Type | Method |
Description | Indicates the activator should preload the choices after a number of seconds. Defaults to 0 seconds if no value is provided. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 282 |
Signature | plugins.core.action.activator:refresh() -> none |
Type | Method |
Description | Clears the existing set of choices and requests new ones from enabled action handlers. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 971 |
Signature | plugins.core.action.activator:refreshChooser() -> none |
Type | Method |
Description | Refreshes a Chooser. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 1310 |
Signature | plugins.core.action.activator:rightClickAction(index) -> none |
Type | Method |
Description | Triggered when a user right clicks on a chooser. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 1560 |
Signature | plugins.core.action.activator:rightClickMain(index) -> none |
Type | Method |
Description | Triggered when a user right clicks on a chooser. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 1547 |
Signature | plugins.core.action.activator:setBundleID(bundleID, icon, displayName) -> self |
Type | Method |
Description | Sets a bundle ID to use for filtering purposes. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 109 |
Signature | plugins.core.action.activator:show() -> boolean |
Type | Method |
Description | Shows a chooser listing the available actions. When selected by the user, the onActivate function is called. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 1348 |
Signature | plugins.core.action.activator:sortChoices() -> boolean |
Type | Method |
Description | Sorts the current set of choices in the activator. It takes into account whether it's a favorite (first priority) and its overall popularity. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 783 |
Signature | plugins.core.action.activator:toggle() -> none |
Type | Method |
Description | Shows or hides the chooser. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 1460 |
Signature | plugins.core.action.activator:toolbarIcons(table) -> self |
Type | Method |
Description | Sets which sections have an icon on the toolbar. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 348 |
Signature | plugins.core.action.activator:unfavoriteChoice(id) -> boolean |
Type | Method |
Description | Marks the choice with the specified ID as not a favorite. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 627 |
Signature | plugins.core.action.activator:unhideChoice(id) -> boolean |
Type | Method |
Description | Reveals the choice with the specified ID. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 547 |
Signature | plugins.core.action.activator:updateSelectedToolbarIcon() -> none |
Type | Method |
Description | Updates the selected toolbar icon. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/plugins/core/action/manager/activator.lua line 991 |