i3resize cleanup

This commit is contained in:
Luke Smith 2018-10-04 13:59:39 -04:00
parent cb5834b54b
commit 8ad9b44841

View file

@ -1,22 +1,16 @@
#!/bin/bash #!/bin/sh
# This script was made by `goferito` on Github. # This script was made by `goferito` on Github.
# Some cleanup by Luke.
direction=$1 [ -z "$1" ] && echo "No direction provided" && exit 1
pts="2" distanceStr="2 px or 2 ppt"
distanceStr="$pts px or $pts ppt"
[ -z $1 ] && echo "No direction provided" && exit 1 moveChoice() {
i3-msg resize "$1" "$2" "$distanceStr" | grep '"success":true' || \
function moveChoice { i3-msg resize "$3" "$4" "$distanceStr"
act1=$1 # first action
dir1=$2 # first direction
act2=$3 # fallback action
dir2=$4 # fallback direction
i3-msg resize $1 $2 $distanceStr | grep '"success":true' || \
i3-msg resize $3 $4 $distanceStr
} }
case $direction in case $1 in
up) up)
moveChoice grow up shrink down moveChoice grow up shrink down
;; ;;