I seem to have found a proper solution to this.
I created a user specifically for the purpose of connecting to my desktop computer.
Inside the user's ~/.xinitrc on my laptop I have the following line (/home/desktop/.xinitrc):
exec vncviewer 192.168.1.2
192.168.1.2 is my desktop computer's ip on my network.
In my case I now use Tiger VNC as client and still X11VNC as server on my desktop pc.
Any client will do I guess.
The way it works now is, I enter tty2 through CTRL+ALT+F2, log in as the new desktop user and then initiate x with
xinit -- :1.
The new x server will start on tty8, since I already have my main xserver running on tty7.
vncviewer runs and successfully connects to my desktop pc, providing the whole screen plus scroll bars should the desktop pc's resolution be greater than my laptop's.
Now I can easily switch between my laptop and my desktop pc with CTRL+ALT+7 and CTRL+ALT+8.
This is the full procedure assuming you use Tiger VNC (the only difference is
exec vncviewer x.x.x.x):
- Create new user with
- The configuration of the new user is ok with the default values, so keep hitting enter till the user is created.
/home/desktop/.xinitrc (remember to do so as root unless you are logged in as desktop and also be aware of permissions) and clean out the file (should it have any content) and enter this line:
exec vncviewer x.x.x.x
- Replace the
x.x.x.x with the IP address you wish.
- Save the file.
- Enter an unused tty using CTRL+ALT+X where X is a number from 1 to 9.
- Log in as
- Initiate a new X server with
xinit -- :1, you may use a different display if :1 is already in use.
- You will be sent to the new tty where the X server is started and voilà! Tiger VNC should now be connected to the IP address you chose.
You may run into trouble if you have a desktop environment which automatically starts when you initiate X from any user. So keep that in mind, if things doesn't work the way they are supposed to.