mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-05 06:15:26 +00:00
Control SMT
This commit is contained in:
parent
d7ad2f1d71
commit
7dc418a0e0
6 changed files with 259 additions and 32 deletions
|
|
@ -2,6 +2,7 @@
|
|||
using CommonHelpers.FromLibreHardwareMonitor;
|
||||
using Microsoft.VisualBasic.Logging;
|
||||
using PowerControl.External;
|
||||
using PowerControl.Helpers;
|
||||
using RTSSSharedMemoryNET;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -97,7 +98,7 @@ namespace PowerControl
|
|||
|
||||
GlobalHotKey.RegisterHotKey(Settings.Default.MenuUpKey, () =>
|
||||
{
|
||||
if (!isForeground())
|
||||
if (!RTSS.IsOSDForeground())
|
||||
return;
|
||||
rootMenu.Prev();
|
||||
setDismissTimer();
|
||||
|
|
@ -106,7 +107,7 @@ namespace PowerControl
|
|||
|
||||
GlobalHotKey.RegisterHotKey(Settings.Default.MenuDownKey, () =>
|
||||
{
|
||||
if (!isForeground())
|
||||
if (!RTSS.IsOSDForeground())
|
||||
return;
|
||||
rootMenu.Next();
|
||||
setDismissTimer();
|
||||
|
|
@ -115,7 +116,7 @@ namespace PowerControl
|
|||
|
||||
GlobalHotKey.RegisterHotKey(Settings.Default.MenuLeftKey, () =>
|
||||
{
|
||||
if (!isForeground())
|
||||
if (!RTSS.IsOSDForeground())
|
||||
return;
|
||||
rootMenu.SelectPrev();
|
||||
setDismissTimer();
|
||||
|
|
@ -124,7 +125,7 @@ namespace PowerControl
|
|||
|
||||
GlobalHotKey.RegisterHotKey(Settings.Default.MenuRightKey, () =>
|
||||
{
|
||||
if (!isForeground())
|
||||
if (!RTSS.IsOSDForeground())
|
||||
return;
|
||||
rootMenu.SelectNext();
|
||||
setDismissTimer();
|
||||
|
|
@ -167,28 +168,6 @@ namespace PowerControl
|
|||
}
|
||||
}
|
||||
|
||||
private bool isForeground()
|
||||
{
|
||||
try
|
||||
{
|
||||
var processId = Helpers.TopLevelWindow.GetTopLevelProcessId();
|
||||
if (processId is null)
|
||||
return true;
|
||||
|
||||
foreach (var app in OSD.GetAppEntries(AppFlags.MASK))
|
||||
{
|
||||
if (app.ProcessId == processId)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OsdTimer_Tick(object? sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
|
|
@ -262,7 +241,7 @@ namespace PowerControl
|
|||
return;
|
||||
}
|
||||
|
||||
if ((input.buttons5 & (byte)SDCButton5.BTN_QUICK_ACCESS) == 0 || !isForeground())
|
||||
if ((input.buttons5 & (byte)SDCButton5.BTN_QUICK_ACCESS) == 0 || !RTSS.IsOSDForeground())
|
||||
{
|
||||
// schedule next repeat far in the future
|
||||
dismissNeptuneInput();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue