I really like this feature on Linux systems. I want it too on my Windows systems, but I didn't find a proper solution.

The solutions I found:

-True X-Mouse
-AutoclipX
-Autohotkey script

The problems I had with them:

True X-Mouse changes the mouse focus which I don't want to be active on Windows because it only messes with menus like the start menu. Also you can't close tabs with your middle mouse button if it's active.
AutoClipX just pastes the clipboard content and not the selected text.
Autohotkey script found here messes with consoles on Windows. If you are switching to your console by clicking on it it will paste a Ctrl+C which is pretty annoying.

Did anybody find a proper solution or a fix for the problems I encountered with those 3 solutions?

  • AFAIK you can paste the selected text by drag-and-drop to every editor or edit control (even if the window is minimized or behind another window by dragging the selected text to the window's icon on the taskbar). What is the advantage of using the middle mouse button to paste the selected text? How does it work on Linux? – user3419297 Aug 16 at 14:26
  • You can select the text and switch to a different workspace or switch to a maximized window and just click middle mouse button to paste the selected text. It stays like that and only gets overwritten if you select an other text. Also you can use it to select some text from the console and paste it anywhere you want. – dun Aug 16 at 14:32
  • Do you want to select the text using the middle or the left mouse button in that case? Important to know for an answer on your question. Using AHK you can select text with almost every button. – user3419297 Aug 16 at 14:46
  • I want to select the text using the left mouse button. The middle mouse button is only to paste the last selected text. – dun Aug 16 at 14:51

Copy on select implementation:

Try it this way:

#NoEnv
#SingleInstance Force

mousedrag_treshold := 20 ; pixels

Hotkey mbutton, paste_selection

; #IfWinNotActive ahk_class ConsoleWindowClass

~lButton::
    MouseGetPos, mousedrag_x, mousedrag_y
    keywait lbutton, T0.3 
    If (ErrorLevel)
    {
        keywait lbutton
        mousegetpos, mousedrag_x2, mousedrag_y2
        if (abs(mousedrag_x2 - mousedrag_x) > mousedrag_treshold
        or abs(mousedrag_y2 - mousedrag_y) > mousedrag_treshold)
        {
            ; MouseGetPos,,,WindowUnderMouse
            ; WinGetClass, Class, ahk_id %WindowUnderMouse%
            ; If (Class != "ConsoleWindowClass")
                sendinput ^c
            hotkey mbutton, on
        }
    }
return

~lButton Up:: return

; #IfWinNotActive

paste_selection:
    sendinput {lbutton}
    SendInput ^v
return
  • Oh thank you so much. I'm going to try to adjust it but it's nearly the same as in Linux. – dun Aug 17 at 6:32
  • The selected text from editors and consoles is being pasted perfectly and it doesn't send a Ctrl+C when switching to console. But it doesn't paste the selected text e.g. from the browser. Also it overrides the functionality of the middle click. You can't start a new instance of a program by clicking with the middle button on the attached programs on the taskbar or you can't close tabs or open new ones in Firefox. – dun Aug 17 at 6:39

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.