From 72a181fcf530f292124b776479f32b4b5f966e52 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Thu, 8 Jul 2021 22:14:13 +0800 Subject: [PATCH] [bugfix] compatible with WindowsTerminal --- win/ahk/ClipboardManager.ahk | 25 +++++++++++++++++++++++-- win/win.ahk | 3 ++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/win/ahk/ClipboardManager.ahk b/win/ahk/ClipboardManager.ahk index 14441d5..dc76c0f 100644 --- a/win/ahk/ClipboardManager.ahk +++ b/win/ahk/ClipboardManager.ahk @@ -29,13 +29,29 @@ PasteAsUnixPath() { PasteAs(convertFuncName) { %convertFuncName%() - Send ^v + Paste() Sleep 500 } +Copy() { + if WinActive("ahk_exe WindowsTerminal.exe") { + Send, ^+c + } else { + Send, ^c + } +} + +Paste() { + if WinActive("ahk_exe WindowsTerminal.exe") { + Send, ^+v + } else { + Send, ^v + } +} + CopyAndFetch() { Clipboard = - Send, ^c ; simulate Ctrl+C (=selection in clipboard) + Copy() ClipWait, 0, 1 ; wait until clipboard contains data selection = %Clipboard% ; save the content of the clipboard return selection @@ -58,3 +74,8 @@ LoadAlternativeToClipboard() { global ALTERNATIVE_CLIPBOARD Clipboard = %ALTERNATIVE_CLIPBOARD% } + +CopyClipboardToAlternative() { + global ALTERNATIVE_CLIPBOARD + ALTERNATIVE_CLIPBOARD = %ClipBoardAll% +} \ No newline at end of file diff --git a/win/win.ahk b/win/win.ahk index e226ddc..a6ab095 100644 --- a/win/win.ahk +++ b/win/win.ahk @@ -7,7 +7,7 @@ CoordMode, Mouse, Screen ; mouse coordinates relative to the screen ; ========================= ; DEBUGGING ; ========================= -global DEBUGGING := true +global DEBUGGING := false ToggleDebugging() { global DEBUGGING @@ -84,6 +84,7 @@ InitClipboardManager() ; CLIPBOARD MANAGER #c::AlternativeCopy() +#+c::CopyClipboardToAlternative() #v::AlternativePaste()