Skip to content

Instantly share code, notes, and snippets.

@Choumingzhao
Last active February 9, 2026 06:45
Show Gist options
  • Select an option

  • Save Choumingzhao/3ef978c22ec863960a7b433058e2c4d2 to your computer and use it in GitHub Desktop.

Select an option

Save Choumingzhao/3ef978c22ec863960a7b433058e2c4d2 to your computer and use it in GitHub Desktop.
AutoHotkey v2: Visual Notification for Ctrl+C Clipboard Copies

Visual Notification for Ctrl+C Clipboard Copies using AHK v2

A lightweight AutoHotkey v2 script that provides visual feedback (Tooltip) when you copy text using the Ctrl+C shortcut.
Key Features:

  • v2 Syntax: Fully compatible with AutoHotkey v2.0+.
  • User-Centric: Specifically checks for the Ctrl key state so it doesn't trigger when background apps change your clipboard.
  • Non-Intrusive: Uses a temporary ToolTip that follows the mouse and disappears automatically.

How to use:

  1. Install AutoHotkey v2.
  2. Create a new .ahk file and paste the code.
  3. Run the script.
  4. Highlight any text and press Ctrl + C.

The Script (The Code Content)

#Requires AutoHotkey v2.0

; Register the function to monitor clipboard changes
OnClipboardChange(NotifyOnCopy)

NotifyOnCopy(DataType) {
    ; Check if Ctrl is held down to ensure it's a manual copy action
    if GetKeyState("Ctrl") {
        
        if (DataType = 1) {
            ; Handle Text: Show a preview of the content
            ClipPreview := SubStr(A_Clipboard, 1, 50)
            Msg := "📋 Copied: " . ClipPreview . (StrLen(A_Clipboard) > 50 ? "..." : "")
            ShowNotification(Msg)
        } 
        else if (DataType = 2) {
            ; Handle Images/Files: Simple notification
            ShowNotification("🖼️ Non-Text Content Copied")
        }
    }
}

ShowNotification(Text) {
    ToolTip(Text)
    ; Clear the tooltip after 1.5 seconds
    SetTimer () => ToolTip(), -1500
}

Keywords: AutoHotkey, AHK v2, Clipboard Monitor, Ctrl+C Notification, Tooltip, Script, Productivity.


This content is prompted by me and generated by Google Gemini.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment