

Feb 06, '04 09:33:00AM • Contributed by: Use Xnest to run X11 sessions in a window



Virtually every release of XFree86 includes a nest X server, called Xnest. This is simply an X server that is simultaneously an X client. In most instances, this is completely useless. Why would you want to run an X server inside of an X server on Linux? Debugging. Why would you do it in OS X? You do it so you can run KDE in a window.



Read the rest of the hint for the how-to...



For every window manager that you want to be able to run, you need a separate .xinitrc file. For KDE, I have a file in my home directory called .xinitrc.kde that only contains the following line:

exec /sw/bin/startkde Note that I do not actually have a file in my home directory called .xinitrc , as I am using Apple's quartz-wm to control these windows. The tricky part is to get the new x-session open. The xinit script makes this quite simple:

xinit ~/.xinitrc.kde -- /usr/X11R6/bin/Xnest :3 -geometry 800x600 The ~/.xinitrc.kde represents the script we have written that launches kde. Anything that immediately follows this gets passed to the script.



The first item that follows -- represents the name of the X server. We want this to be /usr/X11R6/bin/Xnest because that's where Xnest should be. Everything after this counts as arguments to the Xnest command ( man Xnest for more info).



The default X server (XDarwin or Apple's X11) uses display :0 as the default, so you must pick a number higher than that. Also, if you want to be able to launch more than one Xnest session, each of these will need to have a different display number. The -geometry argument just tells Xnest how big of a window you want.



Give it a shot as described above. If you like being able to run KDE or other window managers in a window, you can set them up for easy launching as aliases in your .tcshrc file or as applications in the X11 "Applications" menu.



For extra fun, you can also launch these Xnest sessions on remote machines through ssh (HOWTOs available elsewhere). Have fun! I've been holding onto this little secret for a long time; I've finally broken down. A search on google seems to imply that no one else is aware of this, or at least they aren't willing to spill the beans. So, here goes ... Apple's X11 and the XDarwin server both support running X11 full screen or rootless. Many people (including me) have been frustrated by the fact that when you run X11 full screen, you effectively lose OS X, but when you run Gnome or KDE in rootless mode, everything looks funny and you lose the X11 desktop. There is actually an in-between option.Virtually every release of XFree86 includes a nest X server, called Xnest. This is simply an X server that is simultaneously an X client. In most instances, this is completely useless. Why would you want to run an X server inside of an X server on Linux? Debugging. Why would you do it in OS X? You do it so you can run KDE in a window.Read the rest of the hint for the how-to...For every window manager that you want to be able to run, you need a separatefile. For KDE, I have a file in my home directory calledthat only contains the following line:Note that I do not actually have a file in my home directory called, as I am using Apple's quartz-wm to control these windows. The tricky part is to get the new x-session open. The xinit script makes this quite simple:Therepresents the script we have written that launches kde. Anything that immediately follows this gets passed to the script.The first item that followsrepresents the name of the X server. We want this to bebecause that's where Xnest should be. Everything after this counts as arguments to the Xnest command (for more info).The default X server (XDarwin or Apple's X11) uses displayas the default, so you must pick a number higher than that. Also, if you want to be able to launch more than one Xnest session, each of these will need to have a different display number. Theargument just tells Xnest how big of a window you want.Give it a shot as described above. If you like being able to run KDE or other window managers in a window, you can set them up for easy launching as aliases in yourfile or as applications in the X11 "Applications" menu.For extra fun, you can also launch these Xnest sessions on remote machines through ssh (HOWTOs available elsewhere). Have fun!

Currently 3.67 / 5 You rated: 4 / 5 (6 votes cast) [77,930 views] Hint Options Printable Hint Format

Subscribe to 'macosxhints.com Unix tips and tricks'





