0

Rewriting to hopefully clarify the question.

MATE, KDE and Gnome3 have been installed on some Centos 7 servers. So have a mix of users and ideally want to default to MATE desktop. Is there any way to do this? Some of the users are still using an old centos6/gnome2 xstartup (and they don't seem to want to change it). So ideally want it to give them something else.

Now with Gnome3 as the default I can easily have a ~/.vnc/xstartup to allow an easy choice between them, and seems to work ok. It is shown below, but doesn't solve the default.

As Gnome3 is a bit heavy on resources really would like the default to be different, KDE would be fine, which can be done with:

echo "DESKTOP=KDE" > /etc/sysconfig/desktop

However once KDE is default, it seems impossible to select gnome-classic (MATE is fine), gnome-session comes up as KDE. Is there any way to select gnome-classic after KDE is the default?

Below is the multiple choice xstartup. Obviously most of it is a shameless copy from other answers, cobbled together as best as I understood it at the time. Uncommenting DSKTP* vars allows selection.

#!/bin/sh

[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
export LANG
export SYSFONT
vncconfig -iconic &
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
OS=`uname -s`
if [ $OS = 'Linux' ]; then
  case "$WINDOWMANAGER" in
    *gnome*)
      if [ -e /etc/SuSE-release ]; then
        PATH=$PATH:/opt/gnome/bin
        export PATH
      fi
      ;;
  esac
fi

## select a desktop preference MATE, KDE, DEFAULT.
# comment out mate to get kde, etc. If not there then will try the next.
DSKTPMSESSION="$(type -p mate-session)"
DSKTPSTARTKDE="$(type -p startkde)"
#DSKTPGSESSION="$(type -p gnome-session)"

if [ -n "$DSKTPMSESSION" ]; then
  # if MATE run that.
  echo "MATE session"
  # Start up the standard mate desktop

  exec "$DSKTPMSESSION"

  [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
  [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
  x-window-manager &

elif [ -n "$DSKTPSTARTKDE" ]; then
  # if MATE isn't installed, try KDE.
  echo "KDE session"
  unset SESSION_MANAGER
  unset DBUS_SESSION_BUS_ADDRESS

  exec "$DSKTPSTARTKDE"

elif [ -n "$DSKTPGSESSION" ]; then
  ################################ !!!!!!!!!!!!!!!!!! doesn't work
  # echo "DESKTOP=KDE" > /etc/sysconfig/desktop
  # KDE default on montpelier tricky to get back to gnome-classic
  # if MATE and KDE isn't installed, try Gnome3 or 2.
  echo "Gnome session"
  unset SESSION_MANAGER
  unset DBUS_SESSION_BUS_ADDRESS
  export GNOME_SHELL_SESSION_MODE=classic

  if [ -x /etc/X11/xinit/xinitrc ]; then
    exec /etc/X11/xinit/xinitrc
  fi
  if [ -f /etc/X11/xinit/xinitrc ]; then
    exec sh /etc/X11/xinit/xinitrc
  fi
  [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
  xset r off # switch off key repeat 
  xsetroot -solid grey
  xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
  exec "$DSKTPGSESSION"
  # below didn't work
  # exec "$DSKTPGSESSION --session=gnome-classic"
  
  ################ Still shows KDE on montpelier drat!!!!!!!!
  
else
  ## else is go with whatever is the standard probably GNOME3 on centos7
  ## echo "DESKTOP=KDE" > /etc/sysconfig/desktop ;# can switch the default
  echo "DEFAULT session"

  if [ -x /etc/X11/xinit/xinitrc ]; then
    exec /etc/X11/xinit/xinitrc
  fi
  if [ -f /etc/X11/xinit/xinitrc ]; then
    exec sh /etc/X11/xinit/xinitrc
  fi
  [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
  xset r off # switch off key repeat 
  xsetroot -solid grey
  xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
  twm &
fi
1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Sep 23 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.