Skip to content

Commit

Permalink
fix: AltTab时,按数字键让窗口在虚拟桌面间转移
Browse files Browse the repository at this point in the history
  • Loading branch information
snomiao committed May 2, 2021
1 parent e4793e7 commit 27e3b2e
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 44 deletions.
8 changes: 4 additions & 4 deletions Modules/01.1-插件-鼠标模拟.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,14 @@ $!r:: 轮自刻 := TM_QPC(), 轮自纵 -= 1, 轮动始(), 鼠标模拟_ToolTip("
$!f:: 轮自刻 := TM_QPC(), 轮自纵 += 1, 轮动始(), 鼠标模拟_ToolTip("滚轮自动(纵向) - "轮自纵)
$!+r:: 轮自刻 := TM_QPC(), 轮自横 -= 1, 轮动始(), 鼠标模拟_ToolTip("滚轮自动(横向) - "轮自横)
$!+f:: 轮自刻 := TM_QPC(), 轮自横 += 1, 轮动始(), 鼠标模拟_ToolTip("滚轮自动(横向) - "轮自横)
$+r:: 轮刻左 := (轮刻左 ? 轮刻左 : TM_QPC()), 轮动始()
$+f:: 轮刻右 := (轮刻右 ? 轮刻右 : TM_QPC()), 轮动始()
$+r Up:: 轮刻左 := 0, 轮动始()
$+f Up:: 轮刻右 := 0, 轮动始()
$*r:: 轮刻上 := (轮刻上 ? 轮刻上 : TM_QPC()), 轮动始()
$*f:: 轮刻下 := (轮刻下 ? 轮刻下 : TM_QPC()), 轮动始()
$+r:: 轮刻左 := (轮刻左 ? 轮刻左 : TM_QPC()), 轮动始()
$+f:: 轮刻右 := (轮刻右 ? 轮刻右 : TM_QPC()), 轮动始()
$*r Up:: 轮刻上 := 0, 轮动始()
$*f Up:: 轮刻下 := 0, 轮动始()
$*r:: 轮刻上 := (轮刻上 ? 轮刻上 : TM_QPC()), 轮动始()
$*f:: 轮刻下 := (轮刻下 ? 轮刻下 : TM_QPC()), 轮动始()
; F

#if
Expand Down
130 changes: 90 additions & 40 deletions Modules/03.1-插件-窗口增强.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ Return

#if False && "FUNCTIION DEFINES"

AltTabWindowGet(){
return WinActive("ahk_class MultitaskingViewFrame")
}
WinTabWindowGet(){
return WinActive("ahk_class Windows.UI.Core.CoreWindow ahk_exe explorer.exe")
}
MultitaskingViewFrameQ(){
Return WinActive("ahk_class MultitaskingViewFrame") || WinActive("ahk_class Windows.UI.Core.CoreWindow ahk_exe explorer.exe")
Return AltTabWindowGet() || WinTabWindowGet()
}
; this is improved method for stable
GetMonitorIndexFromWindowByWindowsCenterPoint(hWnd){
Expand Down Expand Up @@ -512,21 +518,91 @@ Return
WinKill ahk_id %hWnd%
Return

; Alt+Tab或 Win+Tab
; Alt+Tab 或 Win+Tab
#if MultitaskingViewFrameQ()

!1:: SwitchToDesktop(1)
!2:: SwitchToDesktop(2)
!3:: SwitchToDesktop(3)
!4:: SwitchToDesktop(4)
!5:: SwitchToDesktop(5)
!6:: SwitchToDesktop(6)
!7:: SwitchToDesktop(7)
!8:: SwitchToDesktop(8)
!9:: SwitchToDesktop(9)
!0:: SwitchToDesktop(10)
!-:: SwitchToDesktop(11)
!=:: SwitchToDesktop(12)
; !1:: SwitchToDesktop(1)
; !2:: SwitchToDesktop(2)
; !3:: SwitchToDesktop(3)
; !4:: SwitchToDesktop(4)
; !5:: SwitchToDesktop(5)
; !6:: SwitchToDesktop(6)
; !7:: SwitchToDesktop(7)
; !8:: SwitchToDesktop(8)
; !9:: SwitchToDesktop(9)
; !0:: SwitchToDesktop(10)

; Move the current window to the X-th desktop
!1::
SendEvent {Space}
WinWaitNotActive ahk_class MultitaskingViewFrame
WinWaitNotActive ahk_class Windows.UI.Core.CoreWindow ahk_exe explorer.exe
MoveActiveWindowToDesktop(1)
SendEvent !{Tab}
return
!2::
SendEvent {Space}
WinWaitNotActive ahk_class MultitaskingViewFrame
WinWaitNotActive ahk_class Windows.UI.Core.CoreWindow ahk_exe explorer.exe
MoveActiveWindowToDesktop(2)
SendEvent !{Tab}
return
!3::
SendEvent {Space}
WinWaitNotActive ahk_class MultitaskingViewFrame
WinWaitNotActive ahk_class Windows.UI.Core.CoreWindow ahk_exe explorer.exe
MoveActiveWindowToDesktop(3)
SendEvent !{Tab}
return
!4::
SendEvent {Space}
WinWaitNotActive ahk_class MultitaskingViewFrame
WinWaitNotActive ahk_class Windows.UI.Core.CoreWindow ahk_exe explorer.exe
MoveActiveWindowToDesktop(4)
SendEvent !{Tab}
return
!5::
SendEvent {Space}
WinWaitNotActive ahk_class MultitaskingViewFrame
WinWaitNotActive ahk_class Windows.UI.Core.CoreWindow ahk_exe explorer.exe
MoveActiveWindowToDesktop(5)
SendEvent !{Tab}
return
!6::
SendEvent {Space}
WinWaitNotActive ahk_class MultitaskingViewFrame
WinWaitNotActive ahk_class Windows.UI.Core.CoreWindow ahk_exe explorer.exe
MoveActiveWindowToDesktop(6)
SendEvent !{Tab}
return
!7::
SendEvent {Space}
WinWaitNotActive ahk_class MultitaskingViewFrame
WinWaitNotActive ahk_class Windows.UI.Core.CoreWindow ahk_exe explorer.exe
MoveActiveWindowToDesktop(7)
SendEvent !{Tab}
return
!8::
SendEvent {Space}
WinWaitNotActive ahk_class MultitaskingViewFrame
WinWaitNotActive ahk_class Windows.UI.Core.CoreWindow ahk_exe explorer.exe
MoveActiveWindowToDesktop(8)
SendEvent !{Tab}
return
!9::
SendEvent {Space}
WinWaitNotActive ahk_class MultitaskingViewFrame
WinWaitNotActive ahk_class Windows.UI.Core.CoreWindow ahk_exe explorer.exe
MoveActiveWindowToDesktop(9)
SendEvent !{Tab}
return
!0::
SendEvent {Space}
WinWaitNotActive ahk_class MultitaskingViewFrame
WinWaitNotActive ahk_class Windows.UI.Core.CoreWindow ahk_exe explorer.exe
MoveActiveWindowToDesktop(10)
SendEvent !{Tab}
return

; 在 Win + Tab 下, WASD 模拟方向键, 1803之后还可以用
!a:: Left
Expand All @@ -538,35 +614,9 @@ Return
!c:: SendEvent {Blind}{Delete}{Right}
!x:: SendEvent {Blind}{Delete}{Right}

; 新建桌面
!z::
SendEvent {Blind}{Esc}
; Sleep 200
Send ^#d
Return

; 新建桌面并移动窗口
!v::
SendEvent {Blind}{Esc}
; Sleep 200
MoveActiveWindowWithAction("^#d")
Return

; 模拟 Tab 键切换焦点
; !\:: Send {Tab}
; 在 Win10 下的 Win+Tab 界面,WASD 切换窗口焦点
; 以及在窗口贴边后,WASD 切换窗口焦点

; 切换桌面概览
!q:: Send ^#{Left}
!e:: Send ^#{Right}
![:: Send ^#{Left}
!]:: Send ^#{Right}

; 增删桌面
=:: Send ^#d
-:: Send ^#{F4}
z:: Send ^#{F4}

#if

Expand Down

0 comments on commit 27e3b2e

Please sign in to comment.