#								-*-sh-*-
# Advanced functions for windows
#

#DestroyFunc Warp-or-run
#AddToFunc Warp-or-run		"I" Next [$0 CirculateHit] Thumbnail -1
#+				"I" Next [$0 CirculateHit] Focus
#+				"I" None [$0] $1

#DestroyFunc Move-or-Raise
#AddToFunc Move-or-Raise		"I" Raise
#+				"M" Move
#+				"D" Lower

#DestroyFunc Move-or-Raise2
#AddToFunc Move-or-Raise2        "M" Raise
#+				"M" Move
#+				"D" Lower


#DestroyFunc Move-or-Iconify
#AddToFunc Move-or-Iconify       "I" Raise
#+                               "M" Move
#+                               "D" Thumbnail


#DestroyFunc Resize-or-Raise
#AddToFunc Resize-or-Raise       "I" Raise
#+                               "M" Resize
#+                               "D" Lower

#DestroyFunc Resize-or-Raise2
#AddToFunc Resize-or-Raise2      "M" Raise
#+                               "M" Resize
#+                               "D" Lower

#DestroyFunc Iconify-and-Raise
#AddToFunc Iconify-and-Raise     "I" Thumbnail
#+                               "I" Raise

# Function to save asnapshot of a window
DestroyFunc Snapshot
AddToFunc Snapshot
+ I Raise
+ I PipeRead "xwd -silent -id $[w.id] | convert \
    -frame 1x1 -mattecolor black -quality 0 xwd:- \
    png:$[HOME]/\"snapshot-$[w.name]-$[w.id].png\""

# Function to maximize vertically, and let an empty bottom space
DestroyFunc Maximize-vertical
AddToFunc Maximize-vertical
+ I Maximize 0 90

# Function to maximize vertically as much as possible
DestroyFunc Maximize-almost-vertical
AddToFunc Maximize-almost-vertical
+ I Maximize 0 grow

# Function to maximize horizontally, and let an empty space on the
# left or on the right, depending on the screen
DestroyFunc Maximize-horizontal
AddToFunc Maximize-horizontal
+ I Maximize 80 0
PipeRead 'if [ "$DISPLAY" == ":0.1" ]; then echo "+ I Move 10 w+0";fi'

# Function to maximize horizontally as much as possible
DestroyFunc Maximize-almost-horizontal
AddToFunc Maximize-almost-horizontal
+ I Maximize grow 0

# Function to maximize, and let an empty space on then bottom and on
# the left or on the right, depending on the screen
DestroyFunc Maximize-full
AddToFunc Maximize-full
+ I Maximize 90 90
PipeRead 'if [ "$DISPLAY" == ":0.1" ]; then echo "+ I Move 10 w+0";fi'

# Function to maximize as much as possible
DestroyFunc Maximize-almost-full
AddToFunc Maximize-almost-full
+ I Maximize grow grow



# Function to move on drag
DestroyFunc DragMove
AddToFunc DragMove
+				M Move

# Function to move on drag, raising, or lower on double click
DestroyFunc Move-and-Raise
AddToFunc Move-and-Raise
+				I Raise
+				M Move
+				D Lower

# Function to resize on drag
DestroyFunc DragResize
AddToFunc DragResize
+				M Resize



# Function to move on drag and maximize on double click, raising
DestroyFunc Move-or-Maximize
AddToFunc Move-or-Maximize
+				I Raise
+				M Move
+				D Maximize-vertical

# Function to move on drag and iconify on double click, raising
DestroyFunc Move-or-Iconify
AddToFunc Move-or-Iconify
+				I Raise
+				M Move
+				D Thumbnail

# =============================================================================
