URI:
       x-maximize - scripts - various script and utils
  HTML git clone git://z3bra.org/scripts
   DIR Log
   DIR Files
   DIR Refs
       ---
       x-maximize (544B)
       ---
            1 #!/bin/sh
            2 
            3 # Make the current window cover the whole monitor, or change it back to
            4 # its previous size if it's already maxed out
            5 
            6 cur=$(pdw)
            7 wid=${1:-$cur}
            8 gap=2
            9 atom="WM_ORIG_SIZE"
           10 
           11 [ -z "$wid" ] && exit 1
           12 
           13 size="$(atomx $atom $wid)"
           14 if  [ -n "$size" ]; then
           15         wtp $size $wid
           16         atomx -d $atom $wid
           17 else
           18         wattr xywhb $wid | { read x y w h b
           19         randr | { read mn mw mh mx my md
           20 
           21         # take gap/border size into account
           22         atomx ${atom}="$x $y $w $h" $wid > /dev/null
           23         wtp $((mx + gap)) $((my + gap)) $((mw - 2*(b+gap))) $((mh - 2*(b+gap))) $wid
           24         }
           25         }
           26 fi