PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

Moving a program with you to another virtual desktop

Open AnthonyLenglet opened this issue 6 years ago • 23 comments

One of the thing I've found lacking ever since I started using the virtual desktops is the ability to move a window with you while moving to another virtual desktop.

Currently, we can move to another desktop using the shortcut ctrl + win + left/right, I feel like a shortcut along the lines of ctrl + win + alt + left/right could be used to make the current active window move with you to the next desktop

I have no idea if this fits as a powertoy, please tell me if it doesn't !

AnthonyLenglet avatar May 07 '19 20:05 AnthonyLenglet

I currently use Virtual Desktop Enhancer to that effect. It's no longer maintained, but still works. You can configure keyboard shortcuts to move the currently focused program to an adjacent desktop, either with you or without changing desktops yourself.

I personally have set Ctrl + Alt + Win + Left/Right to move a program without switching and Ctrl + Shift + Win + Left/Right to take a program along.

StrScr avatar May 08 '19 04:05 StrScr

An existing alternative to virtual desktop enhancer, MoveToDesktop, is not archived, though it is limited to this one virtual desktop feature (move window hotkey). For me it's indispensable, and would be great to have the feature natively!

jburb avatar May 09 '19 13:05 jburb

for keeping stuff documented, https://docs.microsoft.com/en-us/sysinternals/downloads/desktops is one tool that had a basic UX for virtual desktops long ago

crutkas avatar Dec 19 '19 01:12 crutkas

You can already do this with the standard virtual desktop, right click the window in the tab switcher and select show this window on all desktops.

image

MadTinker avatar Sep 08 '20 12:09 MadTinker

You can already do this with the standard virtual desktop, right click the window in the tab switcher and select show this window on all desktops.

image

This isn't exactly the same thing (the proposal is mainly useful for when it comes to reorganising your windows using nothing but the keyboard) but it definitely helps for some cases

AnthonyLenglet avatar Sep 08 '20 13:09 AnthonyLenglet

Ah toggle that setting on the active window, actually I really like that and would use that more often. Good call imo.

MadTinker avatar Sep 08 '20 15:09 MadTinker

Note: #4298 is basically a duplicate of this idea, though it talks about "sending" a window to a specific virtual desktop rather than bringing it with when switching.

bitwiseman avatar Apr 14 '21 20:04 bitwiseman

XMonad only has the concept of sending a window over, and then you switch over with the usual command. More useful that way I'd think, since I often want to "clean up" and send a window I don't want to close somewhere else.

Tritlo avatar Apr 14 '21 23:04 Tritlo

Not to claim that this is the most useful post ever, but in my previous setup, I had a tool that did two things that I liked

  • Move windows between desktop using Win+Alt+Left/Right. Compated with the MoveToDesktop, this worked even when the app had already moved to another desktop
  • Show the name of the desktop when switching

I don't remember the name and I also cannot find it, hence my original remark of "not the most useful post ever". Sorry and if I find it I'll update here. It was certainly on github and worked as a portable as well. The app deserves much more visibility as well. If anyone knows it, please post as well because it would be a great base to discuss upon.

Sarafian avatar Aug 09 '21 09:08 Sarafian

Not to claim that this is the most useful post ever, but in my previous setup, I had a tool that did two things that I liked

  • Move windows between desktop using Win+Alt+Left/Right. Compated with the MoveToDesktop, this worked even when the app had already moved to another desktop
  • Show the name of the desktop when switching

I don't remember the name and I also cannot find it, hence my original remark of "not the most useful post ever". Sorry and if I find it I'll update here. It was certainly on github and worked as a portable as well. The app deserves much more visibility as well. If anyone knows it, please post as well because it would be a great base to discuss upon.

One that does that (it uses WIN-key+1..20 to switch to desktops) is WS Virtual Desktop Tool, available on the MS Store . It too does transfer windows to a desktop with shortcuts. https://www.microsoft.com/en-us/p/ws-virtual-desktop-tool/9n5wrj22t733?activetab=pivot:overviewtab

rinzwind5 avatar Sep 17 '21 02:09 rinzwind5

One that does that (it uses WIN-key+1..20 to switch to desktops) is WS Virtual Desktop Tool, available on the MS Store . It too does transfer windows to a desktop with shortcuts. https://www.microsoft.com/en-us/p/ws-virtual-desktop-tool/9n5wrj22t733?activetab=pivot:overviewtab

Thank you. It was not from the store but a stand alone executable. Might have evolved to the paid app's link.

Sarafian avatar Sep 20 '21 17:09 Sarafian

Since we're collecting... this one also provides the functionality: https://github.com/ViRb3/SylphyHornEx

krisrok avatar Feb 07 '22 07:02 krisrok

And to follow krisrok's link, here's one that actually works on Win11. These obviously are just workarounds and it would be MUCH preferred to have a PowerToys version of the functions provided by these applications. https://github.com/hwtnb/SylphyHornPlusWin11

ariccb avatar Feb 09 '22 21:02 ariccb

Since my ticket was closed as a duplicate, I think it's better to post it here.

The solution I found to achieve this relies in a AHK Script

Answer found here: https://superuser.com/questions/950452/how-to-quickly-move-current-window-to-another-task-view-desktop-in-windows-10.

I edited the keybindings from the original owner to ctrl + shit +win + left/right

