33

The year is 2021. In Windows 11, how can I move the current focused window to the next windows desktop using shortcut keys only?

I know that I can switch desktops using these combinations:

Win+Ctrl+: Switch to the next desktop

Win+Ctrl+: Switch to the previous desktop

Adding the following shortcut keys seem most comfortable to me - and used in Ubuntu:

Win+Ctrl+Shift+: Move current window to the next desktop

Win+Ctrl+Shift+: Move current window to the previous desktop

Similar shortcut keys to above would be acceptable... but even better if I can re-map them to my preferred combination.

Is there anything like this out of the box? Or do I need to install some 3rd party tools?

Adamski
  • 478
  • 1
  • 5
  • 11
  • There isn’t a shortcut that exists that can change the which virtual desktop an application exists on at this time. – Ramhound Nov 05 '21 at 23:11
  • 2
    Well, that's annoying. It seems fundamental for a power user. I read somewhere that [AutoHotKey](https://www.autohotkey.com/) might be the best way. I will look into it. – Adamski Nov 05 '21 at 23:32
  • You still only have a single desktop on Windows, if a program could only be launched once, even if you have two virtual desktops setup, you cannot have separate instances of that program open. – Ramhound Nov 06 '21 at 00:01
  • 1
    Yes I know that, but I don't see how it's relevant to my question? I don't mind if there's only 1 instance of a program, I just want to be able to move that instance to another desktop without reaching for my mouse. – Adamski Nov 06 '21 at 18:39
  • Well that isn’t a feature of Windows at this time – Ramhound Nov 06 '21 at 21:34
  • 2
    In Windows 10, there was a little program called MoveToDesktop which allowed you to use a hotkey. See https://github.com/Eun/MoveToDesktop However, it doesn't work with Windows 11... :-( – user3012629 Nov 22 '21 at 17:39
  • Take a look at windows power toys – Blind Spots Jan 08 '23 at 18:02
  • 1
    @BlindSpots I have Power Toys, it's great. Fancy Zones is a great window manager, but it doesn't seem to support my Use Case. AHK does, but it would be great if Power Toys did too! – Adamski Mar 14 '23 at 18:55

8 Answers8

23

As I haven't used AutoHotkey before, I needed to figure out a few additional steps (compared to what is explained in the existing answers) to find a working solution:

  1. Download and install AutoHotKey
  2. Clone the VD.ahk repository (it is an AutoHotkey library adding several script functions for managing virtual desktops)
  3. Inside the cloned directory, create a new file (arbitrary name, ending with .ahk) and paste the content from @Lorenzo Morelli's answer into it.
  4. Double-click the script to run it. The shortcuts (Win+Ctrl+Shift+: Move current window to the next desktop; Win+Ctrl+Shift+: Move current window to the previous desktop) should now work.
  5. To make sure the script runs on every Windows startup, create a shortcut to it and put it into the folder for your Startup programs. Open that folder by typing shell:startup in the window that pops up after you hit Win + R.
Sejmou
  • 371
  • 2
  • 5
  • Highlight: move the .ahk file INSIDE the cloned VD.ahk folder ! Beside that, typing `shell:run` in the Run window doesn't work ("Windows cannot find 'shell:run'. Make sure that you typed the name correctly...". What did you actually mean ? Besides, THANKS for your explanation. – deb0ch Jul 21 '22 at 22:25
  • 1
    Sorry, it should have been `shell:startup`, thanks for letting me know! I updated my answer – Sejmou Jul 24 '22 at 07:51
  • 3
    Made a repo for this and some other Win11 window management things https://github.com/phazei/Win11AutoHotKeyFixes – phazei Nov 16 '22 at 09:14
21

I put the full AutoHotKey script taken from the @void's answer for helping unexpert/lazy people :)

;#SETUP START
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
ListLines Off
SetBatchLines -1
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#KeyHistory 0
#WinActivateForce

Process, Priority,, H

SetWinDelay -1
SetControlDelay -1

;include the library
#Include VD.ahk
; VD.init() ;COMMENT OUT `static dummyStatic1 := VD.init()` if you don't want to init at start of script

;you should WinHide invisible programs that have a window.
WinHide, % "Malwarebytes Tray Application"
;#SETUP END

VD.createUntil(3) ;create until we have at least 3 VD

return

^#+Left::
n := VD.getCurrentDesktopNum()
if n = 1
{
    Return
}
n -= 1
VD.MoveWindowToDesktopNum("A",n), VD.goToDesktopNum(n)
Return

^#+Right::
n := VD.getCurrentDesktopNum()
if n = % VD.getCount()
{
    Return
}
n += 1
VD.MoveWindowToDesktopNum("A",n), VD.goToDesktopNum(n)
Return
Lorenzo Morelli
  • 311
  • 2
  • 4
20

Win+Ctrl+Shift+: Move current window to the next desktop

Win+Ctrl+Shift+: Move current window to the previous desktop

This ahk script works for me:

^#+Left::
n := VD.getCurrentDesktopNum()
if n = 1
{
    Return
}
n -= 1
VD.MoveWindowToDesktopNum("A",n), VD.goToDesktopNum(n)
Return

