Acabei fazendo alguns scripts para resolver o meu problema.
- Eu limitei os três scripts a seguir a teclas convenientes (CTRL + ALT + PGUP para brilho acima, CTRL + ALT + PGDN para brigthtness down e CTRL + ALT + HOME para restaurar o brigtness para um valor padrão).
-
Os scripts requerem setpci sudoless (provavelmente você pode jogar com alguns chmods depois de ver os erros que você recebe executando setpci para evitar a edição de sudoers) por meio de uma linha como:
androith ALL = (todos) NOPASSWD: / usr / bin / setpci
-
Finalmente, você terá que manter um "arquivo de estado" em algo parecido com /home/androith/.scripts/brightness/ state contendo apenas um estado (BF para começar é OK).
brightness-up.sh
#!/bin/bash
# Get the stored state from file
exec < /home/androith/.scripts/brightness/state # stdin replaced by this file
read state # first line of file goes to state variable
# Increase the state, up to FF
new_state=$(echo "$[0x$state+0x10]") # in decimal
if [ "$new_state" -gt 255 ] # 255 = FF in hex
then
echo "Already at maximal brightness."
else
state=$(echo "obase=16; $new_state" | bc) # put into hex
echo "Setting brightness to $state and storing state..."
sudo setpci -s 00:02.0 F4.B=$state # passwordless sudo
echo $state > /home/androith/.scripts/brightness/state
fi
brightness-down.sh
#!/bin/bash
# Get the stored state from file
exec < /home/androith/.scripts/brightness/state # stdin replaced by this file
read state # first line of file goes to state variable
# Decrease the state, down to FF
new_state=$(echo "$[0x$state-0x10]") # in decimal
if [ "$new_state" -lt 15 ] # 15 = 0F in hex
then
echo "Already at minimal brightness."
else
state=$(echo "obase=16; $new_state" | bc) # update and put into hex
echo "Setting brightness to $state and storing state..."
sudo setpci -s 00:02.0 F4.B=$state # passwordless sudo
echo $state > /home/androith/.scripts/brightness/state
fi
brightness-default.sh
#!/bin/bash
# Set brightness to default value
state=AF
sudo setpci -s 00:02.0 F4.B=$state # passwordless sudo
echo $state > /home/androith/.scripts/brightness/state