Skip to content

Instantly share code, notes, and snippets.

@da-h
Created January 10, 2019 14:23
Show Gist options
  • Save da-h/43e7c6685c240b1d1148f10ca988f461 to your computer and use it in GitHub Desktop.
Save da-h/43e7c6685c240b1d1148f10ca988f461 to your computer and use it in GitHub Desktop.
#!/bin/bash
# needs https://github.com/wmutils/core for wattr
eval $(xdotool getmouselocation --shell)
IFS=" " read -a window <<< $(wattr whxy $(bspc query -N -n focused))
north=$(( Y - window[3]))
west=$(( X - window[2]))
width=${window[0]}
height=${window[1]}
if [ "$1" = "right" ]; then
ratio=$(echo "$west / $width" | bc -l)
bspc node -p east -o $ratio
elif [ "$1" = "left" ]; then
ratio=$(echo "$west / $width" | bc -l)
bspc node -p west -o $ratio
elif [ "$1" = "up" ]; then
ratio=$(echo "$north / $height" | bc -l)
bspc node -p north -o $ratio
elif [ "$1" = "down" ]; then
ratio=$(echo "$north / $height" | bc -l)
bspc node -p south -o $ratio
fi
terminal
bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment