helm/bin/bspwm/presel
Henrik Lissner 5866008d0c
Fix bin/{mov2gif,bspwm/presel}
Shifting the first is no longer necessary for nix-shell scripts.
2020-11-27 13:59:12 -05:00

22 lines
685 B
Plaintext
Executable file

#!/usr/bin/env cached-nix-shell
#! nix-shell -i zsh -p jshon
# Script: bspc-presel
# Author: Henrik Lissner
# Usage:
# bspc-presel RATIO
# bspc-presel 0.2
#
# Wrote this to invert the ratio on east/south-bound preselections. In English
# that means bspc node -p 0.2 should resize the preselection to 20%, whether or
# not it's on the west or east side of the window (or north or south side),
# which isn't the case by default.
#
# NOTE: We use zsh for this because bash chokes on float arithmetic.
ratio="$1"
case "$(bspc query -T -n focused | jshon -e presel -e splitDir | tr -d \")" in
west|north) bspc node -o $ratio ;;
east|south) bspc node -o $(( 1.0 - ratio )) ;;
esac