Change urxvt terminal paste shortcut to CTRL+ALT+V. Fix #166

This commit is contained in:
Federico Terzi 2020-02-28 21:38:15 +01:00
parent 3e98748c54
commit 7921e0fcdc
5 changed files with 18 additions and 2 deletions

View File

@ -307,6 +307,10 @@ void trigger_alt_shift_ins_paste() {
xdo_send_keysequence_window(xdo_context, CURRENTWINDOW, "Shift+Alt+Insert", 8000); xdo_send_keysequence_window(xdo_context, CURRENTWINDOW, "Shift+Alt+Insert", 8000);
} }
void trigger_ctrl_alt_paste() {
xdo_send_keysequence_window(xdo_context, CURRENTWINDOW, "Control_L+Alt+v", 8000);
}
void trigger_copy() { void trigger_copy() {
// Release the other keys, for an explanation, read the 'trigger_paste' method // Release the other keys, for an explanation, read the 'trigger_paste' method
@ -467,8 +471,8 @@ int32_t is_current_window_special() {
if (res > 0) { if (res > 0) {
if (strstr(class_buffer, "terminal") != NULL) { if (strstr(class_buffer, "terminal") != NULL) {
return 1; return 1;
}else if (strstr(class_buffer, "URxvt") != NULL) { // Manjaro terminal }else if (strstr(class_buffer, "URxvt") != NULL) { // urxvt terminal
return 1; return 4;
}else if (strstr(class_buffer, "XTerm") != NULL) { // XTerm and UXTerm }else if (strstr(class_buffer, "XTerm") != NULL) { // XTerm and UXTerm
return 1; return 1;
}else if (strstr(class_buffer, "Termite") != NULL) { // Termite }else if (strstr(class_buffer, "Termite") != NULL) { // Termite

View File

@ -92,6 +92,11 @@ extern "C" void trigger_shift_ins_paste();
*/ */
extern "C" void trigger_alt_shift_ins_paste(); extern "C" void trigger_alt_shift_ins_paste();
/*
* Trigger CTRL+ALT+V pasting
*/
extern "C" void trigger_ctrl_alt_paste();
/* /*
* Trigger copy shortcut ( Pressing CTRL+C ) * Trigger copy shortcut ( Pressing CTRL+C )
*/ */

View File

@ -44,5 +44,6 @@ extern {
pub fn trigger_terminal_paste(); pub fn trigger_terminal_paste();
pub fn trigger_shift_ins_paste(); pub fn trigger_shift_ins_paste();
pub fn trigger_alt_shift_ins_paste(); pub fn trigger_alt_shift_ins_paste();
pub fn trigger_ctrl_alt_paste();
pub fn trigger_copy(); pub fn trigger_copy();
} }

View File

@ -52,6 +52,8 @@ impl super::KeyboardManager for LinuxKeyboardManager {
trigger_alt_shift_ins_paste(); trigger_alt_shift_ins_paste();
}else if is_special == 3 { // Special case for Emacs }else if is_special == 3 { // Special case for Emacs
trigger_shift_ins_paste(); trigger_shift_ins_paste();
}else if is_special == 4 { // CTRL+ALT+V used in some terminals (urxvt)
trigger_ctrl_alt_paste();
}else{ }else{
trigger_terminal_paste(); trigger_terminal_paste();
} }
@ -65,6 +67,9 @@ impl super::KeyboardManager for LinuxKeyboardManager {
PasteShortcut::ShiftInsert=> { PasteShortcut::ShiftInsert=> {
trigger_shift_ins_paste(); trigger_shift_ins_paste();
}, },
PasteShortcut::CtrlAltV => {
trigger_ctrl_alt_paste();
},
_ => { _ => {
error!("Linux backend does not support this Paste Shortcut, please open an issue on GitHub if you need it.") error!("Linux backend does not support this Paste Shortcut, please open an issue on GitHub if you need it.")
} }

View File

@ -43,6 +43,7 @@ pub enum PasteShortcut {
CtrlV, // Classic Ctrl+V shortcut CtrlV, // Classic Ctrl+V shortcut
CtrlShiftV, // Could be used to paste without formatting in many applications CtrlShiftV, // Could be used to paste without formatting in many applications
ShiftInsert, // Often used in Linux systems ShiftInsert, // Often used in Linux systems
CtrlAltV, // Used in some Linux terminals (urxvt)
MetaV, // Corresponding to Win+V on Windows and Linux, CMD+V on macOS MetaV, // Corresponding to Win+V on Windows and Linux, CMD+V on macOS
} }