dots

Personal dotfiles
git clone git://git.gormless.xyz/dots.git
Log | Files | Refs

fs (1161B)


      1 #!/bin/sh
      2 
      3 # this file is used to store the previous geometry of a window
      4 FSFILE=${FSFILE:-~/var/fwin}
      5 
      6 # it's pretty simple, but anyway...
      7 usage() {
      8     echo "usage: $(basename $0) <wid>"
      9     exit 1
     10 }
     11 
     12 # exit if no argument given
     13 test -z "$1" && usage
     14 
     15 # this will unset the fullscreen state of any fullscreen window if there is one.
     16 # this way, there will only be one window in fullscreen at a time, and no window
     17 # will loose their previous geometry info
     18 test -f $FSFILE && wtp $(cat $FSFILE)
     19 
     20 # if file exist and contain our window id, it means that out window is in
     21 # fullscreen mode
     22 if test -f $FSFILE && grep -q $1 $FSFILE; then
     23     # if the window we removed was our window, delete the file, so we can
     24     # fullscreen it again later 
     25     rm -f $FSFILE
     26 
     27 else
     28     # if not, then put the current window in fullscreen mode, after saving its
     29     # geometry and id to $FSFILE we also remove any border from this window.
     30     wattr xywhi $1 > $FSFILE
     31     chwb -s 0 $1
     32     wtp $(wattr xywh `lswin -r`) $1
     33 fi
     34 
     35 # now focus the window, and put it in front, no matter which state we're in, and
     36 # put the cursor on its bottom-right corner (for consistency)
     37 focus $1