aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dome_key_map.h2
-rw-r--r--src/cocoa_bridge.rs12
2 files changed, 14 insertions, 0 deletions
diff --git a/dome_key_map.h b/dome_key_map.h
index 224cc21..b61133d 100644
--- a/dome_key_map.h
+++ b/dome_key_map.h
@@ -42,6 +42,8 @@ void c_run_key_action(State *state, Trigger trigger, const Trigger *mode);
void config_free(Config *ptr);
+Config *config_read_from_file(void);
+
extern void dkess_press_key(int16_t key, CGEventFlags modifier_flags);
void logger_init(void);
diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs
index ba7b432..1dbd187 100644
--- a/src/cocoa_bridge.rs
+++ b/src/cocoa_bridge.rs
@@ -332,6 +332,18 @@ pub extern "C" fn c_parse_args(
}
#[no_mangle]
+pub extern "C" fn config_read_from_file() -> *mut Config {
+ match config::get_config() {
+ Ok(config) => Box::into_raw(Box::new(config)),
+ Err(e) => {
+ error!("{}", e);
+
+ ptr::null_mut()
+ },
+ }
+}
+
+#[no_mangle]
pub extern "C" fn config_free(ptr: *mut Config) {
if ptr.is_null() { return }
unsafe { Box::from_raw(ptr); }