PageRenderTime 18ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/WindowTweaks.ahk

http://7plus.googlecode.com/
AutoHotKey | 148 lines | 125 code | 10 blank | 13 comment | 35 complexity | e838cc417e5f91bbe06c8fc85ce2df45 MD5 | raw file
  1;Check screen borders/corners for Aero Flip 3D and Slide Windows
  2hovercheck: 
  3HoverCheck()
  4return
  5
  6HoverCheck()
  7{
  8	global HKSlideWindows,Vista7,MouseX,MouseY,AeroFlipTime
  9	static lastx,lasty
 10	MouseGetPos, MouseX,MouseY,win,control
 11	WinGetClass, class, ahk_id %win%
 12	x:=IsFullscreen("A",false,false)
 13	if(!x)
 14	{
 15		if(MouseX != lastx || MouseY != lasty)
 16			SlideWindows_OnMouseMove(MouseX,MouseY)
 17		SlideWindows_CheckWindowState()
 18	}
 19  if (Vista7 && !x && (MouseX != lastx || MouseY != lasty) && MouseX=0 && MouseY=0 && !WinActive("ahk_class Flip3D"))
 20  { 
 21  	z:=-(AeroFlipTime*1000+1)
 22    SetTimer, hovering, %z%
 23  } 
 24  lastx := MouseX
 25  lasty := MouseY
 26	return
 27}
 28;Hovering timer for Aero Flip 3D
 29hovering: 	
 30	if (GetKeyState("LButton") || GetKeyState("RButton") || WinActive("ahk_class Flip3D")) 
 31      return 
 32  if(MouseX!=0||MouseY!=0)
 33		return 
 34	if(IsFullscreen("A",false,false))
 35		return
 36  Send ^#{Tab} 
 37	SetTimer, hovering, off
 38  return
 39
 40;Key remappers for Aero Flip 3D
 41#IfWinActive, ahk_class Flip3D 
 42Space::Enter 
 43Left::Right 
 44Right::Left 
 45Down::Up 
 46Up::Down 
 47RButton::Esc 
 48RWin::Esc
 49LWin::Esc
 50WheelUp::WheelDown
 51WheelDown::WheelUp
 52#if
 53
 54;ctrl+v in cmd->paste, alt+F4 in cmd->close
 55#if HKImproveConsole && WinActive("ahk_class ConsoleWindowClass")
 56^v::
 57	Coordmode,Mouse,Relative
 58	MouseGetPos, MouseX, MouseY
 59	Click right 40,40
 60	Send {Down 3}
 61	send {Enter}
 62	MouseMove MouseX,MouseY
 63	return
 64!F4::
 65	WinClose, A
 66	return
 67#If
 68
 69;Alt+F5: Kill active window
 70#if HKKillWindows
 71!F5::
 72	CloseKill()
 73	return
 74#if
 75;Force kill program on Alt+F5 and on right click close button
 76CloseKill()
 77{
 78	WinGet, pid, pid, A
 79	WinKill A, , 1
 80	WinGet, pid1 , pid, A
 81	if(pid=pid1)
 82		Process close, %pid1%
 83}
 84
 85;Close on middle click titlebar
 86TitleBarClose()
 87{
 88	global
 89	if(!HKTitleClose)
 90		return false
 91	x:=MouseHittest()
 92	if(x=2)
 93		WinClose, A
 94	else
 95		return false
 96	return true
 97}
 98
 99;Middle click on taskbutton->close task
100TaskButtonClose()
101{
102	global
103	outputdebug taskbuttonclose
104	if(HKMiddleClose && IsMouseOverTaskList())
105	{
106		if(A_OSVersion="WIN_7")
107			Send {Shift down}
108		click right
109		while(!IsContextMenuActive())
110			sleep 10
111		if(A_OSVersion="WIN_7")
112			Send {Shift up}
113		Send {up}{enter}
114		return true
115	}
116	outputdebug not handled
117	return false
118}
119
120;Flash Windows activation
121#if HKFlashWindow && BlinkingWindows.len()>0 && !IsFullscreen()
122Capslock::
123	z:=BlinkingWindows[1]
124	WinActivate ahk_id %z%
125	return
126#if
127
128;Current/Previous Window toggle
129#if HKToggleWindows && (!HKFlashWindow || BlinkingWindows.len()=0) && !IsFullscreen()
130Capslock::WinActivate ahk_id %PreviousWindow%
131#if
132
133;RButton on title bar -> toggle always on top
134#if HKToggleAlwaysOnTop
135~RButton::
136	x:=MouseHittest()
137  ;If we hit something, we swallow the click, and need that toggle var therefore
138	If (x=2) ;,3,8,9,20,21 ; in titlebar enclosed area - top of window 
139  {  
140    WinSet, AlwaysOnTop, toggle, A
141    ;outputdebug clicked on title bar, toggle always on top and cancel menu
142    SendInput {Escape} ;Escape is needed to suppress the annoying win7 menu on titlebar right click     
143  }
144	else if(x=20 && HKKillWindows)
145  	CloseKill()  	
146	Return
147#if
148