Skip to content

Commit

Permalink
fix: enhance switch to desktop by hotkey for win11
Browse files Browse the repository at this point in the history
  • Loading branch information
snomiao committed Jan 10, 2022
1 parent a907ad0 commit c7f47ae
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Modules/03-虚拟桌面增强.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,20 @@ SwitchToDesktop(idx)
SwitchToDesktopByHotkey(idx)
{
static lastIdx := ""
if (!lastIdx || idx === 1){
SendInput ^#{Left 10}
if (!lastIdx || idx == 1){
Loop 10 {
SendEvent ^#{Left}
}
lastIdx := 1
}
offset := idx - lastIdx
offsetRight := max(offset, 0)
offsetLeft := max(-offset, 0)
Loop %offsetRight% {
SendInput ^#{Right}
SendEvent ^#{Right}
}
Loop %offsetLeft% {
SendInput ^#{Left}
SendEvent ^#{Left}
}
lastIdx := idx
}
Expand Down

0 comments on commit c7f47ae

Please sign in to comment.