2023-04-09 14:48:20 +02:00
|
|
|
#pragma once
|
|
|
|
#include "../defines.hpp"
|
2023-04-27 14:55:13 +02:00
|
|
|
#include "hyprland-global-shortcuts-v1-protocol.h"
|
2023-04-09 14:48:20 +02:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
struct SShortcut {
|
|
|
|
wl_resource* resource;
|
|
|
|
std::string id, description, appid;
|
|
|
|
uint32_t shortcut = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SShortcutClient {
|
|
|
|
wl_client* client = nullptr;
|
|
|
|
std::vector<std::unique_ptr<SShortcut>> shortcuts;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CGlobalShortcutsProtocolManager {
|
|
|
|
public:
|
|
|
|
CGlobalShortcutsProtocolManager();
|
2024-07-24 19:07:36 +02:00
|
|
|
~CGlobalShortcutsProtocolManager();
|
|
|
|
|
2023-04-09 14:48:20 +02:00
|
|
|
void bindManager(wl_client* client, void* data, uint32_t version, uint32_t id);
|
|
|
|
void displayDestroy();
|
|
|
|
|
|
|
|
void registerShortcut(wl_client* client, wl_resource* resource, uint32_t shortcut, const char* id, const char* app_id, const char* description,
|
|
|
|
const char* trigger_description);
|
|
|
|
void destroyShortcut(wl_resource* resource);
|
|
|
|
|
|
|
|
bool globalShortcutExists(std::string appid, std::string trigger);
|
|
|
|
void sendGlobalShortcutEvent(std::string appid, std::string trigger, bool pressed);
|
|
|
|
|
|
|
|
std::vector<SShortcut> getAllShortcuts();
|
|
|
|
|
2024-07-24 19:07:36 +02:00
|
|
|
wl_listener m_liDisplayDestroy;
|
|
|
|
|
2023-04-09 14:48:20 +02:00
|
|
|
private:
|
|
|
|
std::vector<std::unique_ptr<SShortcutClient>> m_vClients;
|
|
|
|
|
|
|
|
SShortcutClient* clientFromWlClient(wl_client* client);
|
|
|
|
|
|
|
|
wl_global* m_pGlobal = nullptr;
|
2024-07-24 19:07:36 +02:00
|
|
|
};
|