brightness debian

sudo nano /etc/udev/rules.d/backlight.rules
-----------------------------------------------------------------------------------------------------------------------
ls /sys/class/backlight to fibd device_dir and set it
apt get-install bc for timer
--------------------------------------------------------------------------------------------------------------------
sudo nano ~/scripts/bright
---------------------------------------------------------------------------------------------------------------------

#!/usr/bin/env bash
set -e
backlight_dir='/sys/class/backlight'
device_dir='intel_backlight'
device_dir="${backlight_dir}/${device_dir}"
brightness_file="${device_dir}/brightness"
curr_brightness=$(cat "${brightness_file}")
max_brightness=$(cat "${device_dir}/max_brightness")

if [ "$1" == 'current' ]; then
echo $( echo "(${curr_brightness} / ${max_brightness}) * 50" | bc -l) \
| cut -d'.' -f 1
else
direction=$1

step=$(( $max_brightness /10))
if [ $direction == 'up' ]; then
new_brightness=$(( $curr_brightness + $step ))
elif [ $direction == 'down' ]; then
new_brightness=$(( $curr_brightness - $step ))
else
echo 'Argument $1 must be either "up" or "down". Quitting.'
exit 1
fi

if [ "$new_brightness" -gt "$max_brightness" ]; then
new_brightness="$max_brightness"
fi
if [ "$new_brightness" -lt 0 ]; then
new_brightness=0
fi

echo $new_brightness > "${brightness_file}"
fi
------------------------------------------------------------------------------------------------------------------
i3 keybinding
chmod +x ~/scripts/bright
---------------------------------------------------
nano ~/.config/i3/config
----------------------------------------------------------------------------------------------------------------
bindsym XF86MonBrightnessUp exec --no-startup-id  ~/scripts/bright up; exec --no-startup-id notify-send -t 400 "Brightness: $(~/scripts/bright current)%"

bindsym XF86MonBrightnessDown exec --no-startup-id  ~/scripts/bright down; exec --no-startup-id notify-send -t 400 "Brightness: $(~/scripts/bright current)%"

Comments

Popular posts from this blog

[SOLVED] IDM WAS REGISTERED WITH A FAKE SERIAL NUMBER

The Twitter Followers Playbook

Hidden Wiki