algo updated

This commit is contained in:
Simon Vieille 2015-03-13 16:56:16 +01:00
parent dcc51dde70
commit af1d099baa
2 changed files with 6 additions and 3 deletions

View file

@ -2,6 +2,7 @@
MONITOR1_WIDTH=$1 MONITOR1_WIDTH=$1
MONITOR2_WIDTH=$2 MONITOR2_WIDTH=$2
MONITOR3_WIDTH=$3
getMouseX() { getMouseX() {
xdotool getmouselocation 2>/dev/null | awk '{ print $1 }' | cut -d: -f2 xdotool getmouselocation 2>/dev/null | awk '{ print $1 }' | cut -d: -f2
@ -9,9 +10,11 @@ getMouseX() {
getMouveNextX() { getMouveNextX() {
if [ $(getMouseX) -lt $MONITOR1_WIDTH ]; then if [ $(getMouseX) -lt $MONITOR1_WIDTH ]; then
echo "$MONITOR1_WIDTH+$MONITOR2_WIDTH/2-10" | bc echo $(($MONITOR1_WIDTH + $MONITOR2_WIDTH / 2 - 10))
elif [ $(getMouseX) -lt $(($MONITOR1_WIDTH + $MONITOR2_WIDTH)) ]; then
echo $(($MONITOR1_WIDTH + $MONITOR2_WIDTH + $MONITOR3_WIDTH / 2 - 10))
else else
echo "$MONITOR1_WIDTH/2-10" | bc echo $((MONITOR1_WIDTH / 2 - 10))
fi fi
} }

View file

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
exec ~/bin/i3_switch_monitor.sh 1920 1920 exec ~/bin/i3_switch_monitor.sh 1920 1920 1024