hyprland/global_shortcuts: add GlobalShortcut

This commit is contained in:
outfoxxed 2024-05-06 22:05:46 -07:00
parent 87a884ca36
commit bba8cb8a7d
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
14 changed files with 569 additions and 6 deletions

View file

@ -0,0 +1,34 @@
#pragma once
#include <qcontainerfwd.h>
#include <qhash.h>
#include <qstring.h>
#include <qwayland-hyprland-global-shortcuts-v1.h>
#include <qwaylandclientextension.h>
#include "shortcut.hpp"
namespace qs::hyprland::global_shortcuts::impl {
class GlobalShortcutManager
: public QWaylandClientExtensionTemplate<GlobalShortcutManager>
, public QtWayland::hyprland_global_shortcuts_manager_v1 {
public:
explicit GlobalShortcutManager();
GlobalShortcut* registerShortcut(
const QString& appid,
const QString& name,
const QString& description,
const QString& triggerDescription
);
void unregisterShortcut(const QString& appid, const QString& name);
static GlobalShortcutManager* instance();
private:
QHash<QPair<QString, QString>, QPair<qint32, GlobalShortcut*>> shortcuts;
};
} // namespace qs::hyprland::global_shortcuts::impl