With some Linux window managers, is possible to maximize only the height or width of a window. That is what the following script does when you press Win+H or Win+W, respectively. When you press it again, the window is resized to its original size.
Since this is my first script, I am happy about all suggestions or improvements.
Bernd
Code:
; ---------------------------------------------------------------------
; Name: Window Manager Maximize v0.2
; Author: Bernd Schandl
; Date: 29.04.2005
;
; Explanation:
; ---------------------------------------------------------------------
; The script implements different kinds of maximizing a window similar
; to some Linux window managers:
; Win-H: Either maximize height or resize it if height was maximized earlier
; Win-W: Either maximize width or resize it if width was maximized earlier
#h::
; get ID, size and position
WinGet, WM_WindowID, ID, A
WinGetPos, WM_X, WM_Y, WM_Width, WM_Height, A
If ( WM_Height <> A_ScreenHeight )
{
; save values for resize
WM_WindowY%WM_WindowID% = %WM_Y%
WM_WindowHeight%WM_WindowID% = %WM_Height%
; maximize height
WinMove, A,, %WM_X%, 0, %WM_Width%, %A_ScreenHeight%
}
Else If WM_WindowHeight%WM_WindowID%
{
; height was maximized, so resize it
WinMove, A, , %WM_X%, WM_WindowY%WM_WindowID%, %WM_Width%, WM_WindowHeight%WM_WindowID%
; reset variables
WM_WindowHeight%WM_WindowID% =
WM_WindowY%WM_WindowID% =
}
return
#w::
; get ID, size and position
WinGet, WM_WindowID, ID, A
WinGetPos, WM_X, WM_Y, WM_Width, WM_Height, A
If ( WM_Width <> A_ScreenWidth )
{
; save values for resize
WM_WindowX%WM_WindowID% = %WM_X%
WM_WindowWidth%WM_WindowID% = %WM_Width%
; maximize width
WinMove, A,, 0, %WM_Y%, %A_ScreenWidth%, %WM_Height%
}
Else If WM_WindowWidth%WM_WindowID%
{
; width was maximized, so resize it
WinMove, A, , WM_WindowX%WM_WindowID%, %WM_Y%, WM_WindowWidth%WM_WindowID%, %WM_Height%
;reset variables
WM_WindowWidth%WM_WindowID% =
WM_WindowX%WM_WindowID% =
}
return