LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 03-30-2004, 10:12 PM   #1
TheBartman
LQ Newbie
 
Registered: Aug 2003
Location: Earth
Distribution: Debian SID, Kanotix. Knoppix, Slackware 9.1
Posts: 26

Rep: Reputation: 15
How to change Desktop environment, xinitrc & xsession


Hello, I'm on Debian unstable. I have this problem with desktop environment.

Background on Problems:
Specifically speaking, it is with the ability to switch between KDE 3.2 and Gnome. I heard that one can do so by editing the .xinitrc file (i.e by adding exec gnome-session). I did a locate xinitrc and found it resides only in /etc/xinit/. But 2 Xsessions exist, one in /etc/X11/ and the other is in /etc/kde3/kdm/. There is however, no .xinitrc file in the home directories of other users on the same box. I can log into Gnome as root, see the desktop in its full glory but when I tried to do so as a normal user, I can't get into Gnome. What I was presented with was just the default wallpaper background and not even a bootsplash. I understand that one should unless necessary avoid logging in as root but without doing so I can't get to use Gnome as a normal user.

Questions:
1.
How can I specify the default desktop environment to use for different users on a system (e.g. user 1 use Gnome, User 2 use Kde, User 3 use AfterStep)?

2.
Is it a must that I create separate .xinitrc files for each and every user in their home directories on my system?

3.
What should the entries in .xinitrc be?

4.
Should I add exec gnome-session at the end of the xinitrc files (if there's a need for me to create separate xinitrc file for each and every user that is) after the line '. /etc/X11/Xsession' in each of the users' home directories?

5.
Do the contents for each of these xinitrc files for the different users resemble the one in /etc/xinit/xinitrc except for the exec gnome-session or exec startkde portion?

6.
What other files do I need to make changes to? Would the installation of gdm be better if one prefers to use Gnome instead of Kde?

7.)
Can I have multiple desktop environment/window manager options such as startkde, gnome-session in the same xinitrc file without confusing either kdm or gdm as to which desktop environment/window manager I or other users on system wants to use?

8.)
Must I comment out exec startkde if I only want to use Gnome exclusively?


These are the xinitrc and Xsession files I manage to find on my box...

1.)
Xsession:

Code:
 
#!/bin/sh
#
# /etc/X11/Xsession
#
# global Xsession file -- used by display managers and xinit (startx)

# $Id: Xsession 1119 2004-03-01 15:40:14Z branden $

#set -e

PROGNAME=Xsession

message () {
  # pretty-print messages of arbitrary length; use xmessage if it
  # is available and $DISPLAY is set
  MESSAGE="$PROGNAME: $*"
  echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
  if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
    echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
  fi
}

message_nonl () {
  # pretty-print messages of arbitrary length (no trailing newline); use
  # xmessage if it is available and $DISPLAY is set
  MESSAGE="$PROGNAME: $*"
  echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2;
  if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
    echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
  fi
}

errormsg () {
  # exit script with error
  message "$*"
  exit 1
}

internal_errormsg () {
  # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
  # One big call to message() for the sake of xmessage; if we had two then
  # the user would have dismissed the error we want reported before seeing the
  # request to report it.
  errormsg "$*" \
           "Please report the installed version of the \"xfree86-common\"" \
           "package and the complete text of this error message to" \
           "<debian-x@lists.debian.org>."
}

run_parts () {
  # until run-parts --noexec is implemented
  if [ -z "$1" ]; then
    internal_errormsg "run_parts() called without an argument."
  fi
  if [ ! -d "$1" ]; then
    internal_errormsg "run_parts() called, but \"$1\" does not exist or is" \
                      "not a directory."
  fi
  for F in $(ls $1); do
    if expr "$F" : '[[:alnum:]_-]\+$' > /dev/null 2>&1; then
      if [ -f "$1/$F" ]; then
        echo "$1/$F"
      fi
    fi
  done
}

# initialize variables for use by all session scripts

OPTIONFILE=/etc/X11/Xsession.options

SYSRESOURCES=/etc/X11/Xresources
USRRESOURCES=$HOME/.Xresources

SYSSESSIONDIR=/etc/X11/Xsession.d
USERXSESSION=$HOME/.xsession
ALTUSERXSESSION=$HOME/.Xsession
ERRFILE=$HOME/.xsession-errors

# attempt to create an error file; abort if we cannot
if touch "$ERRFILE" 2> /dev/null && [ -w "$ERRFILE" ] &&
  [ ! -L "$ERRFILE" ]; then
  chmod 600 "$ERRFILE"
elif ERRFILE=$(tempfile 2> /dev/null); then
  if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-$USER"; then
    message "warning: unable to symlink \"$TMPDIR/xsession-$USER\" to" \
             "\"$ERRFILE\"; look for session log/errors in" \
             "\"$TMPDIR/xsession-$USER\"."
  fi
else
  errormsg "unable to create X session log/error file; aborting."
fi

exec > "$ERRFILE" 2>&1

# sanity check; is our session script directory present?
if [ ! -d "$SYSSESSIONDIR" ]; then
  errormsg "no \"$SYSSESSIONDIR\" directory found; aborting."
fi

# use run-parts to source every file in the session directory; we source
# instead of executing so that the variables and functions defined above
# are available to the scripts, and so that they can pass variables to each
# other
SESSIONFILES=$(run_parts $SYSSESSIONDIR)
if [ -n "$SESSIONFILES" ]; then
  for SESSIONFILE in $SESSIONFILES; do
    . $SESSIONFILE
  done
