xinitrc-common 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
  2. # copyrighted material is made available to anyone wishing to use, modify,
  3. # copy, or redistribute it subject to the terms and conditions of the
  4. # GNU General Public License version 2.
  5. #
  6. # You should have received a copy of the GNU General Public License
  7. # along with this program; if not, write to the Free Software
  8. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  9. # xinitrc-common
  10. #
  11. # This is common code shared by both Xsession and xinitrc scripts. Be sure
  12. # to take this into account when fixing bugs or adding new functionality.
  13. # Set up i18n environment
  14. if [ -r /etc/profile.d/lang.sh ]; then
  15. . /etc/profile.d/lang.sh
  16. fi
  17. userresources=$HOME/.Xresources
  18. usermodmap=$HOME/.Xmodmap
  19. userxkbmap=$HOME/.Xkbmap
  20. sysresources=/etc/X11/Xresources
  21. sysmodmap=/etc/X11/Xmodmap
  22. sysxkbmap=/etc/X11/Xkbmap
  23. # merge in defaults
  24. [ -r "$sysresources" ] && xrdb -nocpp -merge "$sysresources"
  25. [ -r "$userresources" ] && xrdb -merge "$userresources"
  26. # merge in keymaps
  27. if [ -r "$sysxkbmap" ]; then
  28. setxkbmap $(cat "$sysxkbmap")
  29. XKB_IN_USE=yes
  30. fi
  31. if [ -r "$userxkbmap" ]; then
  32. setxkbmap $(cat "$userxkbmap")
  33. XKB_IN_USE=yes
  34. fi
  35. # xkb and xmodmap don't play nice together
  36. if [ -z "$XKB_IN_USE" ]; then
  37. [ -r "$sysmodmap" ] && xmodmap "$sysmodmap"
  38. [ -r "$usermodmap" ] && xmodmap "$usermodmap"
  39. fi
  40. unset XKB_IN_USE
  41. # run all system xinitrc shell scripts.
  42. for file in /etc/X11/xinit/xinitrc.d/* ; do
  43. . $file
  44. done
  45. # Prefix launch of session with ssh-agent if available and not already running.
  46. SSH_AGENT=
  47. if [ -z "$SSH_AGENT_PID" ] && [ -x /usr/bin/ssh-agent ]; then
  48. if [ "x$TMPDIR" != "x" ]; then
  49. SSH_AGENT="/usr/bin/ssh-agent /bin/env TMPDIR=$TMPDIR"
  50. else
  51. SSH_AGENT="/usr/bin/ssh-agent"
  52. fi
  53. fi
  54. CK_XINIT_SESSION=
  55. if [ -z "$XDG_SESSION_COOKIE" ] && [ -x /usr/bin/ck-xinit-session ]; then
  56. CK_XINIT_SESSION="/usr/bin/ck-xinit-session"
  57. fi