28

I have 3 virtual desktops in Windows 10.
On one of those desktop I run mstsc fullscreen.

To switch desktop I can use windows+ctrl+left or right.
But when I am in a fullscreen mstsc this key is captured by mstsc and switching doesn't work.
Is there a way to change this behaviour?

  • I need an answer on this too! – Antony Mar 9 '16 at 16:10
  • 1
    Upvoting, because this would be great. It would be nice to choose which Windows key combinations apply to RDP or computer – MikeMurko Aug 29 '16 at 17:50
32

I was looking for a solution to this problem and just found one !

CTRL + ALT + HOME gives keyboard focus back to host when in Remote Desktop.
Then you can do WIN + CTRL + LEFT or RIGHT to switch between virtual desktops.
Not ideal, but i'll probably have autohotkey deal with these 2 shortcuts.

  • 1
    That's so f*** brilliant!! I was looking for something like this for awhile and the best I found was Ctrl + alt + break(pause), which closes the full screen mode - it's very uncomfortable! I'd give you bounty if this was stackoverflow, but I can't do this here. Thanks +1! – Kiril Kirov Jan 18 '18 at 13:23
  • Lov ya so much, take my uppoints!! – Fedaykin Jul 24 '18 at 17:05
7

It turns out that in remote desktop client, you should select "Only this computer" when it comes to applying Windows Key Combination.

Remote Desktop Local Resources

  • 4
    That works, but now I can't use ALT+TAB – r03 Mar 14 '16 at 9:51
  • 1
    I also have the same problem. I wish there was a way to make it ignore just win+ctrl+left/right – Ege Özcan Oct 6 '16 at 15:31
  • 1
    @EgeÖzcan there is (sort of)! See this answer – Luke May 5 '17 at 16:16
4

First, I wanted the Windows keys to work on the remote computer (Alt-Tab for instance), so I have "Only when using the full screen" for the "Apply Windows key combinaisons" setting.

Then, since very few key combinaisons are able to get you out of the remote desktop when it is full screen, you have to use CTRL-ALT-HOME, which brings the connection bar, but also gives back the control to the local computer.

So I wrote this autohotkey script : switchVirtualDesktopWithRD.ahk. It is completely based on this script, so I take no credit. I simply modified it for my needs. You can ajust it to yours...

In my case, I only have two virtual desktops : the first is the main one, and the second is where I run a full screen remote desktop client.

What the script does when I press CTRL-ALT-HOME :

  • If I am on the second virtual desktop, the one where I run a full screen remote desktop client, that first shows the connection bar. I then press the HOME key again (with CTRL and ALT still pressed) and I'm back to the first, main desktop. If there is no full screen session going on on the second desktop, the first combinaison immediatly switch to the first desktop.

  • If I am on the first desktop, it switches to the second one immediatly.

In other words, I always use CTRL-ALT-HOME to switch between desktops.

  • I like this. If we run an ahk script on the remote computer(s) (and set them to start when you login), I wonder if we could translate a CTRL-WIN-LEFT to CTRL-ALT-HOME and trigger the focus switch to the RDP connection bar from the remote ahk. Then you just need to press CTRL-WIN-LEFT twice to have it switch desktops. – Luke Apr 27 '17 at 18:23
  • I got it working, but with a script running only on the local machine - no need for ahk on the remote :D – Luke May 5 '17 at 16:10
3

Building off electrotype's answer I have an AHK script that will enable Ctrl+Win+Left and Ctrl+Win+Right hotkeys to switch desktops on the local computer, from within a full screen RDP session, without sacrificing any other keys within the RDP session - i.e. Alt+Tab and similar all still work as normal within the RDP session.

As we want the regular shortcut key to work on the remote computer, you must have "Only when using the full screen" for the "Apply Windows key combinaitons" setting when starting the RDP session.

I actually based my script off another script I found on the AHK forums.

What it does:

  • Run the script on your local machine (not on the remote desktop). I pasted mine into C:\users\<user>\documents\AutoHotkey.ahk so it runs when i start ahk with no arguments.
  • If you are inside an RDP session and press Ctrl+Win+(Left or right) the script first sends Ctrl+Alt+Home to focus the RDP title bar then sends the switch desktop key combo to actually switch the desktop.

Note: it gets a little buggy when using two or more virtual-remote desktops (eg. one local virtual desktop, two virtual desktops with a fullscreen RDP window on each) but I don't have time to work on it any more right now. The issue is when you switch from one virtual-remote desktop to another, you have to unbind and rebind the hot key and it's having trouble detecting this (though it shouldn't - the RDP title bar has a different window class but it doesn't always pick this up).

Ahk script:

;setTimer, windowwatch, 500
#persistent
#usehook
SLEEP_VAL := 500
DEBUG := false
keys_bound := false

