SuperCollider CLASSES


register objects to be cleared when Cmd-. is pressed
Inherits from: AbstractSystemAction : Object


CmdPeriod allows you to register objects to perform an action when the user presses Cmd-. These objects must implement a method called -cmdPeriod which performs the necessary tasks. (You can add such a method in your custom classes.) Note that since Function implements -cmdPeriod as a synonym for -value, it is possible to register any function (and thus any arbitrary code) for evaluation when Cmd-. is pressed.

Class Methods

*add (object)

From superclass: AbstractSystemAction

Registers an object to be cleared when Cmd-. is pressed. This object will stay registered until it is explicitly removed, and will thus respond to additional presses of Cmd-.

*remove (object)

From superclass: AbstractSystemAction

Removes an object that was previously registered.


From superclass: AbstractSystemAction

Removes all objects that have been registered.

*doOnce (object)

Registers an object to be evaluated once, and then unregistered.


*objects = value

Get or set the list of objects that are called when CmdPeriod is evaluated.


The number of times CmdPeriod has been called since startup.

Inherited class methods

Undocumented class methods


*clearClocks = value


*freeRemote = value


*freeServers = value



Instance Methods

Inherited instance methods


f = {"foo".postln };
g = {"bar".postln };

// Now press Cmd-.


// Now press Cmd-. Only f executes

CmdPeriod.remove(f); // must explicitly cleanup

// Now press Cmd-.

CmdPeriod.add(g); // one object is added only once.
CmdPeriod.add(g); // one object is added only once.

// Now press Cmd-.

// remove it again.

// note that often you want to automatically remove the function once it is evaluated
// instead of

f = { "foo".postln; CmdPeriod.remove(f) };

// you can write:

CmdPeriod.doOnce { "foo".postln }

// a typical example:
w ="close on cmd-.").front;
CmdPeriod.doOnce { w.close };

// in some cases you might need to defer the function by a short amount of time
a = { Synth(\default)};

// remove all