mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-05-07 15:19:56 +09:00
Keep keyboard led when turning on global hotkeys, move files
This commit is contained in:
34
include/GlobalHotkeys/GlobalHotkeysLinux.hpp
Normal file
34
include/GlobalHotkeys/GlobalHotkeysLinux.hpp
Normal 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;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user