Skip to content

Commit

Permalink
feat: 增加功能 | 双击左边 Shift+Ctrl+Alt | 最小化当前窗口(可穿透远程桌面与虚拟机) |
Browse files Browse the repository at this point in the history
  • Loading branch information
snomiao committed Mar 21, 2021
1 parent aa13790 commit 6c32ac7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 26 deletions.
34 changes: 26 additions & 8 deletions Modules/应用-mstsc远程桌面增强.ahk
@@ -1,6 +1,7 @@
if !CapsLockX
ExitApp
global last_mstsc := 0
global 上次CtrlShiftAlt时刻 := 0

; 如果当前操作的远程桌面窗口是全屏窗口,则自动置底,这样可以跟当前电脑桌面上的窗口共同操作
; SetTimer, toggleBottomOrTop, 1
Expand All @@ -14,23 +15,23 @@ return
DetectMSTSC()
{
msg := ""
winTitle := "ahk_class TscShellContainerClass ahk_exe mstsc.exe"
winTitle := "ahk_class TscShellContainerClass ahk_exe mstsc.exe"
WinWaitActive, % winTitle
hWnd := WinExist()
WinGetPos, X, Y, W, H, ahk_id %hWnd%
msg .= "XYWH " X " " Y " " W " " H "`n"
SysGet, VirtualWidth, 78
SysGet, VirtualHeight, 79
msg .= "VWVH " VirtualWidth " " VirtualHeight "`n"
msg .= "VWVH " VirtualWidth " " VirtualHeight "`n"

MonitorIndex := 1
SysGet, MWA%MonitorIndex%, MonitorWorkArea, %MonitorIndex%
SX := MWA1Left
SY := MWA1Top
SW := MWA1Right - MWA1Left
SH := MWA1Bottom - MWA1Top
msg .= "MWA " SX " " SY " " SW " " SH "`n"

; Tooltip %X% %Y% %VirtualWidth% %VirtualHeight% %Width% %Height% %A_ScreenWidth% %A_ScreenHeight%
; 如果当前操作的远程桌面窗口是全屏窗口,就把它置底
if (VirtualWidth == W && VirtualHeight == H) {
Expand Down Expand Up @@ -81,7 +82,7 @@ mstscShow()
}
mstscHide()
{

TrayTip, , 远程桌面最小化, 1
; 使远程窗口最小化并失去焦点,显示其它窗口
; Tooltip % A_PriorHotkey
Expand All @@ -96,15 +97,32 @@ mstscHide()
WinHide, ahk_id %last_mstsc%
; WinRestore, ahk_id %last_mstsc%
WinShow, ahk_id %last_mstsc%

}

#if


~$<!<+LCtrl Up::
~$<^<+LAlt Up::
~$<!<^LShift Up::
if(!(A_PriorKey == "LCtrl" || A_PriorKey == "LAlt" || A_PriorKey == "LShift"))
Return
KeyWait, LCtrl
KeyWait, LAlt
KeyWait, LShift
现在 := A_TickCount
间隔 := 现在 - 上次CtrlShiftAlt时刻
if(16 < 间隔 && 间隔 < 200){
WinMinimize A
TrayTip, CapsLockX, 最小化当前窗口(可穿透虚拟机和远程桌面)
}
上次CtrlShiftAlt时刻 := 现在
Return

<!RAlt Up:: mstscShow()
>!LAlt Up::mstscShow()

#IfWinActive ahk_class TscShellContainerClass ahk_exe mstsc.exe
#If WinActive("ahk_class TscShellContainerClass ahk_exe mstsc.exe")

; 左右Alt或Ctrl一起按 显示当前mstsc窗口
<!RAlt Up:: mstscHide()
Expand Down
10 changes: 4 additions & 6 deletions Modules/应用-mstsc远程桌面增强.md
@@ -1,8 +1,6 @@
# MSTSC 远程桌面增强

| 模式 | 按键 | 功能说明 |
| ---------------- | :---------- | ---------------------------------------- |
| 在远程桌面窗口中 | LAlt + RAlt | 最小化当前远程桌面窗口:回到系统操作界面 |

<!-- | 在远程桌面窗口中 | RAlt + RCtrl | 切换焦点:右边的 Alt+Ctrl 一起按可以切换焦点在不在远程桌面窗口 | -->
<!-- | 在远程桌面窗口中 | 无需按键自动触发 | 自动置底:如果当前操作的远程桌面窗口是最大化的窗口,则自动置底,这样可以跟当前电脑桌面上的窗口共同操作 | -->
| 模式 | 按键 | 功能说明 |
| ---------------- | :---------------------- | ---------------------------------------------- |
| 任意窗口 | 双击左边 Shift+Ctrl+Alt | 最小化当前窗口(可穿透远程桌面与虚拟机) |
| 在远程桌面窗口中 | LAlt + RAlt | 最小化当前远程桌面窗口:或回到远程桌面操作界面 |
10 changes: 4 additions & 6 deletions README.md
Expand Up @@ -240,12 +240,10 @@

### MSTSC 远程桌面增强

| 模式 | 按键 | 功能说明 |
| ---------------- | :---------- | ---------------------------------------- |
| 在远程桌面窗口中 | LAlt + RAlt | 最小化当前远程桌面窗口:回到系统操作界面 |

<!-- | 在远程桌面窗口中 | RAlt + RCtrl | 切换焦点:右边的 Alt+Ctrl 一起按可以切换焦点在不在远程桌面窗口 | -->
<!-- | 在远程桌面窗口中 | 无需按键自动触发 | 自动置底:如果当前操作的远程桌面窗口是最大化的窗口,则自动置底,这样可以跟当前电脑桌面上的窗口共同操作 | -->
| 模式 | 按键 | 功能说明 |
| ---------------- | :---------------------- | ---------------------------------------------- |
| 任意窗口 | 双击左边 Shift+Ctrl+Alt | 最小化当前窗口(可穿透远程桌面与虚拟机) |
| 在远程桌面窗口中 | LAlt + RAlt | 最小化当前远程桌面窗口:或回到远程桌面操作界面 |

<!-- 模块文件名:应用-TIM添加常驻功能.ahk-->

Expand Down
10 changes: 4 additions & 6 deletions docs/README.md
Expand Up @@ -239,12 +239,10 @@

### MSTSC 远程桌面增强

| 模式 | 按键 | 功能说明 |
| ---------------- | :---------- | ---------------------------------------- |
| 在远程桌面窗口中 | LAlt + RAlt | 最小化当前远程桌面窗口:回到系统操作界面 |

<!-- | 在远程桌面窗口中 | RAlt + RCtrl | 切换焦点:右边的 Alt+Ctrl 一起按可以切换焦点在不在远程桌面窗口 | -->
<!-- | 在远程桌面窗口中 | 无需按键自动触发 | 自动置底:如果当前操作的远程桌面窗口是最大化的窗口,则自动置底,这样可以跟当前电脑桌面上的窗口共同操作 | -->
| 模式 | 按键 | 功能说明 |
| ---------------- | :---------------------- | ---------------------------------------------- |
| 任意窗口 | 双击左边 Shift+Ctrl+Alt | 最小化当前窗口(可穿透远程桌面与虚拟机) |
| 在远程桌面窗口中 | LAlt + RAlt | 最小化当前远程桌面窗口:或回到远程桌面操作界面 |

<!-- 模块文件名:应用-TIM添加常驻功能.ahk-->

Expand Down

0 comments on commit 6c32ac7

Please sign in to comment.