Skip to content

Commit

Permalink
fix: 修改热键 CLX+B 为定位到任务栏、虚拟桌面整体迁移功能修复、普通用户权限重载代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
snomiao committed May 7, 2021
1 parent 4663eb4 commit b27b24a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 23 deletions.
6 changes: 3 additions & 3 deletions Core/CapslockX-Core.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ RunAsLimitiedUser(CMD, WorkingDir){
; Safe_CMD := RegExReplace(RegExReplace("notepad "".\temp.txt""", "\\", "\\"), "\""", "\""")
Safe_WorkingDir := RegExReplace(WorkingDir, "\\", "\\")
Safe_CMD := RegExReplace(RegExReplace(CMD, "\\", "\\"), "\""", "\""")
RunWait cmd /c schtasks /Create /tn CapsLockX_RunAsLimitedUser /sc ONCE /ST 00:00 /tr "cmd /c cd \"%Safe_WorkingDir% && %Safe_CMD%\" /F,, Hide
RunWait cmd /c schtasks /Run /tn CapsLockX_RunAsLimitedUser,, Hide
RunWait cmd /c schtasks /Delete /tn CapsLockX_RunAsLimitedUser /F,, Hide
RunWait cmd /k schtasks /Create /tn CapsLockX_RunAsLimitedUser /F /sc ONCE /ST 00:00 /tr "cmd /c cd \"%Safe_WorkingDir% && %Safe_CMD%\",, Hide
RunWait cmd /k schtasks /Run /tn CapsLockX_RunAsLimitedUser,, Hide
RunWait cmd /k schtasks /Delete /tn CapsLockX_RunAsLimitedUser /F,, Hide
}
; 接下来是流程控制
#if
Expand Down
26 changes: 13 additions & 13 deletions Modules/03-虚拟桌面增强.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -202,25 +202,25 @@ MoveActiveWindowToDesktop(idx){
WinActivate ahk_id %activeWin%
}
MoveAllVisibleWindowToDesktop(idx){
hwndArray := []
WinGet, id, List, , ,
DetectHiddenWindows, Off
loop %id% {
; 跳过不在当前虚拟桌面的窗口
if (!IsWindowOnCurrentVirtualDesktop(hWnd)){
id%A_Index% := ""
listOfWindow := WindowsListOfMonitorFast(arrangeFlags | ARRANGE_MAXWINDOW | ARRANGE_MINWINDOW)

loop Parse, listOfWindow, `n
{
hWnd := RegExReplace(A_LoopField, "^.*?ahk_id (\S+?)$", "$1")
if(!hWnd)
continue
}
hWnd := id%A_Index%
; WinHide ahk_id %hWnd%
DllCall("ShowWindowAsync", UInt, hWnd, UInt, (SW_HIDE := 0x0) )
}
SwitchToDesktop(idx)
Sleep 128
loop %id% {
hWnd := id%A_Index%
if(hWnd)
DllCall("ShowWindowAsync", UInt, hWnd, UInt, (SW_SHOWNOACTIVATE := 0x4) )
loop Parse, listOfWindow, `n
{
hWnd := RegExReplace(A_LoopField, "^.*?ahk_id (\S+?)$", "$1")
if(!hWnd)
continue

DllCall("ShowWindowAsync", UInt, hWnd, UInt, (SW_SHOWNOACTIVATE := 0x4) )
}
}
SwitchToDesktop(idx){
Expand Down
11 changes: 4 additions & 7 deletions Modules/03.1-插件-窗口增强.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -780,12 +780,9 @@ Delete::
SendEvent {Up}
Return

#if
#if CapsLockXMode

#+b::
SendEvent #b
WinWaitActive ahk_class Shell_TrayWnd ahk_exe explorer.exe, ,3
if(ErrorLevel)
Return
SendEvent +{Tab}
b::
WinActivate, ahk_class Shell_TrayWnd ahk_exe explorer.exe
ControlFocus, MSTaskListWClass1, ahk_class Shell_TrayWnd ahk_exe explorer.exe
Return

0 comments on commit b27b24a

Please sign in to comment.