Ask Your Question
1

What does the default ~/.vnc/xstartup do in tigervnc?

asked 2014-04-16 09:42:53 -0500

oglop gravatar image

hi all, i got tigervnc installed on my F20, but have a few questions about the default xstartup file

!/bin/sh

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

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
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &   
exec gnome-session &
exec /usr/bin/startkde &

can someone explain to me what it does ? basically i want to switch to lxde desktop, but i don't know what the majority of the code does. can someone explain this a little bit? thanks.

currently i'm using this ( commented out most of the stuff above )

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
# exec /usr/bin/startkde &
exec /usr/bin/startlxde &

my understanding of the default one is : unset 2 env var if is on linux and it did something when it's suse linux if /etc/X11/xinit/xinitrc exists, then run this file (twice ?) xsetroot -solid grey # and this is to solve some compatibility issues with some desktop managers, i read it somewhere but don't remeber where

and what does the xterm and twm call do ? and why it runs gnome-session?

i thought i only need one line ( the last line)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2014-04-17 16:32:42 -0500

cobra gravatar image

Just to add a little more to the comments by @fidelleon...

You really should start just one desktop environment. Also, you don't need to add the ampersand (&) symbol at the end, you do not need to run these as a background task. My .vnc/xstartup contains this (I've truncated this for brevity):

#!/bin/sh

xrdb $HOME/.Xresources
if [ `hostname -s` == 'srv' ]; then
    startxfce4
else
if [ `hostname -s` == 'raspi' ]; then
    openbox-session
else
    startxfce4
fi
fi

As you can see, my home (nfs mounted on different systems) will launch different DE's based on which host it's running on. I like it this way, use whatever you feel comfortable with.

edit flag offensive delete link more

Comments

Love your idea, thanks!!

fidelleon gravatar imagefidelleon ( 2014-04-18 13:06:26 -0500 )edit
2

answered 2014-04-17 08:29:19 -0500

fidelleon gravatar image

xstartup is nothing else than a shell script (note the #!/bin/sh in the fist line).

if [ -x /etc/X11/xinit/xinitrc ]; then
  exec /etc/X11/xinit/xinitrc
fi

If the file /etc/X11/xinit/xinitrc exists AND has the executable bit, run it. If the +x bit is not set, don't run.

if [ -f /etc/X11/xinit/xinitrc ]; then
  exec sh /etc/X11/xinit/xinitrc
fi

If the file /etc/X11/xinit/xinitrc exist AND is a regular file, execute it by using the sh shell. As you have noted, if the file exists, it's a regular file and also has executable bit, it would be execute twice.

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

Start a xterm window - a barebones terminal which is used by many Xorg packages:

# whereis xterm
xterm: /usr/bin/xterm /usr/share/man/man1/xterm.1.gz
# rpm -qf /usr/bin/xterm
xterm-303-1.fc21.i686
# repoquery --whatrequires xterm
9wm-0:1.2-7.fc20.i686
awesome-0:3.5.5-1.fc21.i686
cairo-dock-core-0:3.2.1-2.fc20.i686
clusterssh-0:4.02.03-1.fc21.noarch
codeblocks-0:13.12-3.fc21.i686
ddd-0:3.3.12-16.fc21.i686
dwm-0:6.0-8.fc21.i686
fvwm-0:2.6.5-6.fc20.i686
gmrun-0:0.9.2-30.fc20.i686
icewm-0:1.3.8-1.fc21.i686
jwm-0:2.2.0-1.fc21.i686
kdbg-1:2.5.4-1.fc21.i686
m2vmp2cut-0:0.86-2.fc19.i686
musca-0:0.9.24-7.fc20.i686
rasmol-0:2.7.5.2-2.fc21.i686
slim-0:1.3.6-1.fc21.i686
snotes-0:1.0-3.fc20.noarch
spectrwm-0:2.5.0-1.fc21.i686
streamtuner-0:2.0.8-12.fc20.noarch
surf-0:0.6-2.fc20.i686
tn5250-0:0.17.4-10.fc21.i686
uzbl-defaults-0:0-0.33.20120514git228bc38cbd.fc20.i686
wmx-0:7-12.20120109svn.fc20.i686
xmined-0:2013.23-2.fc21.i686
xmonad-basic-0:0.11-9.fc21.i686
xzgv-0:0.9.1-8.fc20.i686

And about the last lines:

twm &   
exec gnome-session &
exec /usr/bin/startkde &

Yeah, there's no point trying to run three desktop environments. This xstartup seems a skeleton you (or any application using it) need to modify.

twm is a very tiny window manager - here you have a screenshot which also shows xterm:

twm window manager

It was the standard "back in the day" - if you give Gentoo a try and follow its X installation, that's what you get before installing a modern window manager :)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-04-16 09:42:53 -0500

Seen: 16,530 times

Last updated: Apr 17 '14