Keep keyboard led when turning on global hotkeys, move files

This commit is contained in:
dec05eba
2025-05-03 12:03:43 +02:00
parent 180a3b73db
commit d08ea69277
18 changed files with 37 additions and 33 deletions

View File

@@ -0,0 +1,34 @@
#pragma once
#include "GlobalHotkeys.hpp"
#include <unordered_map>
#include <sys/types.h>
namespace gsr {
class GlobalHotkeysLinux : public GlobalHotkeys {
public:
enum class GrabType {
ALL,
VIRTUAL
};
GlobalHotkeysLinux(GrabType grab_type);
GlobalHotkeysLinux(const GlobalHotkeysLinux&) = delete;
GlobalHotkeysLinux& operator=(const GlobalHotkeysLinux&) = delete;
~GlobalHotkeysLinux() override;
bool start();
bool bind_key_press(Hotkey hotkey, const std::string &id, GlobalHotkeyCallback callback) override;
void unbind_all_keys() override;
void poll_events() override;
private:
void close_fds();
private:
pid_t process_id = 0;
int read_pipes[2];
int write_pipes[2];
FILE *read_file = nullptr;
std::unordered_map<std::string, GlobalHotkeyCallback> bound_actions_by_id;
GrabType grab_type;
};
}