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