[cmdpal] Add setting "ignore hotkey when full screen" (#38923)

* init

* merge main

* merge main

---------

Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
This commit is contained in:
Yu Leng
2025-04-23 11:40:20 +08:00
committed by GitHub
parent e1ad7e39c6
commit d4e577bb81
7 changed files with 87 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.InteropServices;
namespace Microsoft.CmdPal.UI.Helpers;
internal sealed partial class WindowHelper
{
public static bool IsWindowFullscreen()
{
UserNotificationState state;
// https://learn.microsoft.com/en-us/windows/win32/api/shellapi/ne-shellapi-query_user_notification_state
if (Marshal.GetExceptionForHR(NativeMethods.SHQueryUserNotificationState(out state)) == null)
{
if (state == UserNotificationState.QUNS_RUNNING_D3D_FULL_SCREEN ||
state == UserNotificationState.QUNS_BUSY ||
state == UserNotificationState.QUNS_PRESENTATION_MODE)
{
return true;
}
}
return false;
}
}