fi

exit 0

# vim:ai:et:sts=2:sw=2:tw=80:
2.) xinitrc

Code:
#!/bin/sh
# $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $

# /etc/X11/xinit/xinitrc
#
# global xinitrc file, used by all X sessions started by xinit (startx)

# invoke global X session script
. /etc/X11/Xsession
TIA.

Last edited by TheBartman; 03-30-2004 at 10:34 PM.
 
Old 03-31-2004, 10:44 AM   #2
sims
Member
 
Registered: Mar 2004
Location: Australia
Distribution: Debian, Ubuntu
Posts: 55

Rep: Reputation: 15
I'm sure there are different ways of solving this matter, but this is what I prefer:

Debian uses .xsession, not .xinitrc. Every user which don't want to use the system default, should create a .xsession file in his/her home directory. "exec gnome-session" is an example of what this file may contain, but you can also start other programs within the file, for example "xscreensaver --no-splah &".

Don't change the /etc/X11/Xsession and /etc/X11/xinit/xinitrc files. If you want to change the default behaviour for X, use update-alternatives;

update-alternatives --config x-window-manager
update-alternatives --config x-session-manager

With gdm/kdm users can choose which windowmanager to use, or also choose to use the .xsession file.
 
Old 03-31-2004, 11:27 AM   #3
TheBartman
LQ Newbie
 
Registered: Aug 2003
Location: Earth
Distribution: Debian SID, Kanotix. Knoppix, Slackware 9.1
Posts: 26

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by sims
I'm sure there are different ways of solving this matter, but this is what I prefer:

Debian uses .xsession, not .xinitrc. Every user which don't want to use the system default, should create a .xsession file in his/her home directory. "exec gnome-session" is an example of what this file may contain, but you can also start other programs within the file, for example "xscreensaver --no-splah &".

Don't change the /etc/X11/Xsession and /etc/X11/xinit/xinitrc files. If you want to change the default behaviour for X, use update-alternatives;

update-alternatives --config x-window-manager
update-alternatives --config x-session-manager

With gdm/kdm users can choose which windowmanager to use, or also choose to use the .xsession file.
Thanks for the information sims but where should I slot the entry 'exec gnome-session'? i.e. which portion of the Xsession file in say user 'anonymous' i.e. /home/anonymous/Xsession? How would this Xsession in /home/anonymous/ differ from /etc/X11/Xsession?



Can I also have an entry 'exec startkde' in this Xsession file and where like above where should I enter this entry?



I was presented with the following when I issued the command 'update-alternatives --config x-window-manager'

root@security:/home/anonymous# update-alternatives --config x-window-manager

There are 5 alternatives which provide `x-window-manager'.

Selection Alternative
-----------------------------------------------
1 /usr/X11R6/bin/twm
2 /usr/bin/icewm
*+ 3 /usr/bin/metacity
4 /usr/bin/icewm-gnome
5 /usr/bin/wmaker

Press enter to keep the default[*], or type selection number:
metacity seems to be the right one for Gnome right?

Last edited by TheBartman; 03-31-2004 at 11:32 AM.
 
Old 03-31-2004, 12:39 PM   #4
sims
Member
 
Registered: Mar 2004
Location: Australia
Distribution: Debian, Ubuntu
Posts: 55

Rep: Reputation: 15
The file for user anonymous would be /home/anonymous/.xsession, not Xsession. Start with a blank .xsession file. The line "exec gnome-session" should be enough for GNOME to start. Here is an exmple of my .xsession file:

Code:
# background image
bsetbg -center evil_debian.png

# a few apps
wmsysmon &
wmcpuload &
wmfsm &
wmnd &
wmclock &

# the xscreensaver
xscreensaver -no-splash &

# the window manager itself
exec openbox
So basically the only line you need is the one who starts the window manager. I'm not sure about GNOME, but i assume gnome-session starts metacity etc. I think metacity is the preferred window manager for GNOME.
 
Old 03-31-2004, 04:33 PM   #5
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 50
don't forget to chmod +x your .xsession file
bbpager&
fbpanel&
gkrellm&
xfe&
exec hackedbox
 
Old 03-31-2004, 10:04 PM   #6
TheBartman
LQ Newbie
 
Registered: Aug 2003
Location: Earth
Distribution: Debian SID, Kanotix. Knoppix, Slackware 9.1
Posts: 26

Original Poster
Rep: Reputation: 15
Thank you both sims and mrcheeks. hehehe Blackbox, Openbox and Hackbox - wonderful simple yet very stylish window managers all, aren't they? No worries, I'll create another xsession (as opposed to Xsession) file for another user on this box.

Anyway below is what I have for the xsession file created using kwrite in /home/anonymous/

#!/bin/sh
# Processes monitor
gkrellm &
exec gnome-session

...which I then cd to /home/anonymous did a chmod +x xsession from the konsole. I hope this should do it. Once again thanks all.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.xinitrc and .xsession ignored Whitman Debian 2 09-18-2005 12:11 PM
.xinitrc vs. .Xdefaults vs .Xsession frankie_DJ Linux - Newbie 4 08-02-2005 05:39 AM
.Xsession .xinitrc a10392 Linux - Newbie 2 12-10-2004 02:34 PM
.xinitrc/.xsession - Where are they? Fluxbox the_rydster Slackware 3 03-07-2004 01:45 PM
No .Xdefaults, .xsession, .xinitrc madchmst82 Linux - Newbie 3 09-23-2003 07:05 PM


All times are GMT -5. The time now is 01:40 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration