Advertisement
Guest User

NewRez

a guest
Mar 4th, 2012
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.36 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # newrez-v 0.04
  4. # marc brumlik, Mon Jan  2 02:09:34 CST 2012
  5.  
  6. # set up a "higher-rez" display by starting vncserver on port 5999
  7. # then viewing that session in scaled mode
  8.  
  9. echo -e "\nNOTE 1:\nAt the end of this script, the line which begins \"$server :99\"\ncontains two items you may wish to change:\n\t\"-depth 24\" sets the number of colors.  Choose from 8/15/15/24.\n\t\"-geometry=HHHxYYY\" sets the resolution.  Higher gives more work space.\n"
  10.  
  11. which vinagre >/dev/null 2>&1 || need0="vinagre"
  12. if uname -a | grep Ubuntu >/dev/null
  13.     then    which vnc4server >/dev/null 2>&1 || need1="vnc4server"
  14.         which gdm >/dev/null 2>&1 || need2="gdm"
  15.         which gdm >/dev/null 2>&1 || note="When installing gdm, choose \"lightdm\" as the default manager"
  16.         which gnome-wm >/dev/null 2>&1 || need3="gnome-panel"
  17.         which gconf-editor >/dev/null 2>&1 || need4="gconf-editor"
  18.         [ -n "$need4" ] && echo -e "\nIMPORTANT FOR UBUNTU USERS:\nThere is a problem with one of the default Gnome key-bindings.\nAfter installing gconf-editor, and before running newrez-v again,\nyou must do the following:\n\ttype: gconf-editor\n\tgo to: apps->metacity->global_keybindings\n\troll down to: show_desktop\n\tchange: \"<Super>d\" to \"<Ctrl><Alt>d\"\nTHIS MESSAGE WILL APPEAR ONLY ONCE!"
  19.         server=vnc4server
  20.         if [ -x /etc/X11/xinit/xinitrc ]
  21.             then    : already done
  22.             else    echo "Setting permissions on /etc/X11/xinit/xinitrc"
  23.                 sudo chmod 755 /etc/X11/xinit/xinitrc
  24.         fi
  25.     else    which vncserver >/dev/null 2>&1 || need1="tigervnc-server"
  26.         server=vncserver
  27. fi
  28.  
  29. need=`echo -e "$need0\n$need1\n$need2\n$need3\n$need4" | grep -v "^$"`
  30. case $need in
  31.     '') ;;
  32.     *)  echo -e "\nThis script needs the packages:"
  33.         echo -e "\n$need" | sed 's/^/   /'
  34.         echo -e "\nto be installed first!"
  35.         echo -e "$note\n"
  36.         exit 0 ;;
  37. esac
  38.  
  39. if test -f ~/.vnc/xstartup
  40.     then    : OK
  41.     else    echo -e "\n\tBefore this can be used, VNC server must be set up."
  42.         echo -e "\tThe password you assign can be stored in the VNC client."
  43.         echo -e "\n\tEach time you run this script, the server will be started,"
  44.         echo -e "\tthen the client, and when the client is exited, the server"
  45.         echo -e "\tthe server will be shut down.\n\n"
  46.         echo -e "\tALSO note that when your session starts up, it will"
  47.         echo -e "\ttake about 10 seconds before the panels are ready\n"
  48.         $server :99
  49.         $server -kill :99 >/dev/null 2>&1
  50. fi
  51.  
  52. if uname -a | grep -q Ubuntu
  53.     then    if grep -q "marc41.*rev-1" $HOME/.vnc/xstartup
  54.             then    createXstartup=y
  55.         fi
  56. fi
  57. if [ "createXstartup" = "y" ]
  58.     then    cat <<UbuntuXstartup >$HOME/.vnc/xstartup
  59. #!/bin/sh
  60.  
  61. # vnc xstartup file by [email protected] (marc41 on gnome-look.org) rev-1
  62.  
  63. unset SESSION_MANAGER
  64. unset DBUS_SESSION_BUS_ADDRESS
  65.  
  66. gnome-session --session=gnome-classic &
  67. # gnome-session --session=ubuntu-2d &
  68.  
  69. [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
  70. [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
  71. xsetroot -solid grey
  72. vncconfig -iconic &
  73. x-window-manager &
  74. UbuntuXstartup
  75. fi
  76.  
  77. if [ "createXstartup" = "y" ]
  78.     then    echo -e "\n\tThe file $HOME/.vnc/xstartup has been created for you\n\twith some reasonable defaults.\n\tYou may make changes, but retain the line\n\tthat contains \"marc41\" or this script will overwrite it."
  79. fi
  80.  
  81. $server :99 -name marc41:newrez -depth 16 -geometry 1280x800 >/dev/null 2>&1
  82. vinagre -f --vnc-scale ::5999 >/dev/null 2>&1
  83. $server -kill :99 >/dev/null 2>&1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement