This repository was archived by the owner on Aug 14, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,8 @@ export const SidePane = () => {
129
129
Actions [ action . type ] ( action . payload ) ;
130
130
} else dispatch ( action ) ;
131
131
}
132
+ // For battery saver
133
+ if ( action . payload === "system.power.saver.state" ) setBrightness ( ) ;
132
134
} ;
133
135
134
136
const vSlider = document . querySelector ( ".vSlider" ) ;
@@ -153,7 +155,21 @@ export const SidePane = () => {
153
155
}
154
156
155
157
const setBrightness = ( e ) => {
156
- var brgt = e . target . value ;
158
+ var brgt = document . getElementById ( "brightnessSlider" ) . value ;
159
+ if ( ! e ) {
160
+ // Battery saver
161
+ const state = setting . system . power . saver . state ;
162
+ const factor = state ? 0.7 : 100 / 70 ;
163
+ const newBrgt = brgt * factor ;
164
+ setBrightnessValue ( newBrgt ) ;
165
+ document . getElementById ( "brightnessSlider" ) . value = newBrgt ;
166
+ } else {
167
+ // Brightness slider
168
+ setBrightnessValue ( brgt ) ;
169
+ }
170
+ } ;
171
+
172
+ function setBrightnessValue ( brgt ) {
157
173
document . getElementById ( "brightoverlay" ) . style . opacity = ( 100 - brgt ) / 100 ;
158
174
dispatch ( {
159
175
type : "STNGSETV" ,
@@ -220,6 +236,7 @@ export const SidePane = () => {
220
236
< div className = "sliderCont" >
221
237
< Icon className = "mx-2" src = "brightness" ui width = { 20 } />
222
238
< input
239
+ id = "brightnessSlider"
223
240
className = "sliders bSlider"
224
241
onChange = { setBrightness }
225
242
type = "range"
Original file line number Diff line number Diff line change @@ -78,7 +78,6 @@ const settReducer = (state = defState, action) => {
78
78
case "TOGGAIRPLNMD" :
79
79
changed = true ;
80
80
const airPlaneModeStatus = tmpState . network . airplane ;
81
- console . log ( airPlaneModeStatus ) ;
82
81
if ( tmpState . network . wifi . state === true && ! airPlaneModeStatus ) {
83
82
tmpState = changeVal ( tmpState , "network.wifi.state" ) ;
84
83
}
You can’t perform that action at this time.
0 commit comments