while true {
    ;Debug("Waiting")
    sleep, SLEEP_VAL
    keys_bound := WaitBind()
}

WaitBind() {
    WinWaitActive, ahk_class TscShellContainerClass
    Debug("bind")
    hotkey LWin & Left, ctrl_win_left_key, on
    hotkey LWin & Right, ctrl_win_right_key, on
    return true
}

WaitUnbind() {
    WinWaitNotActive, ahk_class TscShellContainerClass
    Debug("unbind")
    hotkey LWin & Left, ctrl_win_left_key, off
    hotkey LWin & Right, ctrl_win_right_key, off
    return false
}

Debug(msg) {
    global DEBUG
    if (DEBUG) {
        tooltip %msg%
        settimer, TooltipClear, 2000
    }
}
return

z_key:
    ; simple script for testing - change the z to 'he'
    send, he
    Debug("done z")
return

j_key:
    ; testing if we can activate the RDP title bar
    send {Ctrl down}{Alt down}{Home}{Alt up}{Ctrl up}
    Debug("done j")
Return

ctrl_win_left_key:
    ; we are intercepting all Win+Left combinations so we have to do Win+Shift+Left and Win+Left manually to preserve them inside the RDP
    GetKeyState, shiftState, Shift
    GetKeyState, ctrlState, Ctrl
    if (shiftState = "D") {
        ; by default in windows Ctrl+Shift+Win+Left will act like Shift+Win+Left - shift takes precedence
        Debug("done shift win left")
        send {Shift down}{LWin down}{Left}{LWin up}{Shift up}
    } else if (ctrlState = "D") {
        Debug("done ctrl win left")
        ; the magic happens here
        send {Ctrl down}{Alt down}{Home}{Alt up}{Ctrl up}
        keys_bound := WaitUnbind()
        ;Sleep, SLEEP_VAL ;give the OS time to focus on the title bar
        send {Ctrl down}{LWin down}{Left}{LWin up}{Ctrl up}
    } else {
        Debug("done win left")
        send {LWin down}{Left}{LWin up}
    }
Return

ctrl_win_right_key:
    ; we are intercepting all Win+Right combinations so we have to do Win+Shift+Right and Win+Right manually to preserve them inside the RDP
    GetKeyState, shiftState, Shift
    GetKeyState, ctrlState, Ctrl
    if (shiftState = "D") {
        ; by default in windows Ctrl+Shift+Win+Left will act like Shift+Win+Left - shift takes precedence
        Debug("done shift win right")
        send {Shift down}{LWin down}{Right}{LWin up}{Shift up}
    } else if (ctrlState = "D") {
        Debug("done ctrl win right")
        ; the magic happens here
        send {Ctrl down}{Alt down}{Home}{Alt up}{Ctrl up}
        keys_bound := WaitUnbind()
        ;Sleep, SLEEP_VAL ;give the OS time to focus on the title bar
        send {Ctrl down}{LWin down}{Right}{LWin up}{Ctrl up}
    } else {
        Debug("done win right")
        send {LWin down}{Right}{LWin up}
    }
Return


TooltipClear:
    ; just a routine to turn off tooltip after x milliseconds
    tooltip
    settimer, TooltipClear, off
Return

windowwatch:
    ifwinactive ahk_class TscShellContainerClass
    {
      Debug("bind")
      hotkey LWin & Left, ctrl_win_left_key, on
      hotkey LWin & Right, ctrl_win_right_key, on
    }
    else
    {
     Debug("unbind")
     hotkey LWin & Left, ctrl_win_left_key, off
     hotkey LWin & Right, ctrl_win_right_key, off
    }
Return
  • Sometimes it feels like it's not working - I find i have to release and re-press the Ctrl+Win keys sometimes when i go from a local desktop to a remote or vice versa. Try that if it's not working, or increase the SLEEP_VAL at the top of the script to increase the delay between sending Ctrl+Alt+Home and Ctrl+Win+Left – Luke May 5 '17 at 16:20
3

If you have a touchpad, you can try the four finger gesture.

From Microsoft Support - Touchpad gestures for Windows 10

Switch virtual desktops: Place four fingers on the touchpad and swipe right or left.

I am working with two virtual desktops in Windows 10. On one of those desktop I am accessing a Win 7 through Remote Desktop in full screen mode.

I can switch between the two virtual desktops with this single gesture. It works for me.

-1

I got around the issue with having to press and release the hotkeys by changing the script so it binds the hotkeys when run and never unbinds them.

  • Please clarify and add a little more context to this answer to convey what you are suggesting exactly. You know, consider adding some reference to this answer supporting what you state. Otherwise, read over "Why do I need 50 reputation to comment" to ensure you understand how you can start commenting. – Pimp Juice IT Aug 11 '17 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.