^+#Left::
  WinGetTitle, Title, A
  WinSet, ExStyle, ^0x80, %Title%
  Send {LWin down}{Ctrl down}{Left}{Ctrl up}{LWin up}
  sleep, 50
  WinSet, ExStyle, ^0x80, %Title%
  WinActivate, %Title%
Return

^+#Right::
  WinGetTitle, Title, A
  WinSet, ExStyle, ^0x80, %Title%
  Send {LWin down}{Ctrl down}{Right}{Ctrl up}{LWin up}
  sleep, 50
  WinSet, ExStyle, ^0x80, %Title%
  WinActivate, %Title%
Return

Just compile it as an executable and put it on shell:startup

renantmagalhaes avatar Jun 15 '22 21:06 renantmagalhaes

Interesting solution. Sending Keypresses to activate the shortcut is a bit hacky, but if it works it's nice :)

jaimecbernardo avatar Jun 20 '22 11:06 jaimecbernardo

@renantmagalhaes nice job. worked. I would still love for it to be part of Powertoys

jasonjac2 avatar Aug 17 '24 11:08 jasonjac2

It's been 5 years since this was opened. Can we get an update on it's development?

If any maintainer has time, please take a look at it.

enesbala5 avatar Aug 27 '24 22:08 enesbala5

For reference, a working AHK v2's script is the following.

#Requires AutoHotkey v2.0
#SingleInstance force
ListLines 0
SendMode "Input"
SetWorkingDir A_ScriptDir
KeyHistory 0
#WinActivateForce
ProcessSetPriority "H"
SetWinDelay -1
SetControlDelay -1
#Include %A_LineFile%\..\VD.ah2

; wrapping / cycle back to first desktop when at the last
^#left::VD.goToRelativeDesktopNum(-1)
^#right::VD.goToRelativeDesktopNum(+1)

; move window to left and follow it
^#!left::VD.goToDesktopNum(VD.MoveWindowToRelativeDesktopNum("A", -1))
; move window to right and follow it
^#!right::VD.goToDesktopNum(VD.MoveWindowToRelativeDesktopNum("A", 1))

Reference: https://superuser.com/a/1850434/303655

FindHao avatar Oct 12 '24 16:10 FindHao

We're reaching the 6th year anniversary of this issue 🥳. Unfortunately I am not allowed to use AHK on my work machine. Gnome/Ubuntu/Fedora has this simple feature for years 🥹

No in all seriousness, I like PowerToys a lot. Could we receive an update on its development? If any maintainer has time, please review it.

savonbeldi avatar Jan 14 '25 11:01 savonbeldi

Almost six years in, PowerToys already handles proper tiling and other features—why not this as well?

surajmandalcell avatar Feb 19 '25 18:02 surajmandalcell

Almost six years in, PowerToys already handles proper tiling and other features—why not this as well?

Well, the reason is that 'new' MS does not like to publish decent open win32 flat style API's for newer OS functionality. Mostly all functionality is hidden behind private API's that change their signature at random too.

rinzwind5 avatar Feb 22 '25 08:02 rinzwind5

Pinging this alive.

Well, the reason is that 'new' MS does not like to publish decent open win32 flat style API's for newer OS functionality. Mostly all functionality is hidden behind private API's that change their signature at random too.

Can this really be the reason we don't have the functionality? If AHK can do it, why shouldn't PowerToys, a Microsoft controlled set of addons be able to implement something for it?

s7726 avatar May 03 '25 19:05 s7726

Pinging this alive.

Well, the reason is that 'new' MS does not like to publish decent open win32 flat style API's for newer OS functionality. Mostly all functionality is hidden behind private API's that change their signature at random too.

Can this really be the reason we don't have the functionality? If AHK can do it, why shouldn't PowerToys, a Microsoft controlled set of addons be able to implement something for it?

AHK can only do it because a few of its users wrote code that uses those undocumented API's which can and will break at any update for no apparent dev reason. PowerToys does not want to rely on this once in a while changing behavior across Windows versions and update level. Ms doesn't even bother to update win32 windowing functions for new Windows behavior and the virtual desktop feature is mostly simple inaccessible and what is available is bare bones and mostly useless in any practical sense and only available for c++. And VD is (by far) not the only area where they make things needlessly difficult to achieve.

rinzwind5 avatar May 04 '25 05:05 rinzwind5

Isn’t this an official win32 function exactly for this purpose https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ivirtualdesktopmanager-movewindowtodesktop ?

UrosBizi avatar Jul 17 '25 11:07 UrosBizi

Isn’t this an official win32 function exactly for this purpose https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ivirtualdesktopmanager-movewindowtodesktop ?

Neh, only works for your own process's windows. The API that handles all is not published for idiot reasons. And changed/changes frequently. And is a com object. What happened with flat win32 c style easily usable in any programming language?

rinzwind5 avatar Jul 17 '25 12:07 rinzwind5

Isn’t this an official win32 function exactly for this purpose https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ivirtualdesktopmanager-movewindowtodesktop ?

Neh, only works for your own process's windows. The API that handles all is not published for idiot reasons. And changed/changes frequently. And is a com object. What happened with flat win32 c style easily usable in any programming language?

Ok, thank you for explaining. We will keep on waiting, and maybe with time MS people will change their mind.

UrosBizi avatar Jul 17 '25 17:07 UrosBizi

Can we do something that forces ms to look at this? like posting frequently on their forums or something? I don't think they will take notice otherwise.

surajmandalcell avatar Jul 18 '25 13:07 surajmandalcell