     func restoreViewMasks(_ viewsAndMasks: [(NSView, NSView.AutoresizingMask)]) {
         for (view, mask) in viewsAndMasks {
             view.autoresizingMask = mask
+        }
+    }
+
+    private func changeWindowMinMaxHeightBy(_ window: NSWindow, _ amount: CGFloat) {
+        // Adjust the window's min and max sizes to make sense.
+        window.minSize = CGSize(width: window.minSize.width, height: window.minSize.height + amount)
+        // If there is no max size set (height of 0), don't change it.
+        if window.maxSize.height > 0 {
+            window.maxSize = CGSize(width: window.maxSize.width, height: window.maxSize.height + amount)
         }
     }
 

            window.setFrame(newWindowFrame, display: false, animate: false)
        }

        // Adjust the window's min and max sizes to make sense.
        window.minSize = CGSize(width: window.minSize.width, height: window.minSize.height + amount)
        // If there is no max size set (height of 0), don't change it.
        if window.maxSize.height > 0 {
            window.maxSize = CGSize(width: window.maxSize.width, height: window.maxSize.height + amount)
        }

        // Restore the saved autoresize masks.
        restoreViewMasks(windowSubviewsAndMasks)

                // This subview is above us. Don't change it.
            }
        }

        changeWindowMinMaxHeightBy(window, amount)
    }

}
