Using Google Cloud Print with Pharos Popup

Update for CMU people: This post is no longer relevant because I found out you could get rid of Pharos Popup altogether. It turns out that CMU’s instructions for setting up printing on a personal Linux computer using the LPD protocol works perfectly well on Macs as well. Since the Andrew ID is included in the parameters of the protocol, no popups!


CMU uses Pharos Popup to manage printing. When we print to one of the public queues on our own computers, a popup prompts us for our CMU ID. We can then go to any printer location on campus, swipe the ID card and release the print job.


Now if I set up Google Cloud Print with this and try to print something using my phone, the popup will appear on my computer and wait for my input. If I’m not around my computer (which is precisely when I’d ever need to print stuff off of my phone), it doesn’t print.

Solution for Mac

I wrote the following AppleScript to detect the popup window and simulate keystroke input. Since there’s no Pharos event I can listen to, I thought about running the script continuously and checking for the existence of the popup window every few seconds, but that would be pretty wasteful considering how rarely I’d actually need this functionality. So now I just place the script somewhere handy and ssh into my computer to run the script when I need it.

tell application "System Events"
    if (window 1 of process "Popup" exists) then
        set frontmost of process "Popup" to true
        keystroke "REDACTED"
        keystroke return
    end if
end tell


While I doubt I’ll have many chances to actually use this, it’s just fun to experiment and cool to have it working. It’d be better if CMU supports Google Cloud Print directly (like Fedex), but I guess that requires integration with the current quota system and is not an easy task.