-
Notifications
You must be signed in to change notification settings - Fork 1
/
bright
executable file
·50 lines (42 loc) · 1.94 KB
/
bright
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
#!/bin/bash -l
for i; do case $i in --help|-help|-h|h|help) sed $0 -e /note[s]/q; exit 0 ;; esac done
_xrandr-brightness () { xrandr --output `_xrandr-primary-output` --brightness ${1:-0.7}; }
_xrandr-primary-output () { xrandr | awk '
$2 ~ /^connected/ { monitor[i++]=$1 } END { if (i==1) { print monitor[0]} }
$0 ~ /connected primary/ { print $1; exit}' | sort -u ; }
if [[ $0 =~ dim ]]; then fraction=${1:-0.7}; percent=`imath $fraction x100`
else fraction=1.0; percent=100
fi
## one should work.
sudo xbacklight -set $percent%
sudo light -A $percent
_xrandr-brightness $fraction
## notes
# (I think...)
#dev-libs/light
# Available versions: 1.2.2-r2{tbz2} {udev}
# Homepage: https://github.com/haikarainen/light
# Description: A program to control backlights (and other hardware lights)
# 2020-10
# Screen 0: minimum 8 x 8, current 2560 x 1440, maximum 32767 x 32767
# HDMI-0 disconnected (normal left inverted right x axis y axis)
# DP-0 connected (normal left inverted right x axis y axis)
# 3840x2160 60.00 + 29.98 24.00
# 1024x768 60.00
# 800x600 60.32
# 640x480 59.94
# DP-1 disconnected (normal left inverted right x axis y axis)
# DP-2 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 700mm x 390mm
# 2560x1440 59.95 + 143.91* 120.00 99.95
# 1920x1080 119.88 60.00 59.94 50.00
# 1280x1440 59.91
# 1280x1024 75.02 60.02
# 1280x720 59.94 50.00
# 1024x768 119.99 99.97 75.03 70.07 60.00
# 800x600 119.97 99.66 75.00 72.19 60.32 56.25
# 720x576 50.00
# 720x480 59.94
# 640x480 119.52 99.77 75.00 72.81 59.94 59.93
# DP-3 disconnected (normal left inverted right x axis y axis)
# HDMI-1 disconnected (normal left inverted right x axis y axis)
# USB-C-0 disconnected (normal left inverted right x axis y axis)