Is there a way to run a bash script everytime I print something?
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 : &quot;Monitoring a Directory&quot;
The following example starts the job whenever any of the paths being watched have changed:
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
&lt;plist version=&quot;1.0&quot;&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;com.example.watchhostconfig&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;syslog&lt;/string&gt;
        &lt;string&gt;-s&lt;/string&gt;
        &lt;string&gt;-l&lt;/string&gt;
        &lt;string&gt;notice&lt;/string&gt;
        &lt;string&gt;somebody touched /etc/hostconfig&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;WatchPaths&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/etc/hostconfig&lt;/string&gt;
    &lt;/array&gt;
&lt;/dict&gt;
&lt;/plist&gt;

You should monitor the directory &quot;/var/spool/cups&quot; 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 &quot;lpstat -o&quot; that could be useful for that task (cf https://www.computerhope.com/unix/ulpstat.htm)
To be continued...