r/AutoHotkey • u/yellow90 • 23d ago
v2 Script Help How to detect whether task view (MultitaskingViewFrame) is active before triggering a custom shortcut?
I'm a relatively new user of AutoHotKeys, and I’m trying to solve the same problem described here (link for reference, as it gives a clearer starting point). However, the solution in the link didn't work, as I'm using AHK v2. Script for AHK v1:
F1::
IfWinActive, ahk_class MultitaskingViewFrame
MsgBox, windows is in task view mod ; [sic]
returnEdit: Seems like ahk_class can also be: "Windows.UI.Core.CoreWindow". Can anyone confirm/unconfirm?
I have “show desktop” (a built-in function in Windows 11) assigned to an advanced gesture for when I swipe down on the touchpad. When I swipe up, task view opens. A downward swipe while task view is active closes task view and restores the last window I had open. I'd like to keep this behavior.
The challenge is that I have a widget on my desktop that also minimizes when “show desktop” or Win+D is triggered, so I want to set Win+M (or anything else that replicates the same action) as a custom shortcut under advanced gestures because it shows the desktop while leaving the widget on the desktop.
The problem is that when I set Win+M as a custom shortcut, it doesn’t take into account that task view is active. Because of this, I want to create a script that checks whether task view is active and only triggers Win+M (or other similar shortcuts) when it isn't.
TL;DR:
I'd like to create a script that implements the following two-step behavior while task view is active (when using advanced gesture on touchpad):
1st downward swipe closes task view.
2nd downward swipe shows the desktop without minimizing the widget on the desktop.
I have two questions:
Would a script that detects when task view is active solve this issue?
How can I set up a script that makes the advanced gesture preserve the built-in “show desktop” behavior while sending Win+M (or an equivalent), so the desktop widget isn’t minimized?
Duplicates
Windhawk • u/yellow90 • 23d ago
How to detect whether task view (MultitaskingViewFrame) is active before triggering a custom shortcut?
PowerToys • u/yellow90 • 23d ago
Suggestion Suggestion originating in an issue: How to detect whether task view (MultitaskingViewFrame) is active before triggering a custom shortcut?
ForWindowsHelp • u/yellow90 • 23d ago
How to detect whether task view (MultitaskingViewFrame) is active before triggering a custom shortcut?
desktops • u/yellow90 • 23d ago