Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Copyright (C) 2008 Nayanajit Mahendra Laxaman mail: nmlaxaman@gmail.com
- # This program is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or
- # (at your option) any later version.
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #input format
- #:1 -auth /var/lib/gdm/:1.Xauth -nolisten tcp vt8
- LOG=/tmp/duauto.log
- export DISPLAY=:0
- export XAUTHORITY="/var/lib/gdm/:0.Xauth"
- echo $DISPLAY >> $LOG
- echo $XAUTHORITY >> $LOG
- PARAMS=$@
- echo $PARAMS >> $LOG
- keyboards=( echo $(ls -l /dev/input/by-path/ | grep -event- | grep kbd | awk -F '../' {'print $2'}) )
- mouses=( echo $(ls -l /dev/input/by-path/ | grep -event- | grep mouse | awk -F '../' {'print $2'}) )
- pkeyboards=($(ls /dev/input/by-path/ | grep -event- | grep kbd ))
- pmouses=($(ls /dev/input/by-path/ | grep -event- | grep mouse ))
- keyboards=$pkeyboards
- mouses=$pmouses
- kbd1=${keyboards[1]}
- kbd2=${keyboards[2]}
- mouse1=${mouses[1]}
- mouse2=${mouses[2]}
- screen1="1440x900@0+0+0"
- screen2="1440x900@0+1440+0"
- ac1=1
- ac2=2
- #PARAMS="dpms -switchCmd echo -2button -nozap -br $PARAMS"
- PARAMS="dpms -nozap -br $PARAMS"
- command=
- if [[ $1 == :1 ]]; then
- 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"
- fi
- if [[ $1 == :2 ]]; then
- 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"
- fi
- echo $command >> $LOG
- echo '<<>>' >> $LOG
- exec $command
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement