Linux Red Hat 5.6 和 VNC:KDE 和 VNC侏儒

发布于 2024-12-01 06:21:50 字数 667 浏览 1 评论 0原文

我正在使用 Red Hat 5.6,并且我已经为我的 Unix 用户配置了 VNC,没有出现任何问题。我能够登录它,它默认为 Gnome。机器上安装了 KDE,我想使用它。下面是我的 ~/.vnc/xstartup 文件。

我尝试用“startkde &”替换下面的 twm但没有成功。尽管下面显示了 twm,但 Gnome 似乎是默认桌面,即使我更改了它,它也不起作用。即使没有列出桌面,Gnome 仍然会启动。

有谁知道为什么会发生这种情况以及如何启动其他桌面?

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
vncconfig -nowin &
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

I am using Red Hat 5.6 and I have configured VNC for my Unix user with no issues. I am able to log into it and it defaults to Gnome. KDE is installed on the machine and I would like to use it. Below is my ~/.vnc/xstartup file.

I tried replacing twm below with "startkde &" but it didn't work. Gnome seems to be the default desktop even though twm is shown below and even once I change it, it doesn't work. Even with no desktop listed, Gnome still starts.

Does anyone know why this is happening and how I can start other desktops?

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
vncconfig -nowin &
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

东走西顾 2024-12-08 06:21:50

该脚本永远不会到达底部,因为“exec”导致当前进程被 exec 的目标替换,在本例中是脚本 /etc/X11/xinit/xinitrc,它来源 /etc/X11/ Xsession 脚本,依次执行 /etc/X11/Xsession.d 的运行部分,调用默认的 x-session-manager,即 gnome-session。

The script is never getting to the bottom part, as 'exec' causes the current process to be replaced by the target of the exec, in this case the script /etc/X11/xinit/xinitrc, which sources the /etc/X11/Xsession script, which in turn does run-parts of /etc/X11/Xsession.d, invoking the default x-session-manager, which is gnome-session.

浅紫色的梦幻 2024-12-08 06:21:50

只是记录一个如何启动 KDE(适用于 Centos7)的示例,请参见下文:

#!/bin/sh

[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
export LANG
export SYSFONT
vncconfig -iconic &
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

DSKTPSTARTKDE="$(type -p startkde)"

  # KDE.
  echo "KDE session"

  exec "$DSKTPSTARTKDE"

下面是在 Centos7 上启动 KDE、MATE 或 Gnome 的更复杂的原文。

#!/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

Just to record a example of how to start up KDE (works on Centos7), see below:

#!/bin/sh

[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
export LANG
export SYSFONT
vncconfig -iconic &
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

DSKTPSTARTKDE="$(type -p startkde)"

  # KDE.
  echo "KDE session"

  exec "$DSKTPSTARTKDE"

Below is the more complex original to start KDE, MATE or Gnome, on Centos7.

#!/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
铁轨上的流浪者 2024-12-08 06:21:50

只是想补充一点,在将 exec 放在配置文件的底部之后,这在我的 rhel9 上有效。

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
vncconfig -nowin &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

exec /etc/X11/xinit/xinitrc

Just want to add that this worked on my rhel9, after putting exec on the bottom of the config file.

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
vncconfig -nowin &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

exec /etc/X11/xinit/xinitrc
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文