You are not logged in.

#1 2009-01-22 20:52:05

absolutezero1287
Member
Registered: 2008-11-13
Posts: 133

[SOLVED]Help on a slightly different way to start multiple DEs

I don't really want to start x at boot. I like using runlevel 3 and then typing startx to start my default wm. However this only gives me the option of using one wm. Manually editing the .xinitrc every time is an option but would also be very annoying.

What I'd like to do is set runlevels 2 and 4 to be identical to 3 in the way that I'd boot to the console. Then I can edit grub's menu.lst entries and have different WMs to choose from.

I'm a novice with BASH so any tips would be very appreciated. smile

#!/bin/sh
#
# ~/.xinitrc
#Tweaked by absolutezero1287
#absolutezero1287@gmail.com
#
# 
export LC_ALL=C
#^fluxbox cries if this isn't set
#
#
DEF='fluxbox -log "/home/user/.log/fb-log"'
#the defualt WM is to be used with rl 3
#
ALT1='awesome'
#ALT1 is the wm to be used with rl 2
#
ALT2=''
#ALT2 is the wm to be used with rl 4
#
ALT3=''
#ALT3 is to be used with rl 5
#since rl 5 boots into X11 automatically
#it may be wise to have gnome-session as ALT3 
#this being because gdm handles 
#multiple sessions very well
#however, I don't like the bloat.
#
#STARTUP PROGRAMS/SCRIPTS
#I only need one
#but mabe you'd like different
#startup scripts for different WM/Des
#or none at all?
START='bash /home/user/Scipts/startup'
#
#
#
$START
##BEGIN LIST OF AVAILABLE WM/DEs
# exec startfluxbox
# exec fluxbox
# exec awesome
#
#
#
#
#
#
##END LIST OF AVAILABLE WM/DEs
exec $DEF
#since the script has yet to be perfect we'll
#leave the default wm set
#
#Runlevel?
rl=$(runlevel | grep -o [0-6])
#case $rl in
#    4) exec gnome-session;;
#    5) exec openbox-session;;
#esac
#^stolen from the archwiki :)
#
#
##Start an if/then here
#the purpose of this part of the script is for 
#a wm to be chosen based on the current runlevel
#
#
#
#if $rl=3
#then exec $DEF
#
#elif $rl=2
#then exec $ALT1
#
#elif $rl=4
#then exec $ALT2
#
#elif $rl=5
#then exec $ALT3
#
#fi

A simpler and more preffered option would be to script a login manager to run at boot.
Maybe add something like this to initab:
x:5:once:/bin/su USER -l -c "/bin/bash --login -c /home/USER/Scripts/startup_choice"
^compliments of MrElendig
If I did something like that would I still have to input a password?

#/bin/bash
#something like this?
#maybe have it run when runlevel 5 is chosen?
echo 'Choose your preffered WM from the list'
echo '1 awesome'
echo '2 fluxbox'
read $1 $2
if $1
then exec awesome
elif $2
then exec fluxbox
fi

Last edited by absolutezero1287 (2009-01-24 03:09:22)

Offline

#2 2009-01-22 21:18:02

ghostHack
Member
From: Bristol UK
Registered: 2008-02-29
Posts: 261

Re: [SOLVED]Help on a slightly different way to start multiple DEs

why not just set your .xinitrc up to accept arguments.

#!/bin/sh

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

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

case "$1" in
    openbox) exec ck-launch-session openbox-session ;;
    fluxbox) exec ck-launch-session startfluxbox ;;
    xfce4) exec ck-launch-session startxfce4 ;;
    kde4) exec ck-launch-session startkde ;;
    gnome) exec ck-launch-session gnome-session ;;
    e17) exec ck-launch-session /usr/bin/enlightenment_start ;;
    e16) exec ck-launch-session /usr/bin/starte16 ;;
    pekwm) exec ck-launch-session /usr/bin/pekwm ;;
    ratpoison) exec ck-launch-session ratpoison ;;
    awesome) exec ck-launch-session $HOME/bin/run_awesome ;;
    dwm) exec ck-launch-session $HOME/bin/dwm_run ;;
    wmii) until wmii; do true ; done  ;;
    icewm) exec icewm-session ;;
    xmonad) exec ck-launch-session xmonad ;;
    blackbox) exec ck-launch-session blackbox ;;
    *) exec ck-launch-session openbox-session ;;
esac

That way you can boot to runlevel 3, login and then just issue

xinit fluxbox

or

xinit awesome

depending on your mood.

Offline

#3 2009-01-23 02:22:48

absolutezero1287
Member
Registered: 2008-11-13
Posts: 133

Re: [SOLVED]Help on a slightly different way to start multiple DEs

@ghostHack: I had never thought of that. I'm still a novice in bash. I'm think I'm gonna give that a shot. I still have a question, though. What does "ck-launch-session" do?

Last edited by absolutezero1287 (2009-01-23 04:05:22)

Offline

#4 2009-01-23 17:06:22

ghostHack
Member
From: Bristol UK
Registered: 2008-02-29
Posts: 261

Re: [SOLVED]Help on a slightly different way to start multiple DEs

That starts and attaches a console-kit session to your X session, its needed for the hal in [testing].  If you don't run [testing] I don't think you'll need it (yet).

Offline

#5 2009-01-23 18:03:13

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: [SOLVED]Help on a slightly different way to start multiple DEs

If you are interested to a ready-to-go solution, qingy lets you choose the WM from runlevel 3.


Mortuus in anima, curam gero cutis

Offline

#6 2009-01-23 18:29:10

kludge
Member
Registered: 2008-08-03
Posts: 294

Re: [SOLVED]Help on a slightly different way to start multiple DEs

patroclo7 wrote:

If you are interested to a ready-to-go solution, qingy lets you choose the WM from runlevel 3.

yeah, qingy is theoretically really cool, and i use it now, but i'm considering a scripted solution because:

1) each instance of qingy takes 5 MB just sitting there waiting for me to login.
2) it routinely--but not reliably--segfaults when i switch between vcs, which is *especially* annoying when i have an x session running on one of them.
3) when it doesn't segfault between vc's, it also frequently--but again, not reliably--screws up input on the consoles.

so as not to hijack--but maybe to broaden the scope of--this thread, anyone know of a simple and stable *getty that could, for example, take an argument to the username and pass it to, e.g.: .bashrc?


[23:00:16]    dr_kludge | i want to invent an olfactory human-computer interface, integrate it into the web standards, then produce my own forked browser.
[23:00:32]    dr_kludge | can you guess what i'd call it?
[23:01:16]    dr_kludge | nosilla.
[23:01:32]    dr_kludge | i really should be going to bed.  i'm giggling madly about that.

Offline

#7 2009-01-24 03:08:30

absolutezero1287
Member
Registered: 2008-11-13
Posts: 133

Re: [SOLVED]Help on a slightly different way to start multiple DEs

thanks all but the scripted solution works nicely.

Offline

Board footer

Powered by FluxBB