有没有办法告诉 autohotkey 它只能在桌面上工作,而不能在其他任何地方工作?

Is there anyway to tell autohotkey that it has to work only on the desktop, and nowhere else?

我希望 Autohotkey 能够区分我何时在桌面上,并且 运行 仅在桌面上设置一组特定的快捷方式,并在我不在桌面上时暂停这些快捷方式。反正有这样做吗?我在 Windows 10 机器上工作。

如果我的语言不是很清楚,我附上了一张简单的图。

一些想法:
检查活动 window.
的循环 只有在桌面处于活动状态时才有效的上下文相关热键。

Loop
{
WinGetClass, vWinClass, A

if vWinClass in Progman,WorkerW
{
;do this
}
else
{
;do that
}

Sleep 5000
}

;==================================================

GroupAdd, vGroupDesktop, ahk_class Progman ;desktop
GroupAdd, vGroupDesktop, ahk_class WorkerW ;desktop

#IfWinActive, ahk_group vGroupDesktop
^q::
;do this
Return
#IfWinActive

注:
同时使用两个单独的脚本 运行 可能是一个值得考虑的想法。