docs » cp.config


Manage CommandPost's constants and settings.

Submodules

API Overview

API Documentation

Constants

appName

Signature cp.config.appName
Type Constant
Description The name of the Application

appVersion

Signature cp.config.appVersion
Type Constant
Description Prefix used for Configuration Settings

assetsPath

Signature cp.config.assetsPath
Type Constant
Description Path to where Application Assets are stored

basePath

Signature cp.config.basePath
Type Constant
Description Path to where the Extensions & Plugins folders are stored.

bundledPluginsPath

Signature cp.config.bundledPluginsPath
Type Constant
Description The path to bundled plugins

bundleID

Signature cp.config.bundleID
Type Constant
Description Application's Bundle ID

configPrefix

Signature cp.config.configPrefix
Type Constant
Description Prefix used for Configuration Settings

developerMode

Signature cp.config.developerMode <cp.prop: boolean>
Type Constant
Description When true, the app is in developer mode.

iconPath

Signature cp.config.iconPath
Type Constant
Description Path to the Application Icon

languagePath

Signature cp.config.languagePath
Type Constant
Description Path to the Languages Folder
Signature cp.config.menubarIconPath
Type Constant
Description Path to the Menubar Application Icon

pluginPaths

Signature cp.config.pluginPaths
Type Constant
Description Table of Plugins Paths. Earlier entries take precedence.

privacyPolicyURL

Signature cp.config.privacyPolicyURL
Type Constant
Description URL for Privacy Policy

processID

Signature cp.config.processID
Type Constant
Description Application's Process ID

scriptPath

Signature cp.config.scriptPath
Type Constant
Description Path to where Application Scripts are stored

sourceExtensions

Signature cp.config.sourceExtensions
Type Constant
Description Extensions for files which will trigger a reload when modified.

sourceWatcher

Signature cp.config.sourceWatcher
Type Constant
Description A cp.sourcewatcher that will watch for source files and reload CommandPost if any change.

userConfigRootPath

Signature cp.config.userConfigRootPath
Type Constant
Description The path to user configuration folders

userPluginsPath

Signature cp.config.userPluginsPath
Type Constant
Description The path to user plugins

Functions

application

Signature cp.config.application() -> hs.application object
Type Function
Description Returns the Application as a hs.application object
Parameters
  • None
Returns
  • hs.application object

get

Signature cp.config.get(key[, defaultValue]) -> string or boolean or number or nil or table or binary data
Type Function
Description Loads a setting
Parameters
  • key - A string containing the name of the setting
  • defaultValue - A default value if the setting doesn't already exist
Returns
  • The value of the setting

prop

Signature cp.config.prop(key[, defaultValue]) -> cp.prop
Type Function
Description Returns a cp.prop instance connected to the value of the specified key. When the value is modified, it will be notified.
Parameters
  • * `key` - The configuration setting key.
  • * `defaultValue` - The default value if the key has not been set.
Returns
  • * A `cp.prop` instance for the key.

reset

Signature cp.config.reset()
Type Function
Description Resets all the settings for the Application
Parameters
  • None
Returns
  • None

set

Signature cp.config.set(key, value)
Type Function
Description Saves a setting with common datatypes
Parameters
  • `key` - A string containing the name of the setting
  • `value` - An optional value for the setting. Valid datatypes are:
  • string
  • number
  • boolean
  • nil
  • table (which may contain any of the same valid datatypes)
  • if no value is provided, it is assumed to be nil
Returns
  • None
Notes
  • This function cannot set dates or raw data types

unwatch

Signature cp.config.unwatch(id)
Type Function
Description Unregisters the watcher with the specified ID.
Parameters
  • `id` - The ID, originally returned from the `watch` function.
Returns
  • `true` if a watcher with the ID existed and was successfully removed.

watch

Signature cp.config.watch(events) -> id
Type Function
Description Watches for config events.
Parameters
  • `events` - a table containing functions for each event to watch for.
Returns
  • a unique ID that can be used to `unwatch`.
Notes
  • Supported events:
  • ** `reset()` - occurs after CommandPost's settings are reset.

Fields

frontmost

Signature cp.config.frontmost <cp.prop: boolean; read-only>
Type Field
Description Returns whether or not the Application is frontmost.

results matching ""

    No results matching ""