-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrightness.ps1
45 lines (39 loc) · 1.11 KB
/
brightness.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
param(
[ switch ] $Night ,
[ switch ] $Day ,
[ switch ] $Middle
)
function set_brightness ( [ int ] $Brightness , [ int ] $Contrast , [ int ] $Laptop , [ string ] $Color = 'Cool' ) {
ddm /readbrightnesslevel `
/readcontrastlevel `
/writebrightnesslevel $Brightness `
/writecontrastlevel $Contrast `
/writecolorpreset $Color `
/console start
$wmi = Get-WmiObject -Namespace root/WMI `
-Class WmiMonitorBrightnessMethods
$wmi.WmiSetBrightness( 1 , $Laptop )
}
if ( $Night ) {
set_brightness -Brightness 25 -Contrast 50 -Laptop 30
} elseif ($Day) {
set_brightness -Brightness 50 -Contrast 70 -Laptop 50
} elseif ($Middle) {
set_brightness -Brightness 35 -Contrast 55 -Laptop 40
} else {
$choice = Read-Host -Prompt 'Choice: '
switch ( $choice ) {
'night' {
set_brightness -Brightness 25 -Contrast 50 -Laptop 50 ; break
}
'day' {
set_brightness -Brightness 50 -Contrast 70 -Laptop 75 ; break
}
'middle' {
set_brightness -Brightness 35 -Contrast 55 -Laptop 60 ; break
}
default {
Write-Output 'Please specify an option'
}
}
}