4

I am yet to find a method to switch desktops that doesn't result in the taskbar icons highlighting orange.

e.g. the following script wreaks this havoc on my taskbar

^#Right::
send, ^#{Right}
return

^#Left::
send, ^#{Left}
return

What methods are there to get around this?

smdanjm
  • 41
  • 1
  • Is there any more info that you can provide on this issue? The script works fine for me as is: I am currently not able to reproduce what you are experiencing. – Spyre Jan 04 '21 at 02:28
  • So for me to reproduce on my system, I: 1) open a couple desktops. I usually use 3, 2) put one program on each desktop, 3) switch between desktops. When I use the original windows shortcuts to switch, the window on the new desktop is selected. But when I use the autohotkey shortcuts, then the window on the new desktop remains inactive and its icon starts highlighting orange. Is it just my system or is this a more common issue on windows 10? (Education, 64-bit) – smdanjm Jan 05 '21 at 16:47
  • So ^#XButton2::Send ^#{Right} return causes the issue while ^#XButton2::^#Right return doesn't. Obviously something about the way the send command works that I don't understand. – smdanjm Jan 11 '21 at 00:09
  • you could try rawsend see if that makes a difference – Rubys wolf May 24 '21 at 03:29

1 Answers1

1

Sometimes when I switch desktop, the application that's focused on that desktop becomes highlighted in the task bar.

Example: On desktop A, I have Firefox:
untitled

On desktop B I have Steam (note that Firefox is pinned to my task bar, which is why it's visible on this desktop):
untitled2

When I switch from A to B, Steam becomes highlighted:
untitled3 (It's possible to stop the blinking by explicitly selecting the blinking window with the mouse or alt+tab.)

When I switch back to A, Firefox also becomes highlighted (and Steam stays visible in the taskbar because it is highlighted):
untitled4

This doesn't always happen; I'm not sure if it depends on the programs or where the mouse/keyboard focus is when switching desktops. That said, it happens far too often, to the point where it defeats the point of having multiple desktops at all.

(The problem isn't limited to Firefox and Steam, the same thing also happens with other programs like Explorer.)

https://github.com/FuPeiJiang/VD.ahk#cool-fixes

WinActivate taskbar before switching and WinMinimize taskbar after arriving

    ;activate taskbar before
    WinActivate, ahk_class Shell_TrayWnd
    WinWaitActive, ahk_class Shell_TrayWnd
    DllCall(SwitchDesktop, "ptr", IVirtualDesktopManagerInternal, "UPtr", IVirtualDesktop, "UInt")
    DllCall(SwitchDesktop, "ptr", IVirtualDesktopManagerInternal, "UPtr", IVirtualDesktop, "UInt")
    WinMinimize, ahk_class Shell_TrayWnd

https://github.com/FuPeiJiang/VD.ahk/blob/6fc1b2b7ff9ab53c8530c0d9a2e01a6617c064f4/VD.ahk#L555-L560

actual source: https://github.com/mzomparelli/zVirtualDesktop/issues/59#issuecomment-317613971

Mr. Doge
  • 796
  • 5
  • 11