#!/bin/bash# Name: Nvidia Brightness Script# Author: Levi Self <levi@obeyingthetruth.com># URL: http://levi.obeyingthetruth.com# Date: Mon Aug 24 09:51:21 EDT 2009## Description: Sets the screen brightness.# Information: I was tired of not being able to set# my screen brightness for awhile, so I# did some research and found out how to# assign values to the nvidia-settings exec.## Usage: nv-brightness# --bright Set back to normal brightness# --dim Set to 0.75 dimness.# --set INT Set to a custom brightnessnv="/usr/bin/nvidia-settings"if [[ $1 ]]; then if [[ $1 == "--bright" ]]; then # Set the Brightness back to normal. $nv --assign 0/RedBrightness=0.000000 &> /dev/null $nv --assign 0/GreenBrightness=0.000000 &> /dev/null $nv --assign 0/BlueBrightness=0.000000 &> /dev/null exit 0 fi if [[ $1 == "--dim" ]]; then # Set the Brightness back to a default dim. $nv --assign 0/RedBrightness=-0.756140 &> /dev/null $nv --assign 0/GreenBrightness=-0.756140 &> /dev/null $nv --assign 0/BlueBrightness=-0.756140 &> /dev/null exit 0 fi if [[ $1 == "--set" ]]; then if [[ $2 ]]; then $nv --assign 0/RedBrightness=-$2 &> /dev/null $nv --assign 0/GreenBrightness=-$2 &> /dev/null $nv --assign 0/BlueBrightness=-$2 &> /dev/null exit 0 else echo "Error: The --set option requires an interger" exit 1 fi fielse# print the usageecho "Usage $0"echo " --bright Set the brightness to normal."echo " --dim Dim the brightness"echo " --set INT Set a custom brightness"exit 1fi