Git Product home page Git Product logo

Comments (12)

FuPeiJiang avatar FuPeiJiang commented on July 27, 2024

note to self: Numpad5 doesn't follow if Desktop 2 has no windows

activate "VD examples", click on it, then activate any other window (I used explorer.exe or chromium edge), then press Numpad2, nothing happens

happens too in win11

from vd.ahk.

FuPeiJiang avatar FuPeiJiang commented on July 27, 2024

现在修好了吗?
谢谢 @huo-feng-ding

from vd.ahk.

huo-feng-ding avatar huo-feng-ding commented on July 27, 2024

现在修好了吗? 谢谢 @huo-feng-ding

刚试了下,在win10下还是不行。 我按的是 小键盘上的2,它还停留在原来的桌面。

from vd.ahk.

FuPeiJiang avatar FuPeiJiang commented on July 27, 2024

cannot reproduce, can you try it on another computer? can you write an autohotkey script to do it? (that I can run on my computer)

What's your A_OSVersion ?

does it work if you replace goToDesktopNum() with

    goToDesktopNum(desktopNum) { ; Lej77 https://github.com/Grabacr07/VirtualDesktop/pull/23#issuecomment-334918711
        Gui VD_animation_gui:New, % "-Border -SysMenu +Owner -Caption +HwndVD_animation_gui_hwnd"
        IVirtualDesktop := this._GetDesktops_Obj().GetAt(desktopNum)
        GetId:=this._vtable(IVirtualDesktop, 4)
        VarSetCapacity(GUID_Desktop, 16)
        DllCall(GetId, "Ptr", IVirtualDesktop, "Ptr", &GUID_Desktop)
        DllCall(this.MoveWindowToDesktop, "Ptr", this.IVirtualDesktopManager, "Ptr", VD_animation_gui_hwnd, "Ptr", &GUID_Desktop)

        Gui VD_active_gui:New, % "-Border -SysMenu +Owner -Caption"
        Gui VD_active_gui:Show ;you can only Show gui that's in another VD if a gui of same owned/process is already active
        Gui VD_animation_gui:Show ;after gui on current desktop owned by current process became active window, Show gui on different desktop owned by current process

        ; Sleep 100
        ; Gui VD_animation_gui:Destroy
        ; Gui VD_active_gui:Destroy
        ; "ahk_class TPUtilWindow ahk_exe HxD.exe" instead of "ahk_class WorkerW ahk_exe explorer.exe"
        ; Sleep 50
        ; if (activeHwnd:=WinExist("A")) {
        ;     if (!this._isValidWindow(activeHwnd)) {
        ;         if (this._activateWindowUnder()==-1) {
        ;             WinActivate % this.explorerDesktopWintitle
        ;         }
        ;     }

        ; } else {
        ;     if (this._activateWindowUnder()==-1) {
        ;         WinActivate % this.explorerDesktopWintitle
        ;     }
        ; }
    }

? (or simply commenting out WinActivate % this.explorerDesktopWintitle)

from vd.ahk.

FuPeiJiang avatar FuPeiJiang commented on July 27, 2024

也试一下这个 49766a2 (就更新一下)
win10改成了 "ahk_class Progman ahk_exe explorer.exe"

from vd.ahk.

huo-feng-ding avatar huo-feng-ding commented on July 27, 2024

A_OSVersion 显示的是 10.0.19045

也试一下这个 49766a2 (就更新一下) win10改成了 "ahk_class Progman ahk_exe explorer.exe"

我试了这上,也不行。最后我把代码改成这样就可以了,注释了 Gui VD_animation_gui:Destroy 这一句就可以了

    goToDesktopNum(desktopNum) { ; Lej77 https://github.com/Grabacr07/VirtualDesktop/pull/23#issuecomment-334918711
        Gui VD_animation_gui:New, % "-Border -SysMenu +Owner -Caption +HwndVD_animation_gui_hwnd"
        IVirtualDesktop := this._GetDesktops_Obj().GetAt(desktopNum)
        GetId:=this._vtable(IVirtualDesktop, 4)
        VarSetCapacity(GUID_Desktop, 16)
        DllCall(GetId, "Ptr", IVirtualDesktop, "Ptr", &GUID_Desktop)
        DllCall(this.MoveWindowToDesktop, "Ptr", this.IVirtualDesktopManager, "Ptr", VD_animation_gui_hwnd, "Ptr", &GUID_Desktop)

        Gui VD_active_gui:New, % "-Border -SysMenu +Owner -Caption"
        Gui VD_active_gui:Show ;you can only Show gui that's in another VD if a gui of same owned/process is already active
        Gui VD_animation_gui:Show ;after gui on current desktop owned by current process became active window, Show gui on different desktop owned by current process

        Sleep 100
;        Gui VD_animation_gui:Destroy
        Gui VD_active_gui:Destroy
        ; "ahk_class TPUtilWindow ahk_exe HxD.exe" instead of "ahk_class WorkerW ahk_exe explorer.exe"
        Sleep 50
        if (activeHwnd:=WinExist("A")) {
            if (!this._isValidWindow(activeHwnd)) {
                if (this._activateWindowUnder()==-1) {
                    WinActivate % this.explorerDesktopWintitle
                }
            }

        } else {
            if (this._activateWindowUnder()==-1) {
                WinActivate % this.explorerDesktopWintitle
            }
        }
    }

