Switch resolution on VNC connect/disconnect

Is the following doable using OSXVNC/Vine server and RealVNC client?

I would like to be able to switch my Apple Mac Mini’s resolution from 1080p (default when connected to the Hi-def LCD TV) to 1680x1050 (best resolution for viewing on the LCD monitor connected to the Linux computer and using VNC to connect to the Apple Mac Mini).

I managed to use the SwitchResX software to add a custom resolution of 1680x1050 @60 to the list of available resolutions on the Apple Mac Mini and now would like to have a transparent and automated way to switch/reset the resolutions while using VNC.

I am thinking that one could trigger a resolution change script when a connection is established on port 5900 (remote client connecting to the local VNC server), and reset the resolution back to the previous state (1080p in this case) when the VNC connection is terminated.

How would one go about with the implementation of this solution? Scripting? Anyone?

It’s an interesting idea. Unfortunately at this time Vine Server doesn’t really have any hooks that trigger when a client establishes a connection.

So short of modifying the code (which is stored at http://www.sourceorge.net/projects/osxvnc ) the easiest thing I can suggest is some .command files that the user would click after making the connection and before disconnecting.

But if you come up with anything more elegant or you do make changes to the source to allow that kind of trigger please let us know about it.