2023-04-09 14:48:20 +02:00
|
|
|
#pragma once
|
|
|
|
#include "../defines.hpp"
|
2024-07-30 23:33:56 +02:00
|
|
|
#include "hyprland-global-shortcuts-v1.hpp"
|
|
|
|
#include "../protocols/WaylandProtocol.hpp"
|
2023-04-09 14:48:20 +02:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
struct SShortcut {
|
2024-07-30 23:33:56 +02:00
|
|
|
SP<CHyprlandGlobalShortcutV1> resource;
|
|
|
|
std::string id, description, appid;
|
|
|
|
uint32_t shortcut = 0;
|
2023-04-09 14:48:20 +02:00
|
|
|
};
|
|
|
|
|
2024-07-30 23:33:56 +02:00
|
|
|
class CShortcutClient {
|
|
|
|
public:
|
|
|
|
CShortcutClient(SP<CHyprlandGlobalShortcutsManagerV1> resource);
|
|
|
|
|
|
|
|
bool good();
|
|
|
|
|
|
|
|
private:
|
|
|
|
SP<CHyprlandGlobalShortcutsManagerV1> resource;
|
|
|
|
std::vector<SP<SShortcut>> shortcuts;
|
2023-04-09 14:48:20 +02:00
|
|
|
|
2024-07-30 23:33:56 +02:00
|
|
|
friend class CGlobalShortcutsProtocol;
|
2024-07-29 19:19:47 +02:00
|
|
|
};
|
|
|
|
|
2024-07-30 23:33:56 +02:00
|
|
|
class CGlobalShortcutsProtocol : IWaylandProtocol {
|
2023-04-09 14:48:20 +02:00
|
|
|
public:
|
2024-07-30 23:33:56 +02:00
|
|
|
CGlobalShortcutsProtocol(const wl_interface* iface, const int& ver, const std::string& name);
|
2024-07-24 19:07:36 +02:00
|
|
|
|
2023-04-09 14:48:20 +02:00
|
|
|
void bindManager(wl_client* client, void* data, uint32_t version, uint32_t id);
|
2024-07-30 23:33:56 +02:00
|
|
|
void destroyResource(CShortcutClient* client);
|
2023-04-09 14:48:20 +02:00
|
|
|
|
|
|
|
void sendGlobalShortcutEvent(std::string appid, std::string trigger, bool pressed);
|
2024-07-30 23:33:56 +02:00
|
|
|
bool isTaken(std::string id, std::string app_id);
|
2023-04-09 14:48:20 +02:00
|
|
|
std::vector<SShortcut> getAllShortcuts();
|
|
|
|
|
|
|
|
private:
|
2024-07-30 23:33:56 +02:00
|
|
|
std::vector<SP<CShortcutClient>> m_vClients;
|
|
|
|
};
|
2023-04-09 14:48:20 +02:00
|
|
|
|
2024-07-30 23:33:56 +02:00
|
|
|
namespace PROTO {
|
|
|
|
inline UP<CGlobalShortcutsProtocol> globalShortcuts;
|
2024-07-24 19:07:36 +02:00
|
|
|
};
|