Skip to content

Instantly share code, notes, and snippets.

@cshaa
Created May 20, 2025 19:23
Show Gist options
  • Save cshaa/492d1c25e3f8d8fc3c5cd4ffc42953c6 to your computer and use it in GitHub Desktop.
Save cshaa/492d1c25e3f8d8fc3c5cd4ffc42953c6 to your computer and use it in GitHub Desktop.
Copy a paragraph from PDF, correctly remove hyphenation, and paste the result into VS Code
addEventListener('keyup', async (e) => {
if (e.key !== 'x') return;
if (!e.ctrlKey) return;
const text = await navigator.clipboard.readText();
await navigator.clipboard.writeText(text.replaceAll("-\n", "").replaceAll("\n", " ") + "\n\n")
})
import time
import subprocess
keyboard.send_keys("<ctrl>+c<ctrl>+x")
subprocess.run("wmctrl -a \"Visual Studio Code\"", shell=True)
time.sleep(0.10)
keyboard.send_keys("<ctrl>+v")
autokey-run -s ~/.config/autokey/data/copypaste-pdf.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment