Multi-element clipboard manager for Gnome on Wayland?

There is some documentation on the GNOME Wiki for creating extensions and API documentation at https://gjs-docs.gnome.org. This isn’t particular to GNOME Shell extensions at all though; it’s just a matter of scope and not clearing whatever container type is used to store the history items:

// You could use a Map, Object, Set or Array; whichever suits the use-case best
const ClipboardHistory = new Map();

function init() {
}

function enable() {
    // Setup for extension

    // Add/remove item history
    ClipboardHistory.set('history-item-id', 'clipboard content');
    ClipboardHistory.delete('history-item-id');
}

function disable() {
    // Teardown for extension
}
1 Like