I wanted to run a script that changes my background image whenever use the printer.
Is it possible? Is there a way to know when OS X is printing something?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
that might be very interesting, funny and useful ! I have not yet a complete answer but what i think could do the trick is to use a daemon that watch and act when something is printed.
You could use this documentation :
And especially this example : "Monitoring a Directory" The following example starts the job whenever any of the paths being watched have changed:
<?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>Label</key> <string>com.example.watchhostconfig</string> <key>ProgramArguments</key> <array> <string>syslog</string> <string>-s</string> <string>-l</string> <string>notice</string> <string>somebody touched /etc/hostconfig</string> </array> <key>WatchPaths</key> <array> <string>/etc/hostconfig</string> </array> </dict> </plist>
You should monitor the directory "/var/spool/cups" as mentioned here https://www.cups.org/doc/spec-design.html and do something when there is change. So in your case, change the background image.
You could also see the command "lpstat -o" that could be useful for that task (cf https://www.computerhope.com/unix/ulpstat.htm)
To be continued...