Ciantic / VirtualDesktopAccessor

DLL for accessing Windows 11/10 Virtual Desktop features from e.g. AutoHotkey
MIT License
773 stars 93 forks source link

animation? #29

Open ondras opened 4 years ago

ondras commented 4 years ago

Hi,

switching Desktops appears to be instant, as opposed to the nice "swipe" animation provided by the default ctrl+win+arrow implementation. Is it possible to maintain the animation when exposing the API?

Ciantic commented 4 years ago

It's a good question, and I remember when I created this that I wanted that too.

However I don't see any setting to enable it, the function SwitchDesktop in the API does not take any parameters.

ondras commented 4 years ago

@Ciantic okay, thanks for the explanation!

Ciantic commented 4 years ago

Let's keep this open, maybe someone knows how to do it.

ondras commented 4 years ago

This app seems to do animation as well...

Ciantic commented 4 years ago

Hey thanks! More discoveries! SwitchDesktop actually does take parameter, according the code you gave, it's now doable.

However I'm a bit busy right now, but it should be doable from the code you gave.

Ciantic commented 4 years ago

Oh noes, it doesn't look like it. They are calling the keyboard shortcut to "fake it".

ondras commented 4 years ago

Cheaters! :)

(Well... pretty doable in AHK as well :smile:)

mzomparelli commented 1 year ago

There is a method in IVirtualDesktopManagerInternal that might allow us to get the animation:

IVirtualDesktopManagerInternal.SwitchDesktopWithAnimation(IVirtualDesktop desktop)

It has the same signature so it should work like a drop in replacement

IVirtualDesktopManagerInternal.SwitchDesktop(IVirtualDesktop desktop)

I haven't tested this but I plan to at some point.

Ciantic commented 1 year ago

@mzomparelli thanks for updating, I see the Python script we now use outputs that.

I'm testing with that now on my animation feature branch https://github.com/Ciantic/VirtualDesktopAccessor/tree/feature/animation

It switches desktop that's for sure, but for some reason, I don't get the switch desktop animation. I don't get those animations even with Windows+Ctrl+Left/Right at the moment, so I can't verify if it works or not, something else might be broken on my Windows 11.

Ciantic commented 1 year ago

I think the function isn't used anymore if this article is true.

Windows 11 may have removed the whole animation:

https://answers.microsoft.com/en-us/windows/forum/all/windows-11-virtual-desktop-animation/b5adac48-7c54-4fd4-8e5e-3e4adf3d3a26

I checked on Windows Insider Build and stable channel PCs, both do not have the switching animation. The last update was, Microsoft removed it:

https://blogs.windows.com/windows-insider/2021/...

We’ve turned off the animation when switching Desktops using the keyboard shortcuts as it was leading to flashes and hangs.

Lej77 commented 1 month ago

For now at least it seems Windows 11 does offer a different function that uses animations when switching current virtual desktop. There are some extra methods in the COM interface IVirtualDesktopManagerInternal that needs to be added here.

I got it working in my virtual-desktop-manager-rs program that uses my fork of the winvd library. I also built a modified VirtualDesktopAccessor.dll that has an extra DLL function fn GoToDesktopNumberWithAnimation(desktop_number: i32) -> i32 that should switch desktop with an animation.

The animation works when I tested it on Windows 11 23H2 (OS Build 22631.4169).

Ciantic commented 1 month ago

@Lej77 I also have an old branch with that https://github.com/Ciantic/VirtualDesktopAccessor/tree/feature/animation

Last time I checked it didn't trigger animation but changed desktop normally without animation. I will try again when I come around to this.