Running the excellent Dexpot window manager for windows, along with the opensource Dual Monitor Taskbar can cause a few issues:
- It is not possible to switch virtual desktops on the client from within a remote desktop session
- The second monitor taskbar is on-top of the remote desktop client application
The remote desktop client for windows, allows ONLY the Caps-Lock key to be captured by other programs while in full screen, this is when the “Send windows shortcuts to remote system” is enabled.
Using the autohotkey scripts below you are able to switch desktops using the Cube from Dexpot using Ctrl+CapsLock. The use case for the script is as follows:
- Press and hold CTRL
- Press and RELEASE Caps-Lock
- Use the arrow left/right to navigate available desktops
- Release CTRL when you wish to switch to selected desktop
The requirements for the setup described here, are the following applications:
- Dexpot Window Manager with Cube plugin
- You must have mapped the Cube manual show to Alt + Win + Up Arrow
- Dual Monitor Taskbar
- Autohotkey
The script can also be found, downloaded and forked at github:
https://github.com/ecomerc/code/blob/master/RotateCube-from-RDP/rotatecube.ahk
The code for the autohotkey is also outlined below. The implementation is:
- Capture the pressing of CTRL+Caps-Lock
Block the capture of this (we don’t want to enable Caps-Lock) - If a remote desktop client is full screen, restore it to window mode, and enlarge the window to fill the screen
We do this so the cube is still covered with the RDP client - Send Ctrl+Win+Arrow Up to launch the Cube
- Capture the release of Ctrl nonblocking (allow other applications to see the event as well)
If a Remote Desktop Window is present on the new virtual desktop make it full screen, and make the second monitor toolbar not topmost
If no Remote Desktop Window is present, make the second monitor toolbar topmost
#SingleInstance force
; Usage: Press CTRL+CapsLock, hold CTRL and use arrow keys to navigate desktops
RotatingCube := 0
^Capslock::
SetKeyDelay -1
if (RotatingCube = 0) {
;Get MSTSC window (this may have to be ahk_class TSSHELLWND for some systems)
;TODO: make multiple detection
If WinActive("ahk_class TscShellContainerClass") {
WinGet, active_id, ID, A
WinGet, maxOrMin, MinMax, ahk_id %active_id%
if (maxOrMin = 0) {
WinGetPos, PosX, PosY, WinWidth, WinHeight, ahk_id %active_id%
if (PosY = 0) {
;Wait for focus to restore properly
Sleep 50
;Force the MSTSC windows to restore (unmaximize)
PostMessage, 0x112, 0xF120,,, ahk_id %active_id% ; 0x112 = WM_SYSCOMMAND, 0xF120 = SC_RESTORE
Sleep 50
;Move it so it fills the screen, but not 0,0 because then we would think it was maximized
WinMove, ahk_id %active_id%,, 1, 1, WinWidth - 2, WinHeight-2
}
}
}
; Launch the Cube
send, {LCtrl Down}{LWin Down}{Up DownTemp}
RotatingCube := 1
}
return
~LCtrl up::
if (RotatingCube <> 0) {
send, {LWin Up}
Sleep 50
DetectHiddenWindows, off
WinWait, ahk_class TscShellContainerClass, , 1
if ErrorLevel {
;;Did not find MSTSC
;;Set SecondaryTaskbar as Always OnTop
Winset, AlwaysOnTop, off, SecondaryTaskbar
} else {
;;Set SecondaryTaskbar as Not Always OnTop (it has a bug)
Winset, AlwaysOnTop, off, SecondaryTaskbar
;;Maximizing MSTSC
WinActivate ahk_class TscShellContainerClass
send !^{vk03sc146}
}
}
RotatingCube := 0
return