doti3/i3_switch_monitor.sh
2015-03-02 19:19:02 +01:00

23 lines
366 B
Bash
Executable file

#!/bin/sh
MONITOR1_WIDTH=$1
MONITOR2_WIDTH=$2
getMouseX() {
xdotool getmouselocation 2>/dev/null | awk '{ print $1 }' | cut -d: -f2
}
getMouveNextX() {
if [ $(getMouseX) -lt $MONITOR1_WIDTH ]; then
echo "$MONITOR1_WIDTH+$MONITOR2_WIDTH/2-10" | bc
else
echo "$MONITOR1_WIDTH/2-10" | bc
fi
}
moveTo() {
xdotool mousemove $1 540
}
moveTo $(getMouveNextX)