Xsession 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/sh
  2. #
  3. # LightDM wrapper to run around X sessions.
  4. echo "Running X session wrapper"
  5. # Load profile
  6. for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
  7. if [ -f "$file" ]; then
  8. echo "Loading profile from $file";
  9. . "$file"
  10. fi
  11. done
  12. # Load resources
  13. for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do
  14. if [ -f "$file" ]; then
  15. echo "Loading resource: $file"
  16. xrdb -nocpp -merge "$file"
  17. fi
  18. done
  19. # Load keymaps
  20. for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
  21. if [ -f "$file" ]; then
  22. echo "Loading keymap: $file"
  23. setxkbmap `cat "$file"`
  24. XKB_IN_USE=yes
  25. fi
  26. done
  27. # Load xmodmap if not using XKB
  28. if [ -z "$XKB_IN_USE" ]; then
  29. for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
  30. if [ -f "$file" ]; then
  31. echo "Loading modmap: $file"
  32. xmodmap "$file"
  33. fi
  34. done
  35. fi
  36. unset XKB_IN_USE
  37. # /etc/X11/xinit/xinitrc.d/80-dbus expects $command to be
  38. # set to the Xsession arguments. So make it happy. See
  39. # https://bugs.gentoo.org/show_bug.cgi?id=533456
  40. command="$@"
  41. # Run all system xinitrc shell scripts.
  42. xinitdir="/etc/X11/xinit/xinitrc.d"
  43. if [ -d "$xinitdir" ]; then
  44. for script in $xinitdir/*; do
  45. echo "Loading xinit script $script"
  46. if [ -x "$script" -a ! -d "$script" ]; then
  47. . "$script"
  48. fi
  49. done
  50. fi
  51. # Load Xsession scripts
  52. xsessionddir="/etc/X11/Xsession.d"
  53. if [ -d "$xsessionddir" ]; then
  54. for i in `ls $xsessionddir`; do
  55. script="$xsessionddir/$i"
  56. echo "Loading X session script $script"
  57. if [ -r "$script" -a -f "$script" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
  58. . "$script"
  59. fi
  60. done
  61. fi
  62. echo "X session wrapper complete, running session $@"
  63. exec $command