Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bug

macrumors regular
Original poster
Feb 2, 2004
188
21
Vancouver, BC
Hi all -

I made this handy (for me) script that lets the user choose what GUI to run when starting X11 in OS X. It will let you choose KDE, Gnome, or just plain quartz. Of course, I recommend that if you are using KDE or Gnome that you run X11 in full screen mode, although it will run either way. The plain quartz option has no desktop manager, so I'd recommend running that in rootless mode.


To get the full use out of it, I recommend that you have installed:

fink (and FinkCommander, cause its great)
These packages from fink:
-system-xfree86 (I think it's called - sorry, not at my Mac right now. You need the place holder package for X11 is what I'm getting at. See Fink's website)
-kde-bundle
-gnome-bundle
-dialog

then, make an .xinitrc file in your home directory with the following contents:
Code:
#!/bin/sh
# $Id: xinitrc,v 1.2 2003/02/27 19:03:30 jharper Exp $

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

export PATH = $PATH:/usr/local/bin

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f $userresources ]; then
    xrdb -merge $userresources
fi

if [ -f $usermodmap ]; then
    xmodmap $usermodmap
fi

source /sw/bin/init.sh

# start some nice programs
xterm -geom 80x24+100+100 -e "sh .xchoose"
TEMP=/tmp/xinitanswer

menuitem=`cat $TEMP`

#start the window manager

case $menuitem in
1) xterm -geom 80x24+100+100 &
          exec quartz-wm
;;
2) /usr/X11R6/bin/quartz-wm --only-proxy&
          export KDEWM=kwin
          startkde > /tmp/kde.log 2>&1
;;
3) /usr/X11R6/bin/quartz-wm --only-proxy&
          gnome-session
;;
4) exec quartz-wm&
          startkde > /tmp/kde.log 2>&1
;;
5) exec quartz-wm&
          gnome-session
;;
esac

#this just makes my alt key work...
xmodmap -e "keycode 66 = Meta_L"


Then make a file called .xchoose in the same place:

Code:
TEMP=/tmp/xinitanswer

dialog --menu "How can I serve you Master?" 24 80 5 1 "Apple's X11 in stock form." 2 "KDE" 3 "gnome" 4 "KDE with Quatrz (unstable)" 5 "gnome with Quartz (unstable)" 2>|$TEMP


Now when you click on X11 you will be prompted with a very old school dialog box that will ask you what GUI you'd like to use for your X11 session.

Please let me know if there are any ways I can improve this!
:p

bug
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.