Skip to content

Instantly share code, notes, and snippets.

@sasha42
Created August 30, 2015 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sasha42/2b510638720e0f33da7d to your computer and use it in GitHub Desktop.
Save sasha42/2b510638720e0f33da7d to your computer and use it in GitHub Desktop.
Clear the formatting of your clipboard using a simple script placed in your (mac) dock
#!/bin/bash
# This small program cleans up the formatting of your mac clipboard
# (removes any links, coloring, font style, spacing, etc). Drag it
# into your dock and click on it whenever you want to clear some
# text's formatting. It will then close all by itself. Requires
# giving accessibility rights to terminal.
# Suggested as alias here https://news.ycombinator.com/item?id=10143852
pbpaste | pbcopy
# Took example from http://stackoverflow.com/a/21118491
closeWindow() {
/usr/bin/osascript << _OSACLOSE_
tell application "Terminal"
close (every window whose name contains "clipboard-clean.sh")
end tell
tell application "System Events" to click UI element "Close" of sheet 1 of window 1 of application process "Terminal"
_OSACLOSE_
}
closeWindow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment