[download]

config/i3/gaps

   1 #!/bin/bash
   2 
   3 cgp=$(i3-msg -t get_config | awk '/^gaps\s+inner/ { print $3 }')
   4 cgp=${cgp:-0}
   5 
   6 i3-msg -t subscribe -m '[ "window", "binding" ]' | while read; do
   7     ws=$(i3-msg -t get_workspaces | jq '.[] | select(.focused == true).num')
   8     gp=$(i3-msg -t get_tree | jq "recurse(.nodes[]) | select(.num == $ws).gaps.inner + $cgp")
   9 
  10     [[ $gp == 0 ]] &&
  11     i3-msg [tiling   workspace=__focused__] border pixel  2 ||
  12     i3-msg [tiling   workspace=__focused__] border normal 0
  13     i3-msg [floating workspace=__focused__] border normal 0
  14 done