Advertisement
Guest User

Untitled

a guest
Jun 4th, 2018
4,514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.77 KB | None | 0 0
  1. #!/bin/bash
  2. # needs https://github.com/wmutils/core for wattr
  3.  
  4. eval $(xdotool getmouselocation --shell)
  5. IFS=" " read -a window <<< $(wattr whxy $(bspc query -N -n focused))
  6.  
  7. north=$(( Y - window[3]))
  8. west=$(( X - window[2]))
  9. width=${window[0]}
  10. height=${window[1]}
  11.  
  12. if [ "$1" = "right" ]; then
  13.     ratio=$(echo "$west / $width" | bc -l)
  14.     bspc node -p east -o $ratio
  15. elif [ "$1" = "left" ]; then
  16.     ratio=$(echo "$west / $width" | bc -l)
  17.     bspc node -p west -o $ratio
  18. elif [ "$1" = "up" ]; then
  19.     ratio=$(echo "$north / $height" | bc -l)
  20.     bspc node -p north -o $ratio
  21. elif [ "$1" = "down" ]; then
  22.     ratio=$(echo "$north / $height" | bc -l)
  23.     bspc node -p south -o $ratio
  24. fi
  25.  
  26. terminal
  27.  
  28. bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement