Last active
June 9, 2021 15:05
-
-
Save insign/96e451503bdb927c6e38c8e8f885bc7c to your computer and use it in GitHub Desktop.
Auto copy on select paste with middle (no obstrutive)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
#SingleInstance Force ; reloads if try to rerun | |
cos_mousedrag_treshold := 20 ; pixels | |
#IfWinNotActive ahk_class ConsoleWindowClass | |
~lButton:: | |
MouseGetPos, cos_mousedrag_x, cos_mousedrag_y | |
keywait lbutton | |
mousegetpos, cos_mousedrag_x2, cos_mousedrag_y2 | |
if (abs(cos_mousedrag_x2 - cos_mousedrag_x) > cos_mousedrag_treshold | |
or abs(cos_mousedrag_y2 - cos_mousedrag_y) > cos_mousedrag_treshold) | |
{ | |
wingetclass cos_class, A | |
if (cos_class == "Emacs") | |
sendinput !w | |
else | |
sendinput ^c | |
} | |
return | |
~mbutton:: | |
WinGetClass cos_class, A | |
if (cos_class == "Emacs") | |
SendInput ^y | |
else | |
SendInput ^v | |
return | |
#IfWinNotActive | |
;; clipx | |
^mbutton:: | |
sendinput ^+{insert} | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment