-
-
Save emanuele6/9eab3f7867ea446f5e9bc6ce5561ebdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -- | |
case $# in | |
1) dir=$1 ;; | |
0) printf >&2 'No arguments given.\n'; exit 2 ;; | |
*) printf >&2 'Too many arguments.\n'; exit 2 ;; | |
esac | |
case $dir in | |
west|east|south|north) ;; | |
*) printf >&2 'Invalid argument: %s.\n' "${dir@Q}"; exit 2 ;; | |
esac | |
ensure_tiled () | |
{ | |
bspc query -N focused.window > /dev/null \ | |
|| return | |
bspc node 'focused.!tiled.!pseudo_tiled.window' -t '~' \ | |
&& bspc node 'focused.!tiled.!pseudo_tiled.window' -t tiled | |
} | |
bspc query -N -d focused.tiled > /dev/null \ | |
|| exit | |
if bspc query -N '@/.focused' > /dev/null; then | |
ensure_tiled | |
exit | |
fi | |
case $dir in | |
west|north) | |
bspc node '@/1.!focused' -s '@/2.focused' || { | |
bspc node '@/1.!focused#focused' -n '@/' \ | |
&& bspc node '@/1.!focused' -s '@/2.focused' | |
} | |
;; | |
east|south) | |
bspc node '@/2.!focused' -s '@/1.focused' \ | |
|| bspc node '@/2.!focused#focused' -n '@/' | |
;; | |
esac | |
split_type= | |
case $dir in | |
west|east) split_type=vertical ;; | |
north|south) split_type=horizontal ;; | |
esac | |
bspc node '@/.!'"$split_type" -y "$split_type" | |
ensure_tiled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Move the focused node to the given side of the tiled area. | |
super + {Left,Up,Right,Down} | |
bspside {west,north,east,south} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current version uses new bspwm features not released in 0.9.10 to simplify the code; if you want an equivalent version that is release compatible, see this revision.