^#+Right::
n := VD.getCurrentDesktopNum()
if n = % VD.getCount()
{
    Return
}
n += 1
VD.MoveWindowToDesktopNum("A",n), VD.goToDesktopNum(n)
Return

You can find more at https://github.com/FuPeiJiang/VD.ahk and https://www.autohotkey.com/

void
  • 316
  • 2
  • 3
6

No sure which version is being discussed in this thread, but as of this date (2022/07/22), it is easy to move windows among Win-11 virtual desktops.

  1. select the VD icon on the Task Bar, an active desktops bar appears at the bottom of the current display.
  2. hover your mouse over it, then over the source desktop, then up into the space above it showing all its active applications
  3. right click on the application you want to move and then on 'Move To'; select the destination virtual desktop.

There is an additional handy and related feature available if you are working in one virtual desktop and the application you want is already open on a different virtual desktop:

  1. go to the Task Bar and double click on the seemingly unopened app icon. You will instantly be taken to the appropriate virtual desktop and the application.
Peter
  • 77
  • 1
  • 1
  • 1
    Super convenient – jonasfh Sep 13 '22 at 07:43
  • 1
    Glad I've found this, thanks! I'll just add a bit different instructions because I was super confused how to do the steps you wrote :) 1 - *click* the desktops icon in the taskbar 2 - hover over the desktop which has the screen you want 3 - drag&drop that window to the desktop you want – veljkoz Sep 25 '22 at 19:55
  • 3
    The question was about using shortcuts only. First point can be achieved by simply pressing Win+Tab shortcut. But the rest requires reaching for a mouse and making three clicks, which is very slow compared to a key shortcut. And for power users its very annoying. – bujon Jan 06 '23 at 23:00
0

I haven't found a way to do this myself nor have I found any information online to do this either. It would be nice, but there is sort of a work around for this. If you go to settings-->system-->multitasking, you can set a few desktop settings that enables you to see all of your apps across your desktops from alt-tab and/or on the taskbar.

I personally left alt-tab desktop specific (since I find it to be too cluttered otherwise) but I like to be able to switch to personal chat or whatever without having to desktop over, then go to the window.

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 19 '22 at 05:17
  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](https://superuser.com/help/whats-reputation) you will be able to [comment on any post](https://superuser.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/1103404) – DarkDiamond Jan 19 '22 at 06:46
  • 2
    I don't understand. I posted a work around that I thought was helpful since there is no way to accomplish what the OP is asking. If i'm not allowed to post a workaround as an answer, and I can't comment on a post, how do I provide information for others like me who searched google and came to this thread? –  Jan 20 '22 at 14:17
  • @Stratus41298 Your effort to contribute is appreciated, but the answer itself adds no value; it does not answer the question. The question states that I'm searching for a solution to use shortcut keys to MOVE the current window TO ANOTHER virtual desktop. Your workaround is about selecting a window. StackOverflow is all about providing specific answers to specific questions. Your workaround does not address the question, it just identifies your workflow. Don't give up trying to add value here as it all helps. Just don't expect positive reactions to an off-topic answer. Specificity is key here! – Adamski Feb 08 '22 at 00:13
  • 1
    I was attempting to address his basic need, which was to see his various windows even when on a different desktop. There is no actual way to do what he asked out of the box, I was trying to impart a workaround. Maybe I'm arguing semantics at this point, but I guess I'm taking exception to your statement that my answer adds no value, but that "...it all helps". I'm giving up on trying to get anywhere with this community. I'm entirely at the whim of other users who may or may not give me enough reputation to even reply in the right area without getting in trouble for trying to be helpful. –  Feb 09 '22 at 20:04
  • 2
    > StackOverflow is all about providing specific answers to specific questions Sometimes the best answer is an alternative approach that means you don't have to have an answer. If StackOverflow is against such answers, StackOverflow is letting dogmatism overrule practicality. – Swiss Frank Jul 04 '22 at 11:32
0

This isn't true in Windows 11 (or it has been added).

On the menu bar, click the task-view button (to the right of the search). If not there, right-click task bar, go to settings and enable it.

Click that. It will show all windows and desktops. You can drag the window to the desktop of choice.

EDIT: Noticed that this was answered above using the ⊞ Win+Tab combo to bring up task-view.

Jackdaw
  • 1,087
  • 2
  • 6
  • 19
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 08 '23 at 20:32
  • I am actually going with this approach, as it does not require another running app. Just use + and move the window with the mouse to the next screen. Not as "quick" as the suggested method to move a window directly to a new desktop, but working right away :) Thanks! – Alexander Taubenkorb Jul 05 '23 at 06:21
-1
  1. Switch to the virtual desktop where is the window that you want to move.
  2. Press Win+Tab and continue holding the Win key.
  3. Drag and drop the window to the wanted virtual desktop at the bottom of the screen.
-1

The AHK instructions from @void, @Lorenzo Morelli, and @Sejmou are great. bouncing windows between virtual desktops is now a breeze.

One thing I would like to add if you are having trouble: when Windows Explorer crashes, your desktop count/number are both set to zero in the script, breaking the hotkey commands. Restarting the script fixes that.

It's helpful to set hotkeys to give you a message popup informing you of which desktop you are on, to see if that has happened. If you see "0", then you know you have to restart your script.

Benji
  • 1
  • 1