gnomemplayershell 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/sh
  2. #130802 BK first version.
  3. MYVIDOUT="xv"
  4. XSERVER="$(readlink /usr/bin/X)"
  5. [ "$XSERVER" = "Xvesa" ] && MYVIDOUT="x11"
  6. VIDEODRIVER='vesa'
  7. if [ "$XSERVER" = "Xorg" ];then
  8. #xorg.conf does not necessarily tell us what driver is loaded.
  9. #got this code from /usr/sbin/report-video...
  10. LOADED="$(grep 'Loading .*/xorg/modules/drivers/.*_drv.so' /var/log/Xorg.0.log | rev | cut -f 1 -d '/' | rev | cut -f 1 -d '_' | tr '\n' ' ')"
  11. for ALOADED in $LOADED
  12. do
  13. aPTN="UnloadModule: \"$ALOADED\""
  14. bPTN="LoadModule: \"$ALOADED\""
  15. CNTload=`grep "$bPTN" /var/log/Xorg.0.log | wc -l`
  16. CNTunload=`grep "$aPTN" /var/log/Xorg.0.log | wc -l`
  17. [ $CNTload -eq 0 ] && continue
  18. [ $CNTunload -ge $CNTload ] && continue
  19. VIDEODRIVER="$ALOADED"
  20. break
  21. done
  22. fi
  23. case $VIDEODRIVER in
  24. vesa) MYVIDOUT="x11" ;;
  25. modesetting) MYVIDOUT="x11" ;;
  26. esac
  27. if [ "$MYVIDOUT" = "x11" ];then
  28. if [ "$(grep "<default>'x11'</default>" /usr/share/glib-2.0/schemas/apps.gnome-mplayer.preferences.gschema.xml)" = "" ];then
  29. if [ "$(grep "<default>'xv'</default>" /usr/share/glib-2.0/schemas/apps.gnome-mplayer.preferences.gschema.xml)" != "" ];then
  30. sed -i -e "s%<default>'xv'</default>%<default>'x11'</default>%" /usr/share/glib-2.0/schemas/apps.gnome-mplayer.preferences.gschema.xml
  31. [ -e /usr/bin/glib-compile-schemas ] && /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas
  32. fi
  33. fi
  34. else
  35. if [ "$(grep "<default>'xv'</default>" /usr/share/glib-2.0/schemas/apps.gnome-mplayer.preferences.gschema.xml)" = "" ];then
  36. if [ "$(grep "<default>'x11'</default>" /usr/share/glib-2.0/schemas/apps.gnome-mplayer.preferences.gschema.xml)" != "" ];then
  37. sed -i -e "s%<default>'x11'</default>%<default>'xv'</default>%" /usr/share/glib-2.0/schemas/apps.gnome-mplayer.preferences.gschema.xml
  38. [ -e /usr/bin/glib-compile-schemas ] && /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas
  39. fi
  40. fi
  41. fi
  42. #...i think gnome-mplayer will only read this file first time it starts. then it saves its prefs in compiled dconf i think.
  43. #turn off screensaver...
  44. TURNONAFTER=0
  45. if [ -e /root/.xset.sh ];then
  46. if [ "$(grep '^xset .* s off' /root/.xset.sh)" = "" ];then
  47. xset s off -dpms
  48. TURNONAFTER=1
  49. fi
  50. else
  51. xset s off -dpms
  52. TURNONAFTER=1
  53. fi
  54. gnome-mplayer "$@" ###RUN IT###
  55. [ $TURNONAFTER -eq 1 ] && xset s on
  56. ###END###