2022-03-19 17:48:18 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../defines.hpp"
|
|
|
|
#include <deque>
|
|
|
|
#include "../Compositor.hpp"
|
2022-04-21 15:50:52 +02:00
|
|
|
#include <unordered_map>
|
|
|
|
#include <functional>
|
2022-03-19 17:48:18 +01:00
|
|
|
|
|
|
|
struct SKeybind {
|
|
|
|
std::string key = 0;
|
|
|
|
uint32_t modmask = 0;
|
|
|
|
std::string handler = "";
|
|
|
|
std::string arg = "";
|
|
|
|
};
|
|
|
|
|
|
|
|
class CKeybindManager {
|
|
|
|
public:
|
2022-04-21 15:50:52 +02:00
|
|
|
CKeybindManager();
|
|
|
|
|
2022-03-19 22:03:40 +01:00
|
|
|
bool handleKeybinds(const uint32_t&, const xkb_keysym_t&);
|
2022-03-19 17:48:18 +01:00
|
|
|
void addKeybind(SKeybind);
|
2022-04-21 17:06:43 +02:00
|
|
|
void removeKeybind(uint32_t, const std::string&);
|
2022-03-19 17:48:18 +01:00
|
|
|
uint32_t stringToModMask(std::string);
|
2022-03-19 21:48:24 +01:00
|
|
|
void clearKeybinds();
|
2022-03-19 17:48:18 +01:00
|
|
|
|
2022-04-21 15:50:52 +02:00
|
|
|
std::unordered_map<std::string, std::function<void(std::string)>> m_mDispatchers;
|
|
|
|
|
2022-03-19 17:48:18 +01:00
|
|
|
private:
|
2022-04-21 17:06:43 +02:00
|
|
|
std::list<SKeybind> m_lKeybinds;
|
2022-03-19 17:48:18 +01:00
|
|
|
|
2022-03-27 19:32:50 +02:00
|
|
|
bool handleInternalKeybinds(xkb_keysym_t);
|
2022-03-19 17:48:18 +01:00
|
|
|
|
|
|
|
// -------------- Dispatchers -------------- //
|
2022-04-21 15:50:52 +02:00
|
|
|
static void killActive(std::string);
|
|
|
|
static void spawn(std::string);
|
|
|
|
static void toggleActiveFloating(std::string);
|
|
|
|
static void toggleActivePseudo(std::string);
|
|
|
|
static void changeworkspace(std::string);
|
|
|
|
static void fullscreenActive(std::string);
|
|
|
|
static void moveActiveToWorkspace(std::string);
|
|
|
|
static void moveFocusTo(std::string);
|
|
|
|
static void moveActiveTo(std::string);
|
|
|
|
static void toggleGroup(std::string);
|
|
|
|
static void changeGroupActive(std::string);
|
|
|
|
static void alterSplitRatio(std::string);
|
2022-05-05 12:50:25 +02:00
|
|
|
static void focusMonitor(std::string);
|
2022-05-16 17:37:46 +02:00
|
|
|
static void toggleSplit(std::string);
|
2022-03-19 17:48:18 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
inline std::unique_ptr<CKeybindManager> g_pKeybindManager;
|