-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadjustallv2
More file actions
77 lines (64 loc) · 2.85 KB
/
adjustallv2
File metadata and controls
77 lines (64 loc) · 2.85 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
# Program to adjust screen brightness
# adjustallv2 - adjustall ${1} ${2}
# ${1} for brightmess (0-1)
# ${2} for color temperature
#
# This program allows adjusting brightness via the
# command line by inputting a value between 0-1.
# 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
#
# Program required:
# - bc - for the floating point comparing to work
# - gammastep - works on wlroots wayland. Also works on my xfce 4.20 using X11 instead.
# It might as well also work on your X11 as well.
# - bash if you use something other than linux
#
# Additional requirements:
# - you to hardcode or change settings for your own need. But it should be easily
# readable. Search for keyword gammastep and xcalib. But if you have a well
# calibrated monitor already, you might want to change everything back to its
# original unset values, and uncomment the xcalib command
# Others:
# - xcalib if you want to adjust the colors as well. Xcalib does not work on Wayland
# ----------------------------------------------
# rgb 255, 242, 250 0.92117 0.949019 0.98039812
# --- Limit begin here. Feel free to delete the code here if you decide not to need it
brightValue=$(echo "scale=0;(${1}*1000)/1" | bc)
echo $brightValue
#brightValue=${1}
# whole script exits with error if the limits are too low or high
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
# set the default temeperature to 5400 if nothing is given for the 2nd parameter
temperature=${2}
[ -z $temperature ] && temperature=5400
# adjust brightness using gammastep suppressing errors if its x11 instead
# PS: the -O is the letter O
# -l <lattutude:longitude> -b day:night -g <red:green:blue> -O <temperature> -P (reset everything) -r (no fading animation)
gammastep -l 22:101 -b ${1}:${1} -g 0.7 -O ${2} -P -r &> /dev/null
# If you don't have any color problems with the screen uncomment this and comment out the above code
# The suggested day time color temperature is 6500, but fine color calibration is out of my expertise
#gammastep -l 22:101 -b ${1}:${1} -O 6500 -P -r &> /dev/null
#xrandr --output eDP-1 --brightness "${1}" --gamma 1 &> /dev/null
# adjust the colors using xcalib. Does not work on wayland
xcalib -red 0.85 1.0 95.0 -green 0.9 0.5 91.0 -blue 1.05 1.2 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 isninvert < ~/isinvert
if [ $isinvert = 'true' ]; then
xcalib -i -a &> /dev/null
else
echo $isinvert &> /dev/null
fi
#--gamma '0.9686275:0.9411765:0.9803529168'