-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadjustall
More file actions
41 lines (30 loc) · 1.15 KB
/
adjustall
File metadata and controls
41 lines (30 loc) · 1.15 KB
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
#!/bin/bash
# Program to adjust screen brightness
# in here I'll assume everything is in the home directory apart from absolute paths
# Brightness limit is from 0.18 to 1.1. Should you decide you do not want it. You are
# free to remove it. But careful with what you type if you do so. Your screen certainly
# can whiten or black out
# --- Limit starts here. If you decide that you don't need it feel free to remove it
brightValue=$(echo "scale=0;(${1}*1000)/1" | bc)
#echo $brightValue
if [ $brightValue -lt 180 ]; then
echo 'a screen too dim is bad for your eyes'
exit 1
fi
if [ $brightValue -gt 1100 ]; then
echo 'Excessive Brightness Detected'
exit 1
fi
# --- Limit ends here
xrandr --output eDP-1 --brightness "${1}" &> /dev/null --gamma '1.05:0.9:1' --verbose
xcalib -red 1 1.0 97.0 -green 1 1.0 94.0 -blue 1 1.0 98.0 -a &> /dev/null
#xrandr --output eDP-1 --brightness ${1} --verbose
#xrandr --output eDP-1
# if the screen was is inverted reapply the modification
read isinvert < ~/isinvert
if [ $isinvert = 'true' ]; then
xcalib -i -a &> /dev/null
else
echo $isinvert &> /dev/null
fi
#--gamma '0.9686275:0.9411765:0.9803529168'