Skip to content

Instantly share code, notes, and snippets.

@rustysys-dev
Last active March 5, 2019 02:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rustysys-dev/4c692a4a838eeea244bf3a59ca0b15c4 to your computer and use it in GitHub Desktop.
Save rustysys-dev/4c692a4a838eeea244bf3a59ca0b15c4 to your computer and use it in GitHub Desktop.
Change backlight settings in Fedora 29 MATE
#!/usr/bin/env bash
CURRENT_LEVEL=$(pkexec --user root mate-power-backlight-helper --get-brightness)
if [ $1 == "get" ]; then
echo -e "\nCurrent Level: $CURRENT_LEVEL\n"
exit 0
elif [ -z $1 ] || [ -z $2 ]; then
echo -e "\nUSAGE: change-backlight <inc|dec|set|get> [<val>]\n"
exit 0
fi
if [ $1 == "inc" ]; then
if ! [ $(($CURRENT_LEVEL + $2)) -ge "1060" ]; then
NEW_LEVEL=$(($CURRENT_LEVEL + $2))
pkexec --user root mate-power-backlight-helper --set-brightness $NEW_LEVEL
else
pkexec --user root mate-power-backlight-helper --set-brightness 1060
fi
elif [ $1 == "dec" ]; then
if ! [ $(($CURRENT_LEVEL - $2)) -le "0" ]; then
NEW_LEVEL=$(($CURRENT_LEVEL - $2))
pkexec --user root mate-power-backlight-helper --set-brightness $NEW_LEVEL
else
pkexec --user root mate-power-backlight-helper --set-brightness 1
fi
elif [ $1 == "set" ]; then
if ! [ $2 -ge 1060 ] && ! [ $2 -le 0 ]; then
NEW_LEVEL=$2
pkexec --user root mate-power-backlight-helper --set-brightness $NEW_LEVEL
elif ! [ $2 -ge 1060 ]; then
pkexec --user root mate-power-backlight-helper --set-brightness 1
else
pkexec --user root mate-power-backlight-helper --set-brightness 1060
fi
else
echo -e "\nUSAGE: change-backlight <inc|dec|set|get> [<val>]\n"
fi
@rustysys-dev
Copy link
Author

rustysys-dev commented Mar 4, 2019

Inspiration:

  • Couldn't quickly get xbacklight working... lost patience decided to do it myself using the MATE tools (which i could get working).

Instructions:

  • Place file with execute permissions in /usr/local/bin/

Add HotKeys:

  • Increase Brightness:
    • name: brightness+
    • command: bklight inc 10
    • key_assign: <increase_brightness_key>
  • Decrease Brightness:
    • name: brightness-
    • command: bklight dec 10
    • key_assign: <decrease_brightness_key>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment