The Clipboard Aptitude provides the ability to retrieve information about the user's cursor.


Starts listening to changes to the cursor position. Takes a callback function as an argument, which sends a Position whenever called. A promise is triggered after setting the listener that provides access to a Cancellable stream, so that you can turn off the listener.

import { cursor } from '@oliveai/ldk';

let cursorStream: Cancellable;

cursor.listenPosition((position) => {
    console.log(`Cursor position: ${position.x}/${position.y}`);
}).then((cancellable: Cancellable) => {
    cursorStream = cancellable;


Retrieves the cursor's current position.

import { clipboard } from '@oliveai/ldk';

// Function that is called after position() is successful
// Provides the cursor's position when position() was executed
const callback = (position) => {
    console.log(`Cursor position: ${position.x}/${position.y}`);


Last updated