File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed
Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ The config file is generated on first run with the following format
2323
2424``` json
2525{
26+ "fallback_profile_index" : null ,
2627 "loop_sleep_ms" : 250 ,
2728 "send_sleep_ms" : 250 ,
2829 "rules" : [
@@ -44,6 +45,7 @@ The config file is generated on first run with the following format
4445}
4546```
4647
48+ The ` fallback_profile_index ` variable allows you to set a fallback profile index to use when no match is found.
4749The ` sleep_ms ` variables allow you to customize the duration between checking the active process, and duration between sending Wooting USB commands.
4850The ` rules ` variable is a list of rules that supports [ Wildcard] and [ Regex] for ` app_name ` , ` process_name ` , ` process_path ` and ` title ` variables.
4951
Original file line number Diff line number Diff line change @@ -20,14 +20,16 @@ pub struct Rule {
2020
2121#[ derive( Clone , Debug , Deserialize , Serialize ) ]
2222pub struct Config {
23+ pub fallback_profile_index : Option < u8 > ,
2324 pub loop_sleep_ms : u64 ,
24- pub send_sleep_ms : u64 ,
2525 pub rules : Vec < Rule > ,
26+ pub send_sleep_ms : u64 ,
2627}
2728
2829impl Default for Config {
2930 fn default ( ) -> Self {
3031 Self {
32+ fallback_profile_index : None ,
3133 loop_sleep_ms : 250 ,
3234 send_sleep_ms : 250 ,
3335 rules : vec ! [
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ fn main() -> anyhow::Result<()> {
3939 exit ( 1 )
4040 }
4141
42+ wooting_rgb_reset ( ) ;
4243 * wooting_rgb_device_info ( )
4344 } ;
4445
@@ -75,8 +76,15 @@ fn main() -> anyhow::Result<()> {
7576 } ;
7677 println ! ( "Active Process State: {active_process_state:#?}" ) ;
7778
78- let Some ( profile_index) = find_match ( active_process_state, & config. rules ) else {
79- continue ;
79+ let profile_index = match find_match ( active_process_state, & config. rules ) {
80+ Some ( profile_index) => profile_index,
81+ None => {
82+ if let Some ( fallback_profile_index) = config. fallback_profile_index {
83+ fallback_profile_index
84+ } else {
85+ continue ;
86+ }
87+ }
8088 } ;
8189
8290 if profile_index == last_profile_index {
You can’t perform that action at this time.
0 commit comments