I want to run oxipng *.png
in /Users/user/Desktop/
immediately after a PNG screenshot (Cmd-Shift-3) is created in my Desktop folder.
I have the following plist
file in ~/Library/LaunchAgents/
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>oxipng</string>
<key>ProgramArguments</key>
<array>
<string>oxipng</string>
<string>*.png</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Users/user/Desktop/</string>
</array>
</dict>
</plist>
Then, I run launchctl load ~/Library/LaunchAgents/oxipng.plist
. However, the PNG are never modified after creation.
How do I make oxipng run after a screenshot is saved to the Desktop folder?