- Change folder for screenshot.
defaults write com.apple.screencapture location ~/screens/
killall SystemUIServer
- Copy
ss2cb.plistto~/Library/LaunchAgents/. - Copy
ss2cb.pyto~/. - Test with
Cmd + Shift + 4& Paste it! - Done!
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>StandardErrorPath</key> | |
| <string>/tmp/ss2cb.err</string> | |
| <key>StandardOutPath</key> | |
| <string>/tmp/ss2cb.log</string> | |
| <key>Disabled</key> | |
| <false/> | |
| <key>Label</key> | |
| <string>copy Screen Shots to ClipBoard</string> | |
| <key>ProgramArguments</key> | |
| <array> | |
| <string>/usr/local/bin/python</string> | |
| <string>~/ss2cb.py</string> | |
| </array> | |
| <key>WatchPaths</key> | |
| <array> | |
| <string>~/screens/</string> | |
| </array> | |
| </dict> | |
| </plist> |
| #! /usr/bin/python | |
| import pygtk | |
| pygtk.require('2.0') | |
| import gtk | |
| import os | |
| import sys | |
| def copy_image(f): | |
| assert os.path.exists(f), "file does not exist" | |
| image = gtk.gdk.pixbuf_new_from_file(f) | |
| clipboard = gtk.clipboard_get() | |
| clipboard.set_image(image) | |
| clipboard.store() | |
| def all_files_under(path): | |
| path = os.path.expanduser(path); | |
| cur_path = path | |
| for filename in os.listdir(path): | |
| yield os.path.join(cur_path, filename) | |
| if len(sys.argv) < 2: | |
| file = max(all_files_under('~/screens/'), key=os.path.getctime) | |
| else: | |
| file = sys.argv[1] | |
| copy_image(file); | |
| print 'File: "' + file + '" Copied' | |
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/glib/_glib.so, 2): Library not loaded: /usr/local/opt/libffi/lib/libffi.6.dylib
-->
platformio/platform-lattice_ice40#7