Add backlight script

This commit is contained in:
Tobias Reisinger 2022-03-22 12:28:39 +01:00
parent 8b82ba2445
commit 77c58e5f98
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
4 changed files with 48 additions and 3 deletions

View file

@ -49,9 +49,9 @@ XF86AudioLowerVolume
# mpc toggleoutput # mpc toggleoutput
XF86MonBrightnessUp XF86MonBrightnessUp
xbacklight -inc 5 backlight -inc 5
XF86MonBrightnessDown XF86MonBrightnessDown
[ $(xbacklight -get | cut -d'.' -f 1) -ge 10 ] && xbacklight -dec 5 backlight -dec 5
super + v super + v
freetube "$(xclip -o -selection clipboard)" freetube "$(xclip -o -selection clipboard)"

View file

@ -187,3 +187,5 @@ let g:move_key_modifier = 'C'
let g:indentLine_char_list = ['|', '¦', '┆', '┊'] let g:indentLine_char_list = ['|', '¦', '┆', '┊']
let g:vim_markdown_conceal = 0 let g:vim_markdown_conceal = 0
let g:rustfmt_autosave = 1

43
.local/bin/backlight Executable file
View file

@ -0,0 +1,43 @@
#!/bin/bash
set -e
path="/sys/class/backlight/intel_backlight"
current_abs=$(cat "$path/actual_brightness")
max_abs=$(cat "$path/max_brightness")
percent=$(( max_abs / 100 ))
current=$(( current_abs / percent ))
new="$current"
change=$2
if [ "$1" = "-get" ]
then
echo "$current"
exit 0
fi
if [ "$1" = "-inc" ]
then
new=$(( current + change ))
fi
if [ "$1" = "-dec" ]
then
new=$(( current - change ))
fi
if [ "$1" = "-set" ]
then
new=$2
fi
if [ "$new" -lt 10 ]
then
new=10
fi
if [ "$new" -gt 100 ]
then
new=100
fi
echo "$(( new * percent ))" | tee "$path/brightness"

View file

@ -2,4 +2,4 @@
echo "#Server = https://archive.archlinux.org/repos/$(date +"%Y/%m/%d")/\$repo/os/\$arch" echo "#Server = https://archive.archlinux.org/repos/$(date +"%Y/%m/%d")/\$repo/os/\$arch"
curl -Ls "https://archlinux.org/mirrorlist/?country=AT&country=BE&country=CZ&country=DK&country=FI&country=FR&country=DE&country=IT&country=LU&country=NL&country=PL&protocol=https&ip_version=4" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 25 - curl -Ls "https://archlinux.org/mirrorlist/?country=AT&country=BE&country=CZ&country=DK&country=FI&country=FR&country=DE&country=IT&country=LU&country=NL&country=PL&protocol=https&ip_version=4" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors