diff --git a/i3_switch_monitor.sh b/i3_switch_monitor.sh index 34715b0..2bf4ce1 100755 --- a/i3_switch_monitor.sh +++ b/i3_switch_monitor.sh @@ -2,6 +2,7 @@ MONITOR1_WIDTH=$1 MONITOR2_WIDTH=$2 +MONITOR3_WIDTH=$3 getMouseX() { xdotool getmouselocation 2>/dev/null | awk '{ print $1 }' | cut -d: -f2 @@ -9,9 +10,11 @@ getMouseX() { getMouveNextX() { 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 - echo "$MONITOR1_WIDTH/2-10" | bc + echo $((MONITOR1_WIDTH / 2 - 10)) fi } diff --git a/i3_switch_monitor_wrapper.sh b/i3_switch_monitor_wrapper.sh index d40644c..12570ee 100755 --- a/i3_switch_monitor_wrapper.sh +++ b/i3_switch_monitor_wrapper.sh @@ -1,3 +1,3 @@ #!/bin/sh -exec ~/bin/i3_switch_monitor.sh 1920 1920 +exec ~/bin/i3_switch_monitor.sh 1920 1920 1024