From 8ad9b44841366cd637469a46de229e3a521a6862 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 4 Oct 2018 13:59:39 -0400 Subject: [PATCH] i3resize cleanup --- .scripts/i3resize | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.scripts/i3resize b/.scripts/i3resize index 98fad5a..11b0992 100755 --- a/.scripts/i3resize +++ b/.scripts/i3resize @@ -1,22 +1,16 @@ -#!/bin/bash +#!/bin/sh # This script was made by `goferito` on Github. +# Some cleanup by Luke. -direction=$1 -pts="2" -distanceStr="$pts px or $pts ppt" +[ -z "$1" ] && echo "No direction provided" && exit 1 +distanceStr="2 px or 2 ppt" -[ -z $1 ] && echo "No direction provided" && exit 1 - -function moveChoice { - 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 +moveChoice() { + i3-msg resize "$1" "$2" "$distanceStr" | grep '"success":true' || \ + i3-msg resize "$3" "$4" "$distanceStr" } -case $direction in +case $1 in up) moveChoice grow up shrink down ;;