Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorShortcutsIntegration::IAdhocRegistrar Class Referenceabstract

Reduced-surface registrar interface for subsystems that need to bind a transient shortcut while a specific UI state is active (e.g. More...

#include <phosphor-shortcuts/include/PhosphorShortcuts/IAdhocRegistrar.h>

Classes

struct  AdhocBinding
 One entry of the batch register form below. More...
 

Public Member Functions

virtual ~IAdhocRegistrar ()=default
 
virtual void registerAdhocShortcut (const QString &id, const QKeySequence &sequence, const QString &description, std::function< void()> callback)=0
 Register an ad-hoc shortcut that lives outside any settings-driven binding table.
 
virtual void unregisterAdhocShortcut (const QString &id)=0
 Release a shortcut previously bound via registerAdhocShortcut().
 
virtual void registerAdhocShortcuts (const QVector< AdhocBinding > &bindings)
 Batch forms.
 
virtual void unregisterAdhocShortcuts (const QStringList &ids)
 

Detailed Description

Reduced-surface registrar interface for subsystems that need to bind a transient shortcut while a specific UI state is active (e.g.

an Escape cancel grab held only during a window drag) without taking a hard dependency on the concrete shortcut-manager type that owns the Registry.

Lives in a sibling namespace (PhosphorShortcutsIntegration) rather than directly under PhosphorShortcuts to make the split explicit: the library (Registry, IBackend, the concrete backends) is the shortcut machinery itself; the integration namespace is the set of contracts consumers implement to plug their own glue into that machinery. The library provides no implementation of IAdhocRegistrar — each consumer wires its own "shortcut manager" object to the underlying Registry, with whatever bind-flow + flush ordering its app needs (the Phosphor implementation, for example, queues adhoc registrations that arrive during the initial settings-driven batch and drains them once the Portal BindShortcuts Response lands).

Pure abstract C++; no QObject inheritance, no Qt signals — keeps the interface usable from non-QObject consumers.

Constructor & Destructor Documentation

◆ ~IAdhocRegistrar()

virtual PhosphorShortcutsIntegration::IAdhocRegistrar::~IAdhocRegistrar ( )
virtualdefault

Member Function Documentation

◆ registerAdhocShortcut()

virtual void PhosphorShortcutsIntegration::IAdhocRegistrar::registerAdhocShortcut ( const QString &  id,
const QKeySequence &  sequence,
const QString &  description,
std::function< void()>  callback 
)
pure virtual

Register an ad-hoc shortcut that lives outside any settings-driven binding table.

Implementations forward this to a Registry::bind() with persistent=false (so the binding is excluded from KCM-style enumerations) followed by an immediate flush().

Idempotent — a second call with the same id should replace the callback and description in place.

◆ registerAdhocShortcuts()

virtual void PhosphorShortcutsIntegration::IAdhocRegistrar::registerAdhocShortcuts ( const QVector< AdhocBinding > &  bindings)
inlinevirtual

Batch forms.

The defaults forward to the per-id calls, so existing implementations keep working unchanged. Implementations whose backend pays a round-trip per flush should override to bind every entry and flush ONCE: on the XDG Portal each BindShortcuts request supersedes the prior in-flight Response, so a burst of per-id flushes loses the read-back confirmation for every batch but the last.

◆ unregisterAdhocShortcut()

virtual void PhosphorShortcutsIntegration::IAdhocRegistrar::unregisterAdhocShortcut ( const QString &  id)
pure virtual

Release a shortcut previously bound via registerAdhocShortcut().

Idempotent — unknown ids are silently ignored.

Subject to the per-backend release semantics documented on IBackend::unregisterShortcut (Portal cannot release a single id; KGlobalAccel and DBusTrigger release cleanly).

◆ unregisterAdhocShortcuts()

virtual void PhosphorShortcutsIntegration::IAdhocRegistrar::unregisterAdhocShortcuts ( const QStringList &  ids)
inlinevirtual

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