@@ -2,7 +2,7 @@ use std::error::Error;
22use std:: ffi:: OsString ;
33
44use ahash:: AHashSet ;
5- use spdlog:: { Level , LevelFilter , debug, error, info, warn} ;
5+ use spdlog:: { Level , LevelFilter , debug, error, info, trace , warn} ;
66use win32_ecoqos:: process:: toggle_efficiency_mode;
77
88use rustystar:: bypass:: whitelisted;
@@ -12,6 +12,9 @@ use rustystar::logging::log_error;
1212use rustystar:: privilege:: try_enable_se_debug_privilege;
1313use rustystar:: utils:: { process_child_process, toggle_all} ;
1414use rustystar:: { PID_SENDER , WHITELIST } ;
15+ use windows:: Win32 :: UI :: Shell :: {
16+ QUNS_BUSY , QUNS_RUNNING_D3D_FULL_SCREEN , SHQueryUserNotificationState ,
17+ } ;
1518
1619#[ compio:: main]
1720async fn main ( ) -> Result < ( ) , Box < dyn Error > > {
@@ -97,19 +100,25 @@ async fn main() -> Result<(), Box<dyn Error>> {
97100 let mut last_pid = None ;
98101
99102 while let Ok ( pid) = rx. recv ( ) . await {
100- debug ! ( "received: {pid}" ) ;
103+ trace ! ( "received: {pid}" ) ;
101104
102105 match last_pid {
103106 // skip boosting
104107 Some ( last) if last == pid => {
105108 continue ;
106109 }
107- Some ( last_pid) => {
108- _ = compio:: runtime:: spawn_blocking ( move || {
109- process_child_process ( Some ( true ) , last_pid)
110- } )
111- . await ;
112- }
110+ Some ( last_pid) => match unsafe { SHQueryUserNotificationState ( ) } {
111+ Ok ( QUNS_BUSY ) | Ok ( QUNS_RUNNING_D3D_FULL_SCREEN ) => {
112+ debug ! ( "detected full screen app! skip throttling" ) ;
113+ }
114+ _ => {
115+ _ = compio:: runtime:: spawn_blocking ( move || {
116+ process_child_process ( Some ( true ) , last_pid)
117+ } )
118+ . await ;
119+ }
120+ } ,
121+
113122 None => { }
114123 }
115124
0 commit comments