activator

Last updated 9 months ago

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

API Documentation

Fields

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.

Methods

activate

Signature

plugins.core.action.activator:activate(result) -> none

Type

Method

Description

Triggered when the chooser is closed.

Parameters

Returns

Signature

plugins.core.action.activator:activeChoices() -> table

Type

Method

Description

Returns a table with active choices. If showHidden is set to true hidden

Parameters

Returns

Signature

plugins.core.action.activator:allChoices() -> table

Type

Method

Description

Returns a table of all available choices, even if hidden. Choices from

Parameters

Returns

Signature

plugins.core.action.activator:allowHandlers(...) -> boolean

Type

Method

Description

Specifies that only the handlers with the specified IDs will be active in

Parameters

Returns

Signature

plugins.core.action.activator:disableAllHandlers() -> nothing

Type

Method

Description

Disables the all allowed handlers.

Parameters

Returns

Signature

plugins.core.action.activator:disableHandler(id) -> boolean

Type

Method

Description

Disables the handler with the specified ID.

Parameters

Returns

Signature

plugins.core.action.activator:enableAllHandlers() -> nothing

Type

Method

Description

Enables the all allowed handlers.

Parameters

Returns

Signature

plugins.core.action.activator:enableHandler(id) -> boolean

Type

Method

Description

Enables the handler with the specified ID.

Parameters

Returns

Signature

plugins.core.action.activator:favoriteChoice(id) -> boolean

Type

Method

Description

Marks the choice with the specified ID as a favorite.

Parameters

Returns

Signature

plugins.core.action.activator:findChoice(id) -> choice

Type

Method

Description

Gets a choice

Parameters

Returns

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

Signature

plugins.core.action.activator:getPopularity(id) -> boolean

Type

Method

Description

Returns the popularity of the specified choice.

Parameters

Returns

hide

Signature

plugins.core.action.activator:hide()

Type

Method

Description

Hides a chooser listing the available actions.

Parameters

Returns

Signature

plugins.core.action.activator:hideChoice(id) -> boolean

Type

Method

Description

Hides the choice with the specified ID.

Parameters

Returns

id

Signature

plugins.core.action.activator:id() -> string

Type

Method

Description

Returns the activator's unique ID.

Parameters

Returns

Signature

plugins.core.action.activator:incPopularity(choice, id) -> boolean

Type

Method

Description

Increases the popularity of the specified choice.

Parameters

Returns

Signature

plugins.core.action.activator:isDisabledHandler(id) -> boolean

Type

Method

Description

Returns true if the specified handler is disabled.

Parameters

Returns

Signature

plugins.core.action.activator:isHiddenChoice(id) -> boolean

Type

Method

Description

Checks if the specified choice is hidden.

Parameters

Returns

Signature

plugins.core.action.activator:onActivate(activateFn) -> activator

Type

Method

Description

Registers the provided function to handle 'activate' actions, when the user selects

Parameters

Returns

Signature

plugins.core.action.activator:preloadChoices([afterSeconds]) -> activator

Type

Method

Description

Indicates the activator should preload the choices after a number of seconds.

Parameters

Returns

refresh

Signature

plugins.core.action.activator:refresh()

Type

Method

Description

Clears the existing set of choices and requests new ones from enabled action handlers.

Signature

plugins.core.action.activator:refreshChooser()

Type

Method

Description

Refreshes a Chooser.

Parameters

Returns

Signature

plugins.core.action.activator:rightClickAction(index) -> none

Type

Method

Description

Triggered when a user right clicks on a chooser.

Parameters

Returns

Signature

plugins.core.action.activator:rightClickMain(index) -> none

Type

Method

Description

Triggered when a user right clicks on a chooser.

Parameters

Returns

show

Signature

plugins.core.action.activator:show()

Type

Method

Description

Shows a chooser listing the available actions. When selected by the user,

Parameters

Returns

Signature

plugins.core.action.activator:sortChoices() -> boolean

Type

Method

Description

Sorts the current set of choices in the activator. It takes into account

Parameters

Returns

Signature

plugins.core.action.activator:unfavoriteChoice(id) -> boolean

Type

Method

Description

Marks the choice with the specified ID as not a favorite.

Parameters

Returns

Signature

plugins.core.action.activator:unhiddenChoices() -> table

Type

Method

Description

Returns a table with visible choices.

Parameters

Returns

Signature

plugins.core.action.activator:unhideChoice(id) -> boolean

Type

Method

Description

Reveals the choice with the specified ID.

Parameters

Returns