powermate package¶
Submodules¶
powermate.pactl module¶
A small library for interacting with the pactl command line tool.
This library allows for a few simple interactions with linux pulseaudio, like viewing active sinks (sound outputs, usually loosely correlating with speakers) and their relative volumes, and setting volume absolutely or relatively.
Most functions take a sink argument which defaults to retrieving and using the first ‘RUNNING’ sink found. This uses a full subprocess, so users doing repeated calls are recommended to get a sink object (eg. through active_sink()) and pass that to successive calls.
The pactl tool will need to be installed for this library to work. It is commonly installed by default when PulseAudio is installed, and on many major distros.
powermate.pactl_powermate module¶
powermate.powermate module¶
-
exception
powermate.powermate.EventNotImplemented[source]¶ Bases:
NotImplementedErrorSpecial exception type for non-implemented events.
-
class
powermate.powermate.EventQueue(source, max_queue_size=5)[source]¶ Bases:
objectA thread-safe event queue which registers any number of listeners for an event source.
This will store a small number of items in order for a listener to read, and they are then available to iterate over. If more events than the specified maximum are in a listener’s queue, it will stop enqueueing new events. If for instance a listener takes a long break and max_queue_size is K, it will read the next K events after the sleep started (the oldest K events not read) and then continue to read new events. Any intermediate events will be dropped for that listener.
Listeners may be simply registered by iterating over the queue, or through the .iterate method for more configuration.
-
class
powermate.powermate.FileEventSource(path, event_size)[source]¶ Bases:
objectAn event source which reads and writes to a file object.
-
class
powermate.powermate.LedEvent(brightness=255, speed=0, pulse_type=0, asleep=0, awake=0)[source]¶ Bases:
powermate.powermate.Event-
value¶
-
-
class
powermate.powermate.PowerMateBase(path, long_threshold=1000)[source]¶ Bases:
powermate.powermate.AsyncFileEventDispatcher,powermate.powermate.PowerMateEventHandler