Comments (6)
@arakis
I can't reproduce on Windows 11 nor Windows 10
;you should first Run this, then Read this
;Ctrl + F: jump to #useful stuff
;#SETUP START
#SingleInstance force
ListLines 0
SendMode "Input"
SetWorkingDir A_ScriptDir
KeyHistory 0
#WinActivateForce
ProcessSetPriority "H"
SetWinDelay -1
SetControlDelay -1
;include the library
#Include %A_LineFile%\..\VD.ah2
; or
; #Include %A_LineFile%\..\_VD.ahk
; ...{startup code}
; VD.init()
; VD.ahk : calls `VD.init()` on #Include
; _VD.ahk : `VD.init()` when you want, like after a GUI has rendered, for startup performance reasons
;you should WinHide invisible programs that have a window.
try WinHide "Malwarebytes Tray Application"
;#SETUP END
VD.createUntil(3) ;create until we have at least 3 VD
return
foo(desktopNum) {
VD.goToDesktopNum(desktopNum)
ToolTip WinGetTitle("A") " ahk_class " WinGetClass("A") " ahk_exe " WinGetProcessName("A")
}
#NumpadEnd::foo(1)
#NumpadDown::foo(2)
#NumpadPgDn::foo(3)
f3::Exitapp
What's the active window after switch ?
is it that no window is active ?
is it an invisible window ?
from vd.ahk.
the next step in debugging would be to put
ToolTip WinGetTitle("ahk_id " theHwnd) " ahk_class " WinGetClass("ahk_id " theHwnd) " ahk_exe " WinGetProcessName("ahk_id " theHwnd)
above
WinActivate "ahk_id " theHwnd
in the function _activateWindowUnder
from vd.ahk.
Thank you for the debugging script. I tried the initial script, without modifying the _activateWindowUnder
method. I found now the reason, but not the solution.
The reason is that application: https://apps.microsoft.com/store/detail/virtual-desktop-indicator/9NHCL1XQWXF1?hl=en-us&gl=us
It's a small utility app, that shows the active desktop after switching. After switch, a small window will shown, and then disappiers after some seconds. That utility window is never visible in "alt-tab"-List, so it should be impossible to focus it - but AutoHotkey does! Because the utility app it's a commercial, closed source app, it would be impossible to debug the problem further. But I'm still asking me why this problem never occurs, when using the built-in windows shortcut. In other words: Without the autohotkey script, the correct windows will always be focused (and never the utility app), regardless how fast i switch between the VD with the build-in windows shortcut.
from vd.ahk.
I have now an idea, but for that I need to learn the AutoHotkey Script language a little bit more:
Sending the ALT+ESC conditionally when the VirtualDesktopIndicator.exe
is focused. Or finding other ways to unfocus the app, if it's focused.
from vd.ahk.
@arakis
it should work now
But I'm still asking me why this problem never occurs, when using the built-in windows shortcut. In other words: Without the autohotkey script, the correct windows will always be focused (and never the utility app), regardless how fast i switch between the VD with the build-in windows shortcut.
nice question
The reason is that application: apps.microsoft.com/store/detail/virtual-desktop-indicator/9NHCL1XQWXF1?hl=en-us&gl=us
thanks, I used the free trial to figure out
turns out, if you set GW_OWNER
to the desktop window (which has className:#32769
)
it will disappear from taskbar, alt+tab list, and appear on all desktops, this is how to set it:
SetWindowLongPtrW(hWnd, GWLP_HWNDPARENT, (LONG_PTR)GetDesktopWindow());
notice how it's GWLP_HWNDPARENT instead of GW_OWNER, the name is misleading
https://stackoverflow.com/questions/133122/how-to-change-a-window-owner-using-its-handle#comment-24839121
> GWL_HWNDPARENT changes the OWNER, not the parent, of a window
from vd.ahk.
@FuPeiJiang thank you very, very much, it works! I appreciate your work and the effort you invested in nailing down this problem. Can I buy you a coffee? :-)
from vd.ahk.
Related Issues (20)
- After pinning with AH2 version, I get an error when switching desktops by number.
- Script sending "Q" to discord | Desktop switch failure. HOT 2
- getDesktopNumOfWindow sometimes returns -1 rather than the correct num HOT 4
- Error HOT 10
- open Application directly on one virtual desktop in background HOT 2
- "Error: (0x80004002) No such interface supported" after updating Windows 11 (Beta insider channel) HOT 13
- sending keypress to specified virtual desktop only.
- Ah2: Desktop Looping & Switching + Other Feature Regression from Commit ee2f54f626914273f00853306c1daaf803f756cb HOT 2
- It doesn't work on Windows 11 Build 22621.2215 (22H2) HOT 2
- A problem with the new Windows update 11 HOT 18
- Virtual desktop Tasksbar icons HOT 4
- renaming desktops HOT 1
- Switching to Relative Desktop fails initially HOT 2
- Current desktop count is always zero
- New Windows Build 23606: VD.getCurrentDesktopNum() always returns 0 HOT 4
- Windows Server 2022 version HOT 3
- It doesn't work on Windows 11 Build 22631.3085 (23H2) HOT 13
- v2_port分支没有 TogglePinApp,PinApp,UnPinApp HOT 2
- WinExist in another virtual desktop HOT 7
- Previous Desktop HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vd.ahk.