Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
Phosphor::Shortcuts Namespace Reference

Namespaces

namespace  Integration
 

Classes

class  IBackend
 Pluggable global shortcut backend. More...
 
class  Registry
 Consumer-facing facade over IBackend. More...
 

Enumerations

enum class  BackendHint {
  Auto , KGlobalAccel , Portal , DBusTrigger ,
  Native
}
 Backend selection hint for createBackend(). More...
 

Functions

PHOSPHORSHORTCUTS_EXPORT std::unique_ptr< IBackendcreateBackend (BackendHint hint=BackendHint::Auto, QObject *parent=nullptr)
 Create a backend instance.
 

Enumeration Type Documentation

◆ BackendHint

Backend selection hint for createBackend().

Most consumers should pass Auto (the default) and let the library detect the running environment. Explicit hints exist for tests and for consumers that want deterministic behaviour in CI.

Enumerator
Auto 

Detect via session bus service introspection.

KGlobalAccel 

Force KGlobalAccel.

Falls through to DBusTrigger if the library was built without PHOSPHORSHORTCUTS_HAVE_KGLOBALACCEL.

Portal 

Force XDG Desktop Portal GlobalShortcuts.

DBusTrigger 

Force D-Bus trigger fallback.

Native 

Reserved for the future INativeGrabber-backed backend.

Currently returns nullptr — callers asking explicitly for Native opted in to a backend that doesn't exist yet, so a silent fallback would mask a misconfiguration. Callers MUST null-check the createBackend() return value; passing a null backend into Registry is a programming error (asserted in debug, logged and dropped in release).

Function Documentation

◆ createBackend()

PHOSPHORSHORTCUTS_EXPORT std::unique_ptr< IBackend > Phosphor::Shortcuts::createBackend ( BackendHint  hint = BackendHint::Auto,
QObject *  parent = nullptr 
)

Create a backend instance.

Auto-detection order:

  1. No session bus → DBusTrigger.
  2. org.kde.kglobalaccel advertised AND KF6::GlobalAccel linked → KGlobalAccel.
  3. org.freedesktop.portal.GlobalShortcuts on the portal → Portal.
  4. Otherwise → DBusTrigger.

The returned backend is empty (no shortcuts registered). Hand it to a Registry, bind() some shortcuts, then flush().