mutterkey
KDE-first push-to-talk transcription tool for KDE Plasma
Loading...
Searching...
No Matches
HotkeyManager Class Referencefinal

Wraps KGlobalAccel registration for Mutterkey's push-to-talk shortcut. More...

#include <hotkeymanager.h>

Signals

void shortcutPressed ()
 Emitted when the registered shortcut becomes active.
 
void shortcutReleased ()
 Emitted when the registered shortcut is released.
 

Public Member Functions

 HotkeyManager (ShortcutConfig config, QObject *parent=nullptr)
 Creates a hotkey manager with a fixed shortcut configuration.
 
 ~HotkeyManager () override
 Unregisters the shortcut and releases owned KDE objects.
 
bool registerShortcut (QString *errorMessage=nullptr)
 Registers the configured shortcut with KDE global accel.
 
void unregisterShortcut ()
 Unregisters the shortcut if it is currently active.
 
bool invokeShortcut (QString *errorMessage=nullptr)
 Simulates shortcut invocation through the KDE action object.
 
QJsonObject diagnostics () const
 Returns diagnostic state about registration and event counts.
 

Detailed Description

Wraps KGlobalAccel registration for Mutterkey's push-to-talk shortcut.

The manager owns the QAction used for registration and translates KDE active state changes into press and release signals for the service layer.

Definition at line 44 of file hotkeymanager.h.

Constructor & Destructor Documentation

◆ HotkeyManager()

HotkeyManager::HotkeyManager ( ShortcutConfig  config,
QObject *  parent = nullptr 
)
explicit

Creates a hotkey manager with a fixed shortcut configuration.

Parameters
configShortcut registration settings copied into the manager.
parentOptional QObject parent.

Member Function Documentation

◆ diagnostics()

QJsonObject HotkeyManager::diagnostics ( ) const

Returns diagnostic state about registration and event counts.

Returns
JSON object suitable for diagnose mode output.

◆ invokeShortcut()

bool HotkeyManager::invokeShortcut ( QString *  errorMessage = nullptr)

Simulates shortcut invocation through the KDE action object.

Parameters
errorMessageOptional output for invocation failures.
Returns
true when the action could be invoked.

◆ registerShortcut()

bool HotkeyManager::registerShortcut ( QString *  errorMessage = nullptr)

Registers the configured shortcut with KDE global accel.

Parameters
errorMessageOptional output for registration failures.
Returns
true when registration succeeded.

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