#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

Methods - API calls which can only be made on an object returned by a constructor


#API Documentation

#Fields

Signatureplugins.core.action.activator.activeHandlers <cp.prop: table of handlers>
TypeField
DescriptionContains the table of active handlers. A handler is active if it is both allowed and enabled.
NotesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 214

Signatureplugins.core.action.activator:allowedHandlers <cp.prop: table of handlers; read-only>
TypeField
DescriptionContains all handlers that are allowed in this activator.
NotesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 185

Signatureplugins.core.action.activator.configurable <cp.prop: boolean>
TypeField
DescriptionIf true (the default), the activator can be configured by right-clicking on the main chooser.
NotesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 275

Signatureplugins.core.action.activator.favoriteChoices <cp.prop: table of booleans>
TypeField
DescriptionContains the set of choice IDs which are favorites in this activator, mapped to a boolean value.
NotesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 257

Signatureplugins.core.action.activator.hiddenChoices <cp.prop: table of booleans>
TypeField
DescriptionContains the set of choice IDs which are hidden in this activator, mapped to a boolean value.
NotesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 249

Signatureplugins.core.action.activator.lastQueryRemembered <cp.prop: boolean>
TypeField
DescriptionIf true, remember the last query.
NotesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 141

Signatureplugins.core.action.activator.lastQueryValue <cp.prop: string>
TypeField
DescriptionThe last query value.
NotesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 148

Signatureplugins.core.action.activator.lastRows <cp.prop: number>
TypeField
DescriptionThe last width of the Search Console. Defaults to 40.
NotesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 162

Signatureplugins.core.action.activator.popularChoices <cp.prop: table of integers>
TypeField
DescriptionKeeps track of how popular particular choices are. Returns a table of choice IDs
NotesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 266

Signatureplugins.core.action.activator.query <cp.prop: string>
TypeField
DescriptionThe current "query" value for the activator.
NotesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 241

Signatureplugins.core.action.activator.reducedTransparency <cp.prop: boolean>
TypeField
DescriptionA property which will be true if the 'reduce transparency' mode is enabled.
NotesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 984

Signatureplugins.core.action.activator.searchSubText <cp.prop: boolean>
TypeField
DescriptionIf true, allow users to search the subtext value.
NotesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 134

Signatureplugins.core.action.activator.showHidden <cp.prop: boolean>
TypeField
DescriptionIf true, hidden items are shown.
NotesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 169

#Methods

Signatureplugins.core.action.activator:activate(result) -> none
TypeMethod
DescriptionTriggered when the chooser is closed.
Parameters
  • result - The result from the chooser.
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 1518

Signatureplugins.core.action.activator:activeChoices() -> table
TypeMethod
DescriptionReturns 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
  • None
Returns
  • Table of choices that can be displayed by an hs.chooser.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 815

Signatureplugins.core.action.activator:allChoices() -> table
TypeMethod
DescriptionReturns a table of all available choices, even if hidden. Choices from disabled action handlers are not included.
Parameters
  • None
Returns
  • Table of choices that can be displayed by an hs.chooser.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 799

Signatureplugins.core.action.activator:allowHandlers(...) -> self
TypeMethod
DescriptionSpecifies that only the handlers with the specified IDs will be active in this activator. By default all handlers are allowed.
Parameters
  • ... - The list of Handler ID strings to allow.
Returns
  • Self
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 326

Signatureplugins.core.action.activator:chooser() -> hs.chooser object
TypeMethod
DescriptionGets a hs.chooser
Parameters
  • None
Returns
  • A hs.chooser object
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 1069

Signatureplugins.core.action.activator:disableAllHandlers([groupID]) -> none
TypeMethod
DescriptionDisables the all allowed handlers.
Parameters
  • groupID - An optional group ID to only disable all handlers of a specific group
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 455

Signatureplugins.core.action.activator:disableHandler(id) -> boolean
TypeMethod
DescriptionDisables the handler with the specified ID.
Parameters
  • id - The unique action handler ID.
Returns
  • true if the handler exists and was disabled.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 363

Signatureplugins.core.action.activator:enableAllHandlers([groupID]) -> none
TypeMethod
DescriptionEnables the all allowed handlers.
Parameters
  • groupID - An optional group ID to only enable all handlers of a specific group
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 428

Signatureplugins.core.action.activator:enableHandler(id) -> boolean
TypeMethod
DescriptionEnables the handler with the specified ID.
Parameters
  • id - The unique action handler ID.
Returns
  • true if the handler exists and was enabled.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 383

Signatureplugins.core.action.activator:enableHandlers(groupID) -> none
TypeMethod
DescriptionEnables the all allowed handlers of a specific group, and disables the everything else.
Parameters
  • groupID - The group ID to enable
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 403

Signatureplugins.core.action.activator:favoriteChoice(id) -> boolean
TypeMethod
DescriptionMarks the choice with the specified ID as a favorite.
Parameters
  • id - The choice ID to favorite.
Returns
  • true if successfully favorited otherwise false.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 601

Signatureplugins.core.action.activator:findChoice(id) -> choice
TypeMethod
DescriptionGets a choice
Parameters
  • id - The choice ID.
Returns
  • The choice or nil if not found
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 500

Signatureplugins.core.action.activator:getActiveHandler(id) -> handler
TypeMethod
DescriptionReturns the active handler with the specified ID, or nil if not available.
Parameters
  • id - The Handler ID
Returns
  • The action handler, or nil.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 313

