Skip to content

Instantly share code, notes, and snippets.

@sumeet
Last active June 17, 2022 22:30
Show Gist options
  • Save sumeet/30242cef3efcb1979c8b993e16bf8df0 to your computer and use it in GitHub Desktop.
Save sumeet/30242cef3efcb1979c8b993e16bf8df0 to your computer and use it in GitHub Desktop.
#!/usr/bin/sh
# which window to be warped to
dir=$1
fwid=$(bspc query -N -n $dir)
if [ -n "$fwid" ] ; then
wattr wh $fwid | {
read width height
# decide the split direction before warping to a new container
#
# to your preference, you can try reversing these, and you can
# always `bspc node @parent -R 90` to adjust the rotation manually
if [ $width -gt $height ] ; then
split_dir=south
else
split_dir=west
fi
# mark focused node
bspc node -g marked
# correctly split the "to be warped to" window
bspc node $dir -p $split_dir
# warp
bspc node newest.marked.local -n newest.!automatic.local
}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment