Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorServiceClipboard::ClipboardService Class Reference

Clipboard-history host for Phosphor-based desktop shells. More...

#include <PhosphorServiceClipboard/ClipboardService.h>

Inheritance diagram for PhosphorServiceClipboard::ClipboardService:
[legend]

Signals

void countChanged ()

Public Member Functions

 ClipboardService (QObject *parent=nullptr)
 ~ClipboardService () override
bool isSupported () const
 Whether the compositor advertises the wlr-data-control protocol this service builds on.
QAbstractItemModel * history () const
 The history list model (most-recent first). Owned by the service.
int count () const
 Number of entries in the history.
bool copy (int index)
 Re-apply the entry at index to the clipboard selection.
bool remove (int index)
 Remove the entry at index from the history (and disk).
void clear ()
 Clear the entire history (and disk).

Detailed Description

Clipboard-history host for Phosphor-based desktop shells.

Watches the session clipboard through phosphor-wayland's ClipboardDevice (a wlr-data-control client), keeps a de-duplicated, capped, on-disk history, and can re-apply any entry. It is the policy / history / persistence layer over the raw device; it composes the device rather than binding the protocol itself, so its public surface is a clean Qt/QML type with no Wayland types leaking out.

The history loads from disk on construction and persists on every change. A dialog binds history (a model with preview / mimeType / offeredTypes / timestamp roles, most-recent first) and calls copy(index) to paste an entry back. Sensitive selections (password-manager hints) are never read or kept.

Constructor & Destructor Documentation

◆ ClipboardService()

PhosphorServiceClipboard::ClipboardService::ClipboardService ( QObject * parent = nullptr)
explicit

◆ ~ClipboardService()

PhosphorServiceClipboard::ClipboardService::~ClipboardService ( )
override

Member Function Documentation

◆ clear()

void PhosphorServiceClipboard::ClipboardService::clear ( )

Clear the entire history (and disk).

◆ copy()

bool PhosphorServiceClipboard::ClipboardService::copy ( int index)

Re-apply the entry at index to the clipboard selection.

Returns false when the index is out of range or the entry carries no content or mime type, so a caller can tell a real copy from a silently ignored one. The launcher needs that distinction: it keeps its surface open on a refused activation rather than closing on a no-op.

◆ count()

int PhosphorServiceClipboard::ClipboardService::count ( ) const
nodiscard

Number of entries in the history.

◆ countChanged

void PhosphorServiceClipboard::ClipboardService::countChanged ( )
signal

◆ history()

QAbstractItemModel * PhosphorServiceClipboard::ClipboardService::history ( ) const
nodiscard

The history list model (most-recent first). Owned by the service.

◆ isSupported()

bool PhosphorServiceClipboard::ClipboardService::isSupported ( ) const
nodiscard

Whether the compositor advertises the wlr-data-control protocol this service builds on.

When false the service constructs but stays inert (the persisted history still loads and is readable).

◆ remove()

bool PhosphorServiceClipboard::ClipboardService::remove ( int index)

Remove the entry at index from the history (and disk).

Returns false when the index is out of range.


The documentation for this class was generated from the following file: