Results 1 to 10 of 43

Thread: How-to run Multiple (Virtual) X sessions

Threaded View

  1. #1
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Thumbs down How-to run Multiple (Virtual) X sessions

    Bodhi's VirtualX script.


    This is a bash script which will give you a GUI to start virtual X sessions without going through KDM, GDM, XDM, etc.

    This is an adaptation from my work with dual monitors....

    What is a virtual X session? Just as you can have multiple terminals (tty1, tty2....,tty6)
    You can have multiple instances of X (Ctrl-Alt-F7, Ctrl-Alt-F8, Ctrl-Alt-F9).

    Yes, but doesn't that slow down your computer? NOT THAT MUCH

    Yes, but why you ask?

    Are you the type that runs gnome, but are interested in trying an alternate desktop?

    This script allows yo to stay logged in gnome, all applications running, and start a second X session, say Fluxbox, Openbox, IceWM, or XFCE.

    Otherwise you have to log-out, choose a new session in GDM, log in. This stops all your gnome programs.

    With this script you can explore AND keep gnome running as "home base"

    Features:
    1. You may select to run fluxbox, gnome, KDE, icewm, openbox, or xfce.
    2. NO ADDITIONAL SCRIPTS.
    3. To change between X Sessions Ctrl-alt F7 ; Ctrl-Alt-F8 ; Ctrl-Alt-F9, etc.


    That is correct. I consolidated a number of start scripts into this bash script.

    The upside is there is now only one configuration file for your virtual X setup and configuration.

    The downside is you will need to understand this file if you want to tweak my setup (you know you do....)

    I tried to comment the script so as to make this as painless as possible.


    Dependencies:

    EDIT:
    Thanks to compwiz18:
    Quote Originally Posted by compwiz18 View Post
    Howdy. Just thought that it might be worth noting that on a fresh install, dialog is not installed by default. I had to run sudo apt-get install dialog to make the program run, otherwise it just exits.
    Absolute dependency:
    dialog
    Code:
    sudo aptitude update
    sudo aptitude install dialog
    I advise these packages:
    fbsetbg to set background image (openbox, Fluxbox, IceWM [Although IceWM has themes])
    numlockx - Turns on number lock (on the number pad)
    xscreensaver - Screen saver.

    Options:
    rox (see below)

    To play a sound at start of window manager:
    Install mpg123 or mpg321

    Syntax: mpg321 -a hw:y,z /path_to/sound.mp3
    hw:y,z is your soundcard
    hw:0,1 or hw:1,0 or hw:2,0


    CONFIGURATION

    1. Save this script as /usr/bin/virtualX
    Code:
    sudo gedit /usr/bin/virtualX
    Copy and paste this script:
    #!/bin/sh

    # Variables
    # widowmanager=Desktop/Window manager
    # tempfile1=tempfile1

    ################################################## ###########################
    ## Default Screen ##
    ################################################## ###########################

    # GDM starts at boot on screen 0

    # Fluxbox = 1
    # Gnome = 2
    # IceWM = 3
    # KDE = 4
    # Openbox = 5
    # xfce = 6

    ################################################## ###########################
    ## Select Desktop/Window manager ##
    ################################################## ###########################

    dialog --backtitle "Welcome to bodhi's virtual X script" --title "Desktop Environment" --menu "Please select a desktop environment" 13 175 7 \
    "fluxbox" "Fluxbuntu <http://community.fluxbuntu.org>" \
    "gnome" "Ubuntu" \
    "icewm" "<http://en.wikipedia.org/wiki/IceWM>" \
    "kde" "Kubuntu" \
    "openbox" "<http://www.icculus.org/openbox/2/>" \
    "xfce" "Xubuntu" 2>~/tempfile1

    return_value=$?

    windowmanager=`cat ~/tempfile1`

    case $return_value in

    0)
    rm ~/tempfile1 & rm windowmanager
    clear
    echo -e '\E[32m'"bodhi.zazen"
    tput sgr0

    case $windowmanager in

    fluxbox)
    # Start xsreensaver & numlockx
    DISPLAY=:1.0 /usr/bin/xscreensaver &
    DISPLAY=:1.0 /usr/bin/numlockx on &

    # PLAY a sound
    # Use a CLI player
    # Example:
    # sleep -3 & mpg321 -a hw:1,0 /path/sound.mp3 &

    # Start rox
    #DISPLAY=:1.0 rox --pinboard=Default &

    exec /usr/bin/startx /usr/bin/fluxbox -- :1 2> /dev/null &
    exit ;;

    gnome)
    # Start xsreensaver & numlockx
    DISPLAY=:2.0 /usr/bin/xscreensaver &
    DISPLAY=:2.0 /usr/bin/numlockx on &

    # PLAY a sound
    # Use a CLI player
    # Example:
    # sleep -3 & mpg321 -a hw:1,0 /path/sound.mp3 &

    # Start Gnome
    /usr/bin/startx /usr/bin/gnome-session -- :2 2> /dev/null &
    exit ;;

    kde)
    # Start xsreensaver & numlockx
    DISPLAY=:3.0 /usr/bin/xscreensaver &
    DISPLAY=:3.0 /usr/bin/numlockx on &

    # PLAY a sound
    # Use a CLI player
    # Example:
    # sleep -3 & mpg321 -a hw:1,0 /path/sound.mp3 &

    # Start KDE
    /usr/bin/startx -- :3 2> /dev/null &
    exit ;;

    icewm)
    # Start xsreensaver & numlockx
    DISPLAY=:4.0 /usr/bin/xscreensaver &
    DISPLAY=:4.0 /usr/bin/numlockx on &

    # PLAY a sound
    # Use a CLI player
    # Example:
    # sleep -3 & mpg321 -a hw:1,0 /path/sound.mp3 &

    # Start rox
    # rox --pinboard=Default &

    # Start IceWM
    exec /usr/bin/startx /usr/bin/icewm-session -- :4 2> /dev/null &
    exit ;;

    openbox)
    # Start xsreensaver & numlockx
    DISPLAY=:5.0 /usr/bin/xscreensaver &
    DISPLAY=:5.0 /usr/bin/numlockx on &

    # To set background image, uncomment the following lines and set the path to an image
    # DISPLAY=:5.0 fbsetbg -f /home/picture.jpg &

    # PLAY a sound
    # Use a CLI player
    # Example:
    # sleep -3 & mpg321 -a hw:1,0 /path/sound.mp3 &

    # Start rox Rox does not work so well with Openbox....
    # rox --pinboard=Default &

    # Start Openbox
    exec /usr/bin/startx /usr/bin/openbox -- :5 2> /dev/null &
    exit ;;

    xfce)
    # Start xsreensaver & numlockx
    DISPLAY=:6.0 /usr/bin/xscreensaver &
    DISPLAY=:6.0 /usr/bin/numlockx on &

    # PLAY a sound
    # Use a CLI player
    # Example:
    # sleep -3 & mpg321 -a hw:1,0 /path/sound.mp3 &

    # Start rox
    # rox --pinboard=Default &

    # Start XFCE
    exec /usr/bin/startx /usr/bin/xfce4-session -- :6 2> /dev/null &
    exit ;;
    esac ;;

    1)
    clear
    echo -e '\E[31m' "Cancel"
    tput sgr0
    sleep 2
    clear
    exit ;;
    255)
    clear
    echo -e '\E[31m' "Esc"
    tput sgr0
    sleep 2
    clear
    exit ;;
    esac

    rm windowmanager
    clear
    echo -e '\E[32m'"bodhi.zazen"
    tput sgr0
    Save and exit gedit.

    Now make it executable:
    Code:
    sudo chmod a+x /usr/bin/virtualX
    2. Enable script for use within X.

    Note: by default, in Ubuntu you can use this script in tty1
    Code:
    Ctrl-alt-F1
    login
    virtualX
    To enable this script for use within an X session (gnome):
    Code:
    sudo gedit /etc/X11/Xwrapper.config
    Change:
    allowed_users=console
    To:
    Code:
    allowed_users=anybody
    Documentation

    After this edit you can use this script from tty1 or in a terminal in gnome (or any window manager).

    Now, to run this script, open a terminal and type virtualX.

    3. Shortcut:
    Start this script with
    Code:
    bash virtualX
    Watch the capital X at the end.....

    4. Add a menu item/launcher/desktop shortcut.
    Create a menu item, launcher, or desktop icon.
    Name =virtualX
    Command= bash virtualX


    5. KDE:
    This script starts KDE with just startx.

    Thus edit your .xinitrc

    #!/bin/sh

    #
    # ~/.xinitrc
    #
    # Executed by startx (run your window manager from here)
    #

    exec startkde

    6. Rox: Rox works well with fluxbox, icewm, xfce. It will allow desktop icons very easily.
    See here for configuration:

    Fluxbuntu Rox

    Debian Rox

    Note: Rox does not work so well with openbox.

    Most of all, have fun !
    Last edited by bodhi.zazen; October 6th, 2006 at 12:03 AM. Reason: Update dependencies
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •