mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-05-04 22:10:44 +09:00
Use linux /dev/input for global hotkeys instead of x11. This also works on wayland on any compositor
This commit is contained in:
24
include/GlobalHotkeysLinux.hpp
Normal file
24
include/GlobalHotkeysLinux.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "GlobalHotkeys.hpp"
|
||||
#include <unordered_map>
|
||||
#include <sys/types.h>
|
||||
|
||||
namespace gsr {
|
||||
class GlobalHotkeysLinux : public GlobalHotkeys {
|
||||
public:
|
||||
GlobalHotkeysLinux();
|
||||
GlobalHotkeysLinux(const GlobalHotkeysLinux&) = delete;
|
||||
GlobalHotkeysLinux& operator=(const GlobalHotkeysLinux&) = delete;
|
||||
~GlobalHotkeysLinux() override;
|
||||
|
||||
bool start();
|
||||
bool bind_action(const std::string &id, GlobalHotkeyCallback callback) override;
|
||||
void poll_events() override;
|
||||
private:
|
||||
pid_t process_id = 0;
|
||||
int pipes[2];
|
||||
FILE *read_file = nullptr;
|
||||
std::unordered_map<std::string, GlobalHotkeyCallback> bound_actions_by_id;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user