5

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?

  • You can see the print history in your browser: osxdaily.com/2011/01/20/show-print-history-mac – Vincent Apr 17 '15 at 18:59
  • No real input to your question - just wanted to say that I love this requirement! Would like to understand how/where the connection is between printing and wanting to change the background image... – nwinkler Feb 28 '18 at 10:33
1

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 :

https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html

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...

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .