@@ -81,36 +81,35 @@ impl HueshiftConfig {
81
81
82
82
/// Default current temp for any screens
83
83
fn default_current_temp ( ) -> u16 {
84
- 6500 as u16
84
+ 6500
85
85
}
86
86
/// Max/Min hue temperature (min 1000K, max 10_000K)
87
87
// TODO: Try to detect if we're using redshift or not
88
88
// to set default max_temp either to 10_000K to 25_000K
89
89
fn default_min_temp ( ) -> u16 {
90
- 1000 as u16
90
+ 1000
91
91
}
92
92
fn default_max_temp ( ) -> u16 {
93
- 10_000 as u16
93
+ 10_000
94
94
}
95
95
96
96
fn default_step ( ) -> u16 {
97
- 100 as u16
97
+ 100
98
98
}
99
99
100
100
/// Prefer any installed shifter, redshift is preferred though.
101
101
fn default_hue_shifter ( ) -> Option < HueShifter > {
102
- let ( redshift, sct) = what_is_supported ( ) ;
103
- if redshift {
104
- return Some ( HueShifter :: Redshift ) ;
105
- } else if sct {
106
- return Some ( HueShifter :: Sct ) ;
102
+ if has_command ( "hueshift" , "redshift" ) . unwrap_or ( false ) {
103
+ Some ( HueShifter :: Redshift )
104
+ } else if has_command ( "hueshift" , "sct" ) . unwrap_or ( false ) {
105
+ Some ( HueShifter :: Sct )
106
+ } else {
107
+ None
107
108
}
108
-
109
- None
110
109
}
111
110
112
111
fn default_click_temp ( ) -> u16 {
113
- 6500 as u16
112
+ 6500
114
113
}
115
114
116
115
fn default_color_overrides ( ) -> Option < BTreeMap < String , String > > {
@@ -216,22 +215,6 @@ impl Block for Hueshift {
216
215
}
217
216
}
218
217
219
- /// Currently, detects whether sct and redshift are installed.
220
- #[ inline]
221
- fn what_is_supported ( ) -> ( bool , bool ) {
222
- let has_redshift = match has_command ( "hueshift" , "redshift" ) {
223
- Ok ( has_redshift) => has_redshift,
224
- Err ( _) => false ,
225
- } ;
226
-
227
- let has_sct = match has_command ( "hueshift" , "sct" ) {
228
- Ok ( has_sct) => has_sct,
229
- Err ( _) => false ,
230
- } ;
231
-
232
- ( has_redshift, has_sct)
233
- }
234
-
235
218
#[ inline]
236
219
fn update_hue ( hue_shifter : & Option < HueShifter > , new_temp : u16 ) {
237
220
match hue_shifter {
0 commit comments