Created
July 9, 2016 21:28
-
-
Save SergKolo/a7d19377ab530d2a7a0027866d7e4488 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# We want to find the directory where all the backlight data | |
# is stored , based on the fact that there's always "actual_brightness" | |
# file in that directory | |
DIR=$(find /sys/devices/ -type f -name "actual_brightness" -printf "%h" ) | |
# Graphic cards all have different integer value for | |
# maximum level of brightness, so we need to get it | |
MAX=$(cat "$DIR"/max_brightness ) | |
# Percentage which we want to set | |
PERCENT="0.4" | |
# Calculate new value | |
NEW=$( bc <<< "$MAX*$PERCENT" ) | |
# Print out the resulting float number | |
# as int to the controlling file | |
printf "%.0f" "$NEW" > "$DIR"/brightness |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment