Skip to content

Instantly share code, notes, and snippets.

@drunlin
drunlin / Bing PopClip.yaml
Created August 30, 2023 02:27
A PopClip extension for searching Bing using Chrome in the background.
#popclip - Search Bing using Chrome in the background
name: Bing
icon: B
applescript: |
tell application "Google Chrome"
set isActive to frontmost
activate
set theWindow to window 1
set theTabIndex to active tab index of theWindow
set theBaseURL to "https://www.bing.com/search"
@drunlin
drunlin / DoubleClick.swift
Last active September 9, 2022 11:43
Simulate double click on Mac
let src = CGEventSource(stateID: .hidSystemState)
let position = CGPoint(x: 500, y: 500)
for i in 1...2 {
let leftMouseDown = CGEvent(mouseEventSource: src, mouseType: .leftMouseDown, mouseCursorPosition: position, mouseButton: .left)
let leftMouseUp = CGEvent(mouseEventSource: src, mouseType: .leftMouseUp, mouseCursorPosition: position, mouseButton: .left)
leftMouseDown?.setIntegerValueField(.mouseEventClickState, value: Int64(i))
leftMouseDown?.post(tap: .cghidEventTap)
leftMouseUp?.post(tap: .cghidEventTap)
}