from vd.ahk.

FuPeiJiang avatar FuPeiJiang commented on July 27, 2024

Sleep 100 加长成 Sleep 500 还发生么?

    goToDesktopNum(desktopNum) { ; Lej77 https://github.com/Grabacr07/VirtualDesktop/pull/23#issuecomment-334918711
        Gui VD_animation_gui:New, % "-Border -SysMenu +Owner -Caption +HwndVD_animation_gui_hwnd"
        IVirtualDesktop := this._GetDesktops_Obj().GetAt(desktopNum)
        GetId:=this._vtable(IVirtualDesktop, 4)
        VarSetCapacity(GUID_Desktop, 16)
        DllCall(GetId, "Ptr", IVirtualDesktop, "Ptr", &GUID_Desktop)
        DllCall(this.MoveWindowToDesktop, "Ptr", this.IVirtualDesktopManager, "Ptr", VD_animation_gui_hwnd, "Ptr", &GUID_Desktop)

        Gui VD_active_gui:New, % "-Border -SysMenu +Owner -Caption"
        Gui VD_active_gui:Show ;you can only Show gui that's in another VD if a gui of same owned/process is already active
        Gui VD_animation_gui:Show ;after gui on current desktop owned by current process became active window, Show gui on different desktop owned by current process

        Sleep 500
        Gui VD_animation_gui:Destroy
        Gui VD_active_gui:Destroy
        ; "ahk_class TPUtilWindow ahk_exe HxD.exe" instead of "ahk_class WorkerW ahk_exe explorer.exe"
        Sleep 50
        if (activeHwnd:=WinExist("A")) {
            if (!this._isValidWindow(activeHwnd)) {
                if (this._activateWindowUnder()==-1) {
                    WinActivate % this.explorerDesktopWintitle
                }
            }

        } else {
            if (this._activateWindowUnder()==-1) {
                WinActivate % this.explorerDesktopWintitle
            }
        }
    }

if Sleep 500 works, then this should work better:

goToDesktopNum(desktopNum) { ; Lej77 https://github.com/Grabacr07/VirtualDesktop/pull/23#issuecomment-334918711
        Gui VD_animation_gui:New, % "-Border -SysMenu +Owner -Caption +HwndVD_animation_gui_hwnd"
        IVirtualDesktop := this._GetDesktops_Obj().GetAt(desktopNum)
        GetId:=this._vtable(IVirtualDesktop, 4)
        VarSetCapacity(GUID_Desktop, 16)
        DllCall(GetId, "Ptr", IVirtualDesktop, "Ptr", &GUID_Desktop)
        DllCall(this.MoveWindowToDesktop, "Ptr", this.IVirtualDesktopManager, "Ptr", VD_animation_gui_hwnd, "Ptr", &GUID_Desktop)

        Gui VD_active_gui:New, % "-Border -SysMenu +Owner -Caption"
        Gui VD_active_gui:Show ;you can only Show gui that's in another VD if a gui of same owned/process is already active
        Gui VD_animation_gui:Show ;after gui on current desktop owned by current process became active window, Show gui on different desktop owned by current process
        Gui VD_active_gui:Destroy
        loop 20 {
            if (this.getCurrentDesktopNum()==desktopNum) { ; wildest hack ever..
                Gui VD_animation_gui:Destroy

                ; "ahk_class TPUtilWindow ahk_exe HxD.exe" instead of "ahk_class WorkerW ahk_exe explorer.exe"
                if (activeHwnd:=WinExist("A")) {
                    if (!this._isValidWindow(activeHwnd)) {
                        if (this._activateWindowUnder()==-1) {
                            WinActivate % "ahk_class Progman ahk_exe explorer.exe"
                        }
                    }

                } else {
                    if (this._activateWindowUnder()==-1) {
                        WinActivate % "ahk_class Progman ahk_exe explorer.exe"
                    }
                }

                break
            }
            Sleep 25
        }

    }

from vd.ahk.

huo-feng-ding avatar huo-feng-ding commented on July 27, 2024

上边的两个代码试了,都不行。
试了第一个时间加长了, 出现的情况是先切到桌面2,过一小会儿自动回到桌面1了。 还是因为Gui VD_animation_gui:Destroy之后,自动回到了桌面1

from vd.ahk.

FuPeiJiang avatar FuPeiJiang commented on July 27, 2024

出现的情况是先切到桌面2,过一小会儿自动回到桌面1了

wow, this is useful information, I will try to _activateWindowUnder(), then destroy it
___
try the newest update ?
also what's your A_AhkVersion ? (I know this shouldn't matter, but I'm out of ideas)

from vd.ahk.

huo-feng-ding avatar huo-feng-ding commented on July 27, 2024

谢谢,此问题已解决。我用的autohotkey版本 v1版本是 v1.1.36.02 ; v2版本是 2.0.2

from vd.ahk.

FuPeiJiang avatar FuPeiJiang commented on July 27, 2024

终于!

from vd.ahk.

FuPeiJiang avatar FuPeiJiang commented on July 27, 2024

to reproduce the bug,
upon pressing # (Win Key) twice, I go back to the virtual desktop I was on (and I was on vscode)

from vd.ahk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.