Signatureplugins.core.action.activator:getPopularity(id) -> boolean
TypeMethod
DescriptionReturns the popularity of the specified choice.
Parameters
  • id - The choice ID to retrieve.
Returns
  • The number of times the choice has been executed.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 652

Signatureplugins.core.action.activator:hide() -> none
TypeMethod
DescriptionHides a chooser listing the available actions.
Parameters
  • None
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 1432

Signatureplugins.core.action.activator:hideChoice(id) -> boolean
TypeMethod
DescriptionHides the choice with the specified ID.
Parameters
  • id - The choice ID to hide.
Returns
  • true if successfully hidden otherwise false.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 518

Signatureplugins.core.action.activator:id() -> string
TypeMethod
DescriptionReturns the activator's unique ID.
Parameters
  • None
Returns
  • The activator ID.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 300

Signatureplugins.core.action.activator:incPopularity(choice, id) -> boolean
TypeMethod
DescriptionIncreases the popularity of the specified choice.
Parameters
  • choice - The choice.
  • id - The choice ID to popularise.
Returns
  • true if successfully unfavourited, otherwise false.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 669

Signatureplugins.core.action.activator:isDisabledHandler(id) -> boolean
TypeMethod
DescriptionReturns true if the specified handler is disabled.
Parameters
  • id - The handler ID.
Returns
  • true if the handler is disabled.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 486

Signatureplugins.core.action.activator:isHiddenChoice(id) -> boolean
TypeMethod
DescriptionChecks if the specified choice is hidden.
Parameters
  • id - The choice ID to check.
Returns
  • true if currently hidden.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 587

Signatureplugins.core.action.activator:isVisible() -> boolean
TypeMethod
DescriptionChecks if the chooser is currently displayed.
Parameters
  • None
Returns
  • A boolean, true if the chooser is displayed on screen, false if not.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 1329

Signatureplugins.core.action.activator:onActivate(activateFn) -> activator
TypeMethod
DescriptionRegisters the provided function to handle 'activate' actions, when the user selects an item in the main chooser.
Parameters
  • activateFn - The function to call when an item is activated.
Returns
  • The activator.
Notes
  • By default, the activator will 'execute' the action, but you can choose to provide an alternative action. It will get passed the handler object and the action table. Eg:
  • lua</li><li>activator:onActivate(function(handler, action))</li><li>
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 1477

Signatureplugins.core.action.activator:preloadChoices([afterSeconds]) -> activator
TypeMethod
DescriptionIndicates the activator should preload the choices after a number of seconds. Defaults to 0 seconds if no value is provided.
Parameters
  • afterSeconds - The number of seconds to wait before preloading.
Returns
  • The activator.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 282

Signatureplugins.core.action.activator:refresh() -> none
TypeMethod
DescriptionClears the existing set of choices and requests new ones from enabled action handlers.
Parameters
  • None
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 971

Signatureplugins.core.action.activator:refreshChooser() -> none
TypeMethod
DescriptionRefreshes a Chooser.
Parameters
  • None
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 1310

Signatureplugins.core.action.activator:rightClickAction(index) -> none
TypeMethod
DescriptionTriggered when a user right clicks on a chooser.
Parameters
  • index - The row the right click occurred in or 0 if there is currently no selectable row where the right click occurred.
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 1560

Signatureplugins.core.action.activator:rightClickMain(index) -> none
TypeMethod
DescriptionTriggered when a user right clicks on a chooser.
Parameters
  • index - The row the right click occurred in or 0 if there is currently no selectable row where the right click occurred.
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 1547

Signatureplugins.core.action.activator:setBundleID(bundleID, icon, displayName) -> self
TypeMethod
DescriptionSets a bundle ID to use for filtering purposes.
Parameters
  • bundleID - An application bundle ID as string.
  • icon - An application icon as an hs.image object.
  • displayName - The application display name as a string.
Returns
  • Self
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 109

Signatureplugins.core.action.activator:show() -> boolean
TypeMethod
DescriptionShows a chooser listing the available actions. When selected by the user, the onActivate function is called.
Parameters
  • None
Returns
  • true if successful
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 1348

Signatureplugins.core.action.activator:sortChoices() -> boolean
TypeMethod
DescriptionSorts the current set of choices in the activator. It takes into account whether it's a favorite (first priority) and its overall popularity.
Parameters
  • None
Returns
  • true if the action executed successfully, otherwise false.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 783

Signatureplugins.core.action.activator:toggle() -> none
TypeMethod
DescriptionShows or hides the chooser.
Parameters
  • None
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 1460

Signatureplugins.core.action.activator:toolbarIcons(table) -> self
TypeMethod
DescriptionSets which sections have an icon on the toolbar.
Parameters
  • table - A table containing paths to all the toolbar icons. The key should be the handler ID, and the value should be the path to the icon.
Returns
  • Self
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 348

Signatureplugins.core.action.activator:unfavoriteChoice(id) -> boolean
TypeMethod
DescriptionMarks the choice with the specified ID as not a favorite.
Parameters
  • id - The choice ID to unfavorite.
Returns
  • true if successfully unfavorited.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 627

Signatureplugins.core.action.activator:unhideChoice(id) -> boolean
TypeMethod
DescriptionReveals the choice with the specified ID.
Parameters
  • id - The choice ID to hide.
Returns
  • true if successfully unhidden otherwise false.
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 547

Signatureplugins.core.action.activator:updateSelectedToolbarIcon() -> none
TypeMethod
DescriptionUpdates the selected toolbar icon.
Parameters
  • None
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/plugins/core/action/manager/activator.lua line 991