2019-09-01 12:58:39 +00:00
|
|
|
#ifndef ESPANSO_BRIDGE_H
|
|
|
|
#define ESPANSO_BRIDGE_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2019-09-13 20:57:53 +00:00
|
|
|
extern void * context_instance;
|
|
|
|
|
2019-09-01 12:58:39 +00:00
|
|
|
/*
|
|
|
|
* Initialize the X11 context and parameters
|
|
|
|
*/
|
2019-09-13 20:57:53 +00:00
|
|
|
extern "C" int32_t initialize(void * context_instance);
|
2019-09-01 12:58:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Start the event loop indefinitely. Blocking call.
|
|
|
|
*/
|
|
|
|
extern "C" int32_t eventloop();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Clean all the X11 resources allocated during the initialization.
|
|
|
|
*/
|
|
|
|
extern "C" void cleanup();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called when a new keypress is made, the first argument is an char array,
|
|
|
|
* while the second is the size of the array.
|
|
|
|
*/
|
2019-09-06 20:38:21 +00:00
|
|
|
typedef void (*KeypressCallback)(void * self, const char *buffer, int32_t len, int32_t is_modifier, int32_t key_code);
|
2019-09-01 12:58:39 +00:00
|
|
|
|
|
|
|
extern KeypressCallback keypress_callback;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Register the callback that will be called when a keypress was made
|
|
|
|
*/
|
2019-09-13 20:57:53 +00:00
|
|
|
extern "C" void register_keypress_callback(KeypressCallback callback);
|
2019-09-01 12:58:39 +00:00
|
|
|
|
2019-09-01 14:50:20 +00:00
|
|
|
/*
|
|
|
|
* Type the given string by simulating Key Presses
|
|
|
|
*/
|
|
|
|
extern "C" void send_string(const char * string);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Send the backspace keypress, *count* times.
|
|
|
|
*/
|
|
|
|
extern "C" void delete_string(int32_t count);
|
|
|
|
|
2019-09-06 22:38:13 +00:00
|
|
|
/*
|
|
|
|
* Trigger normal paste ( Pressing CTRL+V )
|
|
|
|
*/
|
|
|
|
extern "C" void trigger_paste();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Trigger terminal paste ( Pressing CTRL+SHIFT+V )
|
|
|
|
*/
|
|
|
|
extern "C" void trigger_terminal_paste();
|
|
|
|
|
2019-09-07 11:35:45 +00:00
|
|
|
|
|
|
|
// SYSTEM MODULE
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the active windows's WM_NAME
|
|
|
|
*/
|
|
|
|
extern "C" int32_t get_active_window_name(char * buffer, int32_t size);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the active windows's WM_CLASS
|
|
|
|
*/
|
|
|
|
extern "C" int32_t get_active_window_class(char * buffer, int32_t size);
|
|
|
|
|
2019-09-13 20:57:53 +00:00
|
|
|
/*
|
|
|
|
* Return the active windows's executable path
|
|
|
|
*/
|
|
|
|
extern "C" int32_t get_active_window_executable(char * buffer, int32_t size);
|
|
|
|
|
2019-09-13 21:05:01 +00:00
|
|
|
/*
|
|
|
|
* Return 1 if the current window is a terminal window, 0 otherwise.
|
|
|
|
*/
|
|
|
|
extern "C" int32_t is_current_window_terminal();
|
|
|
|
|
2019-09-01 12:58:39 +00:00
|
|
|
#endif //ESPANSO_BRIDGE_H
|