My i3 configurations and scripts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

i3_switch_monitor.sh 558B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. MONITOR1_WIDTH=$1
  3. MONITOR2_WIDTH=$2
  4. MONITOR3_WIDTH=$3
  5. getMouseX() {
  6. xdotool getmouselocation 2>/dev/null | awk '{ print $1 }' | cut -d: -f2
  7. }
  8. getMouveNextX() {
  9. if [ $(getMouseX) -lt $MONITOR1_WIDTH ]; then
  10. echo $(($MONITOR1_WIDTH + $MONITOR2_WIDTH / 2 - 10))
  11. elif [ -n "$MONITOR3_WIDTH" -a $(getMouseX) -lt $(($MONITOR1_WIDTH + $MONITOR2_WIDTH)) ]; then
  12. echo $(($MONITOR1_WIDTH + $MONITOR2_WIDTH + $MONITOR3_WIDTH / 2 - 10))
  13. else
  14. echo $((MONITOR1_WIDTH / 2 - 10))
  15. fi
  16. }
  17. moveTo() {
  18. xdotool mousemove $1 540
  19. }
  20. moveTo $(getMouveNextX)