diff options
| author | luke <luxmyth@gmail.com> | 2018-05-24 21:26:22 -0700 |
|---|---|---|
| committer | luke <luxmyth@gmail.com> | 2018-05-24 21:26:22 -0700 |
| commit | 2942d4a528031b15c49b4f1c607062bdd2e5d75f (patch) | |
| tree | 3a1c3f7ec8eed11e1f7ff6615dee18fe3e7e1b8a | |
| parent | eb7451f76c6bacda1eaf2150e903a95a9ba1f5f5 (diff) | |
| download | eibhear-2942d4a528031b15c49b4f1c607062bdd2e5d75f.tar.gz eibhear-2942d4a528031b15c49b4f1c607062bdd2e5d75f.tar.zst eibhear-2942d4a528031b15c49b4f1c607062bdd2e5d75f.zip | |
resize script cleanup
| -rw-r--r-- | .config/i3/config | 3 | ||||
| -rwxr-xr-x | .scripts/i3resize | 41 |
2 files changed, 23 insertions, 21 deletions
diff --git a/.config/i3/config b/.config/i3/config index 8869c32..da8886a 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -93,8 +93,7 @@ bindsym $mod+Shift+Delete exec --no-startup-id lmc truemute ; exec $truepause ; bindsym $mod+q kill bindsym $mod+Shift+q kill -bindsym $mod+w exec --no-startup-id openweb -#bindsym $mod+w exec $term -e sudo wifi-menu +bindsym $mod+w exec $term -e sudo wifi-menu bindsym $mod+Shift+w exec --no-startup-id $BROWSER bindsym $mod+e exec $term -e neomutt diff --git a/.scripts/i3resize b/.scripts/i3resize index 6675965..98fad5a 100755 --- a/.scripts/i3resize +++ b/.scripts/i3resize @@ -1,5 +1,4 @@ #!/bin/bash - # This script was made by `goferito` on Github. direction=$1 @@ -8,23 +7,27 @@ distanceStr="$pts px or $pts ppt" [ -z $1 ] && echo "No direction provided" && exit 1 -if [ "$1" == "up" ]; then -i3-msg resize grow up $distanceStr | grep '"success":true' || \ - i3-msg resize shrink down $distanceStr -fi - -if [ "$1" == "down" ]; then -i3-msg resize shrink up $distanceStr | grep '"success":true' || \ - i3-msg resize grow down $distanceStr -fi - -if [ "$1" == "left" ]; then -i3-msg resize shrink right $distanceStr | grep '"success":true' || \ - i3-msg resize grow left $distanceStr -fi +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 +} -if [ "$1" == "right" ]; then -i3-msg resize grow right $distanceStr | grep '"success":true' || \ - i3-msg resize shrink left $distanceStr -fi +case $direction in + up) + moveChoice grow up shrink down + ;; + down) + moveChoice shrink up grow down + ;; + left) + moveChoice shrink right grow left + ;; + right) + moveChoice grow right shrink left + ;; +esac |
