From 284482e2d54cbd1ca7e44c84b5b14f1ae5019e10 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Fri, 13 Dec 2019 21:57:06 +0100 Subject: [PATCH] Attempt to improve support for Simple terminal on linux. #112 --- native/liblinuxbridge/bridge.cpp | 8 ++++++++ native/liblinuxbridge/bridge.h | 5 +++++ src/bridge/linux.rs | 1 + src/keyboard/linux.rs | 2 ++ 4 files changed, 16 insertions(+) diff --git a/native/liblinuxbridge/bridge.cpp b/native/liblinuxbridge/bridge.cpp index 5695fa3..6e4e5b3 100644 --- a/native/liblinuxbridge/bridge.cpp +++ b/native/liblinuxbridge/bridge.cpp @@ -303,6 +303,10 @@ void trigger_shift_ins_paste() { xdo_send_keysequence_window(xdo_context, CURRENTWINDOW, "Shift+Insert", 8000); } +void trigger_alt_shift_ins_paste() { + xdo_send_keysequence_window(xdo_context, CURRENTWINDOW, "Shift+Alt+Insert", 8000); +} + // SYSTEM MODULE // Function taken from the wmlib tool source code @@ -465,8 +469,12 @@ int32_t is_current_window_terminal() { return 1; }else if (strstr(class_buffer, "Terminator") != NULL) { // Terminator return 1; + }else if (strstr(class_buffer, "stterm") != NULL) { // Simple terminal 3 + return 2; }else if (strstr(class_buffer, "St") != NULL) { // Simple terminal return 1; + }else if (strstr(class_buffer, "st") != NULL) { // Simple terminal 2 + return 1; }else if (strstr(class_buffer, "Alacritty") != NULL) { // Alacritty terminal return 1; } diff --git a/native/liblinuxbridge/bridge.h b/native/liblinuxbridge/bridge.h index 9d07122..ce55253 100644 --- a/native/liblinuxbridge/bridge.h +++ b/native/liblinuxbridge/bridge.h @@ -87,6 +87,11 @@ extern "C" void trigger_terminal_paste(); */ extern "C" void trigger_shift_ins_paste(); +/* + * Trigger alt shift ins pasting( Pressing ALT+SHIFT+INS ) + */ +extern "C" void trigger_alt_shift_ins_paste(); + // SYSTEM MODULE diff --git a/src/bridge/linux.rs b/src/bridge/linux.rs index 4947629..ab609c2 100644 --- a/src/bridge/linux.rs +++ b/src/bridge/linux.rs @@ -43,4 +43,5 @@ extern { pub fn trigger_paste(); pub fn trigger_terminal_paste(); pub fn trigger_shift_ins_paste(); + pub fn trigger_alt_shift_ins_paste(); } \ No newline at end of file diff --git a/src/keyboard/linux.rs b/src/keyboard/linux.rs index 956d89d..2074970 100644 --- a/src/keyboard/linux.rs +++ b/src/keyboard/linux.rs @@ -48,6 +48,8 @@ impl super::KeyboardManager for LinuxKeyboardManager { // so we need to check the correct situation. if is_terminal == 0 { trigger_paste(); + }else if is_terminal == 2 { // Special case for stterm + trigger_alt_shift_ins_paste(); }else{ trigger_terminal_paste(); }