Skip to content

Instantly share code, notes, and snippets.

@jamesWalker55
Created August 28, 2025 12:15
Show Gist options
  • Save jamesWalker55/68398be4f29f537dee37668e5cb9fd70 to your computer and use it in GitHub Desktop.
Save jamesWalker55/68398be4f29f537dee37668e5cb9fd70 to your computer and use it in GitHub Desktop.
Script for MPV to copy screenshot to clipboard. Requires `cb.exe` tool in PATH, from https://github.com/Slackadays/Clipboard
// copy-screenshot.ts
var COMMAND_NAME = "screenshot-to-clipboard";
var path = mp.utils.get_user_path("~/AppData/Local/Temp/mpv-screenshot-clipboard.png");
function main() {
print("Saving screenshot to " + path);
mp.commandv("osd-msg", "screenshot-to-file", path, "video");
mp.commandv("run", "cb", "cp", path);
}
mp.add_key_binding(undefined, COMMAND_NAME, main);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment