Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2010
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.01 KB | None | 0 0
  1. #!/bin/bash
  2. # Copyright (C) 2008 Nayanajit Mahendra Laxaman mail: nmlaxaman@gmail.com
  3.  
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2 of the License, or
  7. # (at your option) any later version.
  8.  
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #input format
  14. #:1 -auth /var/lib/gdm/:1.Xauth -nolisten tcp vt8
  15.  
  16. LOG=/tmp/duauto.log
  17. export DISPLAY=:0
  18. export XAUTHORITY="/var/lib/gdm/:0.Xauth"
  19. echo $DISPLAY >> $LOG
  20. echo $XAUTHORITY >> $LOG
  21.  
  22. PARAMS=$@
  23. echo $PARAMS >> $LOG
  24.  
  25. keyboards=( echo $(ls -l /dev/input/by-path/ | grep -event- | grep kbd | awk -F '../' {'print $2'}) )
  26. mouses=( echo $(ls -l /dev/input/by-path/ | grep -event- | grep mouse | awk -F '../' {'print $2'}) )
  27.  
  28. pkeyboards=($(ls /dev/input/by-path/ | grep -event- | grep kbd ))
  29. pmouses=($(ls /dev/input/by-path/ | grep -event- | grep mouse ))
  30.  
  31. keyboards=$pkeyboards
  32. mouses=$pmouses
  33.  
  34.  
  35. kbd1=${keyboards[1]}
  36. kbd2=${keyboards[2]}
  37.  
  38. mouse1=${mouses[1]}
  39. mouse2=${mouses[2]}
  40.  
  41. screen1="1440x900@0+0+0"
  42. screen2="1440x900@0+1440+0"
  43.  
  44. ac1=1
  45. ac2=2
  46.  
  47. #PARAMS="dpms -switchCmd echo -2button -nozap -br $PARAMS"
  48. PARAMS="dpms -nozap -br $PARAMS"
  49.  
  50. command=
  51.  
  52. if [[ $1 == :1 ]]; then
  53. command="/usr/bin/Xephyr -ac :$ac1 -screen $screen1 -keybd evdev,,device=/dev/input/$kbd1,xkbrules=xorg,xkbmodel=evdev,xkblayout=us,CoreKeyboard -mouse evdev,,device=/dev/input/$mouse1,Emulate3Buttons=true,CorePointer $PARAMS"
  54. fi
  55.  
  56. if [[ $1 == :2 ]]; then
  57. command="/usr/bin/Xephyr -ac :$ac2 -screen $screen2 -keybd evdev,,device=/dev/input/$kbd2,xkbrules=xorg,xkbmodel=evdev,xkblayout=us,CoreKeyboard -mouse evdev,,device=/dev/input/$mouse2,Emulate3Buttons=true,CorePointer $PARAMS"
  58. fi
  59.  
  60. echo $command >> $LOG
  61. echo '<<>>' >> $LOG
  62. exec $command
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement