.xinitrc 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. #!/bin/sh
  2. # $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $
  3. #120718 redesign for startup on slow computers. see also /sbin/pup_event_frontend_d and delayedrun.
  4. #130202 xrandr set vert freq. see also /usr/sbin/quicksetup.
  5. #130212 removed glipper code, see latest glipper pet.
  6. #130525 old pc celeron 2ghz cpu, 256mb ram, CPUSPEED=1999, 1st bootup rox failed to start. try experiment.
  7. . /etc/rc.d/PUPSTATE
  8. if [ -f /root/.jwm/jwm_colors ];then #v3.96
  9. . /root/.jwm/jwm_colors
  10. fi
  11. #v4.01 BK daemon to handle kernel uevents...
  12. /sbin/clean_desk_icons #v4.02 tidy up drive icons first.
  13. #/sbin/pup_event_frontend_d &
  14. #130525 ...start this further down.
  15. #w482 reshape background image if widescreen...
  16. #120708 need to reshape for PUPMODE=2 also...
  17. #[ $PUPMODE -eq 5 ] && /usr/sbin/background_reshape
  18. NEEDRESHAPE='yes'
  19. [ -f /usr/share/backgrounds_original/ORIGINAL-default.jpg ] && NEEDRESHAPE='no'
  20. [ -f /usr/share/backgrounds_original/ORIGINAL-default.png ] && NEEDRESHAPE='no'
  21. [ "$NEEDRESHAPE" = "yes" ] && /usr/sbin/background_reshape
  22. userresources=$HOME/.Xresources
  23. usermodmap=$HOME/.Xmodmap
  24. sysresources=/usr/lib/X11/xinit/Xresources
  25. sysmodmap=/usr/lib/X11/xinit/.Xmodmap
  26. # merge in defaults and keymaps
  27. if [ -f $sysresources ]; then
  28. xrdb -merge -nocpp $sysresources
  29. fi
  30. if [ -f $sysmodmap ]; then
  31. xmodmap $sysmodmap
  32. fi
  33. if [ -f $userresources ]; then
  34. xrdb -merge -nocpp $userresources
  35. fi
  36. if [ -f $usermodmap ]; then
  37. xmodmap $usermodmap
  38. fi
  39. CURRENTWM="`cat /etc/windowmanager`"
  40. if [ "$CURRENTWM" = "startkde" ];then
  41. /sbin/pup_event_frontend_d & #130525
  42. exec startkde
  43. fi
  44. #100501 if full nvidia pkg installed, it has a gui config app...
  45. [ -f /root/.nvidia-settings-rc ] && nvidia-settings --load-config-only
  46. [ -f $HOME/.xgamma-gamma ] && /bin/sh $HOME/.xgamma-gamma #100215 see /usr/sbin/xgamma-gui.
  47. #0.9.8 sync selection-buffer and clipboard. only useful for older apps
  48. #such as rxvt that use the selection-buffer...
  49. [ -f /usr/bin/autocutsel ] && /usr/bin/autocutsel &
  50. #...disadvantage of this is it creates a little square bottom-right of screen.
  51. if [ -e /tmp/videomode ];then #xvesa only: testing a video mode
  52. video-wizard &
  53. fi
  54. [ -f /usr/local/bin/agenda_chk ] && agenda_chk &
  55. #v1.0.7 set by xrandrshell, part of xorg wizard... v3.99...
  56. if [ -f /etc/xrandrindex ];then
  57. #v3.99 workround for dual monitors, 'head -n 1'....
  58. XRANDRDEFAULT="$(xrandr -q | grep '\*' | tr -s ' ' | grep '^ [0-9]' | cut -f 2,3 -d ' ' | cut -f 1 -d '*' | tr ' ' '@' | head -n 1)" #130202 return 1024x768@60.0
  59. XRANDRINDEX="`cat /etc/xrandrindex`" #v3.99 XRANDRINDEX now is XxY resolution. #130202 now vertxhoriz@freq (refer quicksetup).
  60. #but do not switch if default is already this resolution....
  61. if [ "$XRANDRINDEX" = "$XRANDRDEFAULT" ];then
  62. rm -f /etc/xrandrindex
  63. else
  64. NEW_XY="$(echo -n "$XRANDRINDEX" | cut -f 1 -d '@')" #130202
  65. NEW_VFREQ="$(echo -n "$XRANDRINDEX" | cut -f 2 -d '@')" #130202
  66. xrandr -s $NEW_XY -r $NEW_VFREQ #130202
  67. fi
  68. fi
  69. if [ -f /root/.xset.sh ];then
  70. #this is created by /usr/bin/pupx...
  71. eval "/root/.xset.sh"
  72. else
  73. ##Xorg has it's own fontpath settings in /etc/X11/xorg.conf...
  74. #if [ "`readlink /usr/bin/X`" != "Xorg" ];then
  75. # #xset fp+ /usr/lib/X11/fonts/Type1/
  76. # #xset fp+ /usr/lib/X11/fonts/TTF/
  77. # xset fp+ /usr/share/fonts/default/Type1/
  78. # xset fp+ /usr/share/fonts/default/TTF/
  79. #fi
  80. xset s 600 600 s blank
  81. fi
  82. #v1.0.7 also see /etc/rc.d/rc.local0
  83. if [ -f /root/.fonts/fonts.dir ];then
  84. xset fp+ /root/.fonts/
  85. fi
  86. [ -f /usr/bin/xsetroot ] && xsetroot -cursor_name top_left_arrow
  87. #v555 w003
  88. #[ -f /usr/bin/xfce-mcs-manager ] && xfce-mcs-manager
  89. #[ "$CURRENTWM" = "xfwm4" ] && xfce-mcs-manager
  90. #...no need to start it here, fvwm4 below will start it automatically.
  91. #relocates right-side icons to actual right-side of screen...
  92. /usr/sbin/fixPuppyPin /root/Choices/ROX-Filer/PuppyPin #v1.0.7
  93. #w468 on old PCs rox sometimes does not start, see further down...
  94. #120718 raspi sometimes need extra delay otherwise rox fails to start.
  95. CPUSPEED=`grep -m 1 -i '^cpu MHz' /proc/cpuinfo | tr -d ' ' | cut -f 2 -d ':' | cut -f 1 -d '.'` #my laptop: 933.000
  96. [ ! $CPUSPEED ] && CPUSPEED=`grep -m 1 -i '^bogomips' /proc/cpuinfo | tr -d ' ' | cut -f 2 -d ':' | cut -f 1 -d '.'` #120718 raspi: 697.95 my laptop: 4789.47
  97. [ ! $CPUSPEED ] && CPUSPEED=250
  98. [ $CPUSPEED -lt 700 ] && sleep 0.5
  99. [ $CPUSPEED -lt 400 ] && sleep 0.5
  100. if [ -f /root/Choices/ROX-Filer/PuppyPan1 ];then
  101. rox -p /root/Choices/ROX-Filer/PuppyPin -r /root/Choices/ROX-Filer/PuppyPan1
  102. else
  103. rox -p /root/Choices/ROX-Filer/PuppyPin
  104. fi
  105. /sbin/pup_event_frontend_d & #130525 moved down.
  106. #v2.0.0
  107. /usr/sbin/delayedrun &
  108. #v2.01 hide cursor when not moving... (setup in /usr/sbin/input-wizard)
  109. if [ -f /etc/mousehide ];then
  110. IDLETIME="`cat /etc/mousehide | cut -f 1 -d ','`"
  111. [ ! "$IDLETIME" = "0" ] && unclutter -idle $IDLETIME &
  112. fi
  113. ##v2.14 rarsa: update xdg menu for w.m. that do not allow includes...
  114. #which ${CURRENTWM}_menu_refresh && ${CURRENTWM}_menu_refresh
  115. #...no, now doing it differently, see /usr/sbin/fixmenus
  116. if [ "$CURRENTWM" = "xfwm4" ];then
  117. if [ "`which xfce4-panel`" != "" ];then
  118. xfwm4 --daemon #note, starts xfce-mcs-manager daemon also.
  119. exec xfce4-panel
  120. fi
  121. fi
  122. #v3.91 volume tray applet, thanks to hairywill... v3.96 MENU_BG variable...
  123. if [ -f /usr/bin/absvolume ];then
  124. if [ "$MENU_BG" = "" ];then
  125. absvolume &
  126. else
  127. absvolume -bg $MENU_BG &
  128. fi
  129. fi
  130. #v3.95 support fbpanel tray/taskbar...
  131. #only launch tray for w.m. without inbuilt tray...
  132. if [ "$CURRENTWM" != "jwm" -a "$CURRENTWM" != "icewm" ];then
  133. if [ -f /usr/bin/fbpanel ];then
  134. #a bit of a hack: when 3builddistro runs fixmenus, which calls variconlinks,
  135. #which populates /var/local/icons with symlinks, /usr/local/lib/X11/pixmaps
  136. #is not yet populated (happens at first boot, from default icon theme)...
  137. [ ! -e /var/local/icons/home48.png ] && ln -fs /usr/local/lib/X11/pixmaps/* /var/local/icons/
  138. fbpanel &
  139. fi
  140. [ -f /usr/bin/lxpanel ] && lxpanel &
  141. fi
  142. ##w468 rox may not start old hardware, try again... 120517 bring this back...
  143. ##PS="`ps`"
  144. ##if [ "`echo "$PS" | grep 'ROX\-Filer'`" = "" ];then
  145. #if ! busybox pidof ROX-Filer;then
  146. # touch /tmp/roxfilerstartupproblem #see /sbin/pup_event_frontend_d
  147. # sleep 0.5
  148. # if ! busybox pidof ROX-Filer;then #check again.
  149. # rox -p /root/Choices/ROX-Filer/PuppyPin
  150. # fi
  151. #fi
  152. #exec $CURRENTWM
  153. #v2.11 GuestToo suggested this improvement...
  154. which $CURRENTWM && exec $CURRENTWM
  155. [ -x $CURRENTWM ] && exec $CURRENTWM
  156. exec jwm
  157. ###END###