Brightness not working after installing NVIDIA driver
I recently installed Ubuntu 11.10 on my Mac Book Pro 7,1. I installed the NVIDIA driver (285). The brightness keys are working (F1 and F2) and I get the box showing the brightness but it does nothing. I can change the brightness in the NVIDIA X Server Settings application. How can I get the brightness working without uninstalling the driver? Thanks in advance.
nvidia screen brightness
add a comment |
I recently installed Ubuntu 11.10 on my Mac Book Pro 7,1. I installed the NVIDIA driver (285). The brightness keys are working (F1 and F2) and I get the box showing the brightness but it does nothing. I can change the brightness in the NVIDIA X Server Settings application. How can I get the brightness working without uninstalling the driver? Thanks in advance.
nvidia screen brightness
Same thing happened to me on a MacBook Pro 5,5.
– Cerin
Mar 11 '12 at 18:20
Just a followup, I tried all the documented solutions, and nothing ever worked, including using the most recent Nvida driver. However, when I purged the Nvidia driver and used the open source Nouveau driver, screen dimming immediately started working.
– Cerin
Apr 15 '15 at 13:21
@Cerin why not write that up as an answer including all the steps so that a novice user could follow it? Drop me a comment when you've done so and if it's a good answer, I'll upvote it, and it will likely help others as well.
– Elder Geek
May 1 '15 at 1:23
1
@ElderGeek, Unfortunately, Nouveau doesn't support suspend/resume, making it useless for a laptop, which is a shame because it was otherwise better than the Nvidia driver. I upgraded to 14.04 and the Nvidia 340 driver, and now screen dimming works.
– Cerin
May 1 '15 at 13:02
add a comment |
I recently installed Ubuntu 11.10 on my Mac Book Pro 7,1. I installed the NVIDIA driver (285). The brightness keys are working (F1 and F2) and I get the box showing the brightness but it does nothing. I can change the brightness in the NVIDIA X Server Settings application. How can I get the brightness working without uninstalling the driver? Thanks in advance.
nvidia screen brightness
I recently installed Ubuntu 11.10 on my Mac Book Pro 7,1. I installed the NVIDIA driver (285). The brightness keys are working (F1 and F2) and I get the box showing the brightness but it does nothing. I can change the brightness in the NVIDIA X Server Settings application. How can I get the brightness working without uninstalling the driver? Thanks in advance.
nvidia screen brightness
nvidia screen brightness
edited Sep 25 '13 at 19:32
Thomas Ward♦
43.4k23120172
43.4k23120172
asked Nov 6 '11 at 16:20
YFGD
136135
136135
Same thing happened to me on a MacBook Pro 5,5.
– Cerin
Mar 11 '12 at 18:20
Just a followup, I tried all the documented solutions, and nothing ever worked, including using the most recent Nvida driver. However, when I purged the Nvidia driver and used the open source Nouveau driver, screen dimming immediately started working.
– Cerin
Apr 15 '15 at 13:21
@Cerin why not write that up as an answer including all the steps so that a novice user could follow it? Drop me a comment when you've done so and if it's a good answer, I'll upvote it, and it will likely help others as well.
– Elder Geek
May 1 '15 at 1:23
1
@ElderGeek, Unfortunately, Nouveau doesn't support suspend/resume, making it useless for a laptop, which is a shame because it was otherwise better than the Nvidia driver. I upgraded to 14.04 and the Nvidia 340 driver, and now screen dimming works.
– Cerin
May 1 '15 at 13:02
add a comment |
Same thing happened to me on a MacBook Pro 5,5.
– Cerin
Mar 11 '12 at 18:20
Just a followup, I tried all the documented solutions, and nothing ever worked, including using the most recent Nvida driver. However, when I purged the Nvidia driver and used the open source Nouveau driver, screen dimming immediately started working.
– Cerin
Apr 15 '15 at 13:21
@Cerin why not write that up as an answer including all the steps so that a novice user could follow it? Drop me a comment when you've done so and if it's a good answer, I'll upvote it, and it will likely help others as well.
– Elder Geek
May 1 '15 at 1:23
1
@ElderGeek, Unfortunately, Nouveau doesn't support suspend/resume, making it useless for a laptop, which is a shame because it was otherwise better than the Nvidia driver. I upgraded to 14.04 and the Nvidia 340 driver, and now screen dimming works.
– Cerin
May 1 '15 at 13:02
Same thing happened to me on a MacBook Pro 5,5.
– Cerin
Mar 11 '12 at 18:20
Same thing happened to me on a MacBook Pro 5,5.
– Cerin
Mar 11 '12 at 18:20
Just a followup, I tried all the documented solutions, and nothing ever worked, including using the most recent Nvida driver. However, when I purged the Nvidia driver and used the open source Nouveau driver, screen dimming immediately started working.
– Cerin
Apr 15 '15 at 13:21
Just a followup, I tried all the documented solutions, and nothing ever worked, including using the most recent Nvida driver. However, when I purged the Nvidia driver and used the open source Nouveau driver, screen dimming immediately started working.
– Cerin
Apr 15 '15 at 13:21
@Cerin why not write that up as an answer including all the steps so that a novice user could follow it? Drop me a comment when you've done so and if it's a good answer, I'll upvote it, and it will likely help others as well.
– Elder Geek
May 1 '15 at 1:23
@Cerin why not write that up as an answer including all the steps so that a novice user could follow it? Drop me a comment when you've done so and if it's a good answer, I'll upvote it, and it will likely help others as well.
– Elder Geek
May 1 '15 at 1:23
1
1
@ElderGeek, Unfortunately, Nouveau doesn't support suspend/resume, making it useless for a laptop, which is a shame because it was otherwise better than the Nvidia driver. I upgraded to 14.04 and the Nvidia 340 driver, and now screen dimming works.
– Cerin
May 1 '15 at 13:02
@ElderGeek, Unfortunately, Nouveau doesn't support suspend/resume, making it useless for a laptop, which is a shame because it was otherwise better than the Nvidia driver. I upgraded to 14.04 and the Nvidia 340 driver, and now screen dimming works.
– Cerin
May 1 '15 at 13:02
add a comment |
11 Answers
11
active
oldest
votes
I was able to get my brightness keys working on my Lenovo W530 on Ubuntu 12.04.
These days X automatically configures itself, so creating an xorg.conf file might make your system inflexible. Instead you can add a section to a file in /usr/share/X11/xorg.conf.d/ and X will include that section in the configuration that it automatically generates.
So to get the screen brightness keys working with your Nvidia graphics card, create a file in the xorg.conf.d directory, e.g:
sudo gedit /usr/share/X11/xorg.conf.d/10-nvidia-brightness.conf
Paste the following into the file:
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro K1000M"
Option "RegistryDwords" "EnableBrightnessControl=1"
EndSection
Log out and log back in, or reboot, and your brightness keys should now work!
(I blogged this here)
Thank you, it works for me on Ubuntu 14.04 on Lenovo W530 with official nvidia driver (downloaded from nvidia site).
– Saeed Zarinfam
May 9 '15 at 7:10
I have a W530 machine with linux mint 17.3, this solution applies directly (for me just logging out and logging in works, no reboot needed).
– user22363
Dec 19 '16 at 22:01
Worked perfectly, this should be marked as the correct answer
– OKAN
Mar 9 '17 at 7:57
Worked for me on Lubuntu 16.04 after rebooting the system.
– Andritchi Alexei
Mar 13 '17 at 13:00
1
How to find out BoardName? Might sound stupid, but this might be the reason I don't get it to work.
– davidbaumann
Sep 23 '17 at 14:12
|
show 3 more comments
I had a similar issue with my laptop, there is an option you need to add to your /etc/X11/xorg.conf
Run command:
sudo nano /etc/X11/xorg.conf
Find the line Section "Device" and add the following
Option "RegistryDwords" "EnableBrightnessControl=1"
This fixed it for me. Thanks.
– Cerin
Mar 11 '12 at 19:44
This also works with Ubuntu 12.04
– shaneonabike
Sep 25 '13 at 19:21
Xubuntu 12.04 works as well
– Stasik
Aug 17 '14 at 15:01
This doesn't work for me in 12.04.
– Cerin
Apr 6 '15 at 12:57
This doesn't work for me in 18.04
– Hany Alsamman
Aug 28 '18 at 16:06
add a comment |
You need to enable Brightness Control.
Open terminal and type sudo gedit /etc/x11/xorg.conf
And then add Option "RegistryDwords" "EnableBrightnessControl=1" inside the device section, paste it in a new line.
Then restart your computer and everything should be fine.
add a comment |
Thank you for providing the great script qgj. It's sad that this bug still persists and the work-around is needed. I had the same issue as James getting an error due to the options no longer being valid with nvidia-settings for my specific display type. As luck would have it, there is a better setting available for backlight brightness. I have modified the bash script to use this setting instead.
#!/bin/bash
# This script was originally created by 'qgj' from askubuntu. It has been modified
# to work using the BacklightBrighness setting available for some displays on the currrent nvidia driver
# It has also been modified to remove display specific configuration, instead applying the setting to all
# active displays which support the BacklightBrightness setting.
# Tested only with nvidia-settings-319.12 and nvidia-drivers-331.20 on Linux Mint 17 Mate
#
# Requirements:
# - NVIDIA Drivers (e.g. nvidia-current in Ubuntu)
# - NVIDIA Settings (nvidia-settings in Ubuntu)
#
# This script can be used to change the brightness on systems with an NVIDIA graphics card
# that lack the support for changing the brightness (probably needing acpi backlight).
# It uses "nvidia-settings -a" to assign new gamma or brightness values to the display.
#
# If this script fails, your display likely does not support the 'BacklightBrightness' option.
# In that event, execute 'nvidia-settings -n -q all' to see which options are available for the displays
#
# "nvidia-brightness.sh" may be run from the command line or can be assigned to the brightness keys on your Keyboard
# Type "nvidia-brightness.sh --help" for valid options.
if [ -z "${BASH}" ] ; then
echo "please run this script with the BASH shell"
exit 1
fi
usage ()
{
cat << ENDMSG
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -bu ] or [ --brightness-up ] increase brightness by 10
[ -bu <no> ] or
[ --brightness-up <no> ] increase brightness by specified <no>
[ -bd ] or [ --brightness-down ] decrease brightness by 10
[ -bd <no> ] or
[ --brightness-down <no> ] decrease brightness by specified <no>
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
brightness will be set to 100.
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -bd this will decrease gamma by 10
nvidia-brightness -bu 15 this will increase brightness by 15
ENDMSG
}
case $1 in
-h|--help)
usage
exit 0
esac
if [ "$1" != "-i" -a "$1" != "--initialize" ] ; then
if [[ ! -f ~/.nvidia-brightness.cfg ]]; then
echo 'You must run this script with the --initialize option once to create the settings file.'
echo 'Type "nvidia-brightness.sh --help" for more information.';
exit 1
fi
fi
#### INITIALIZE ####
initialize_cfg ()
{
BRIGHTNESS_TEMP=100
echo "BRIGHTNESS=$BRIGHTNESS_TEMP" > ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
# Valid BacklightBrightness values are between 0 and 100
# Example: nvidia-settings -n -a BacklightBrightness=80
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
exit $?
}
#### LOAD CONFIGURATION ####
load_cfg ()
{
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
#### BRIGHTNESS CHANGE ####
brightness_up ()
{
source ~/.nvidia-brightness.cfg
[[ -z $1 ]] && BRIGHTNESS_INC=10 || BRIGHTNESS_INC=$1
BRIGHTNESSNEW=$(( $BRIGHTNESS + $BRIGHTNESS_INC ))
[[ $BRIGHTNESSNEW -gt 100 ]] && BRIGHTNESSNEW=100
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
brightness_down ()
{
source ~/.nvidia-brightness.cfg
[[ -z $1 ]] && BRIGHTNESS_INC=10 || BRIGHTNESS_INC=$1
BRIGHTNESSNEW=$(( $BRIGHTNESS - $BRIGHTNESS_INC ))
[[ $BRIGHTNESSNEW -lt 0 ]] && BRIGHTNESSNEW=0
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
if [[ "$3" != "" ]]; then
usage
exit 1
fi
error_mixed_brightness ()
{
echo "Error: [ --brightness-up ] and [ --brightness-down ] can't be used together."
}
if [[ "$2" != "" ]]; then
[[ ! "$2" == ?(-)+([0-9]) ]] && usage && exit 1
fi
case $1 in
-bu|--brightness-up)
[ "$2" == "-bd" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-down" ] && error_mixed_brightness && exit 1
brightness_up $2
;;
-bd|--brightness-down)
[ "$2" == "-bu" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-up" ] && error_mixed_brightness && exit 1
brightness_down $2
;;
-h|--help)
usage
exit 0
;;
-i|--initialize)
if [ "$2" != "" ]; then usage; exit 1; fi
initialize_cfg
exit $?
;;
-l|--load-config)
if [ "$2" != "" ]; then usage; exit 1; fi
load_cfg
exit 0
;;
*)
usage
exit 1
esac
Your mileage may vary with this script as some displays/adapters support different options. If you encounter issues with it please read the help and comments in the script.
Hope it helps someone!
add a comment |
There are some computers, such as my Lenovo W520, that don't with the Option "RegistryDwords" "EnableBrightnessControl=1" line. If you are one of those unlucky ones, you can try the nvidiabl driver (link here).
The nvidiabl driver provides a proper way to change the screen brightness. On some laptops the Option "RegistryDwords" "EnableBrightnessControl=1" hack will cause the backlight controller or your GPU to emit a high pitched noise.
Just download and install the latest Deb file from here: https://github.com/downloads/guillaumezin/nvidiabl/nvidiabl-dkms_0.72_all.deb
and run:
echo "nvidiabl" | sudo tee -a /etc/modules
to ensure that the module will be loaded when the computer boots.
add a comment |
Im personally using Vaio VPCCW21FX (Nvidia Graphic) and Ubuntu Studio 11.10 ..
I tried many solutions and nothing could resolve my problem with LCD brightness!
Finally wrote these two perl files to manually set brightness/Contrast and Gamma functions inside Nvidia driver config file.
This will be helpfull only if you are able to change brightness within Nvidia X Server Settings
Step 1: create this file and name it "Brightness-Up.pl"
(you can use any text editing tool like : gedit,nano,vi,etc.. copy & paste)
### Code by forgottenrip@yahoo.com ###
my $find1 = "0/RedBrightness=";my $find2 = "0/RedGamma=";
open FILE, "<Nvidia-Settings.cfg";
my @lines = <FILE>;
for (@lines) {
if ($_ =~ /$find1/) { chomp $_;$value= substr($_,16,5); }
if ($_ =~ /$find2/) { chomp $_;$value2= substr($_,11,5);}
}
my @Lines;
if ( $value > 0.0) { $value = $value - 0.30 };
if ( $value2 > 1.1) { $value2 = $value2 - 0.08 };
$last_value = $value + 0.30;
$Lines[0] ="0/RedBrightness=".$last_value;
$Lines[1] ="0/GreenBrightness=".$last_value;;
$Lines[2] ="0/BlueBrightness=".$last_value;;
$last_value = $value + 0.30;
$Lines[3] ="0/RedContrast=".$last_value;;
$Lines[4] ="0/GreenContrast=".$last_value;;
$Lines[5] ="0/BlueContrast=".$last_value;;
$last_value = $value2 + 0.08;
$Lines[6] ="0/RedGamma=".$last_value;;
$Lines[7] ="0/GreenGamma=".$last_value;;
$Lines[8] ="0/BlueGamma=".$last_value;;
$filename = "Nvidia-Settings.cfg";
open fh2,'>',$filename or die ("can't open '$filename': $! n");
foreach ( @Lines )
{ chomp;print "$_n";print fh2 "$_n"; };
close fh2;
`nvidia-settings -l --config=Nvidia-Settings.cfg`;
Step 2: then make another file, name it "Brightness-Down.pl" and fill with this code:
### Code by forgottenrip@yahoo.com ###
my $find1 = "0/RedBrightness=";my $find2 = "0/RedGamma=";
open FILE, "<Nvidia-Settings.cfg";
my @lines = <FILE>;
for (@lines) {
if ($_ =~ /$find1/) {chomp $_;$value= substr($_,16,5);}
if ($_ =~ /$find2/) {chomp $_;$value2= substr($_,11,5);}
}
my @Lines;
if ( $value < -0.80) { $value = $value + 0.30 };
if ( $value2 < 0.8) { $value2 = $value2 + 0.08 };
$last_value = $value - 0.30;
$Lines[0] ="0/RedBrightness=".$last_value;
$Lines[1] ="0/GreenBrightness=".$last_value;;
$Lines[2] ="0/BlueBrightness=".$last_value;;
$last_value = $value - 0.30;
$Lines[3] ="0/RedContrast=".$last_value;;
$Lines[4] ="0/GreenContrast=".$last_value;;
$Lines[5] ="0/BlueContrast=".$last_value;;
$last_value = $value2 - 0.08;
$Lines[6] ="0/RedGamma=".$last_value;;
$Lines[7] ="0/GreenGamma=".$last_value;;
$Lines[8] ="0/BlueGamma=".$last_value;;
$filename = "Nvidia-Settings.cfg";
open fh2,'>',$filename or die ("can't open '$filename': $! n");
foreach ( @Lines )
{ chomp;print "$_n";print fh2 "$_n"; };
close fh2;
`nvidia-settings -l --config=Nvidia-Settings.cfg`;
Step 3: You need to create another file which contains Nvidia Settings..
name it "Nvidia-Settings.cfg" its important that you write name exactly same.
fill with:
0/RedBrightness=0.1
0/GreenBrightness=0.1
0/BlueBrightness=0.1
0/RedContrast=0.1
0/GreenContrast=0.1
0/BlueContrast=0.1
0/RedGamma=1.14
0/GreenGamma=1.14
0/BlueGamma=1.14
Thats it! now place these files in unique folder.. you have to bind your Function Keys to these two perl file.you can use Compiz>commands to do that.
Run below command to install the compizconfig-settings-manager
sudo apt-get install compizconfig-settings-manager
or even you can run seperately with these two commands in shell (terminal):
user$ perl Brightness/Brightness-Up.pl
user$ perl Brightness/Brightness-Down.pl
where Brightness is folder I put those files in it.
add a comment |
The other answers are good steps to try, but note that some combinations of Ubuntu/Linux Kernel and the Nvidia driver just won't work. I used 12.04 for years, and even though I tried all the above answers, I couldn't get any of the Nvidia drivers to support screen dimming on my Macbook Pro 5,5.
When I finally upgraded to 14.04, I tried the Nouveau driver, which did support screen dimming, and was generally faster and more reliable and Nvidia. Unfortunately, it doesn't support suspend/resume, making it useless on a laptop. I switched back to Nvidia, but several drivers caused X/lightdm to crash, preventing me from even logging in. I finally found that the Nvidia 340 driver was stable with my Macbook Pro 5,5 and Ubuntu 14.04 and also supported dimming.
add a comment |
FYI, just worked through this on a Lenovo W520, and the addition of the simple line
Option "RegistryDwords" "EnableBrightnessControl=1"
to xorg.conf was enough - no need for any of the other bogosity, and all works fine with a current NVidia release (specifically, running 346.35)
add a comment |
NVIDIA brightness bash script
The above perl script didnt work for me so I wrote my own script as a bash script (since I don't know perl). It got a bit long but it creates the settings file by itself and can be used with command line options to adjust brightness or gamma or both at the same time.
I use it with the --brightness-up and --brightness-down switches for the brightness keys on my Keyboard. Easy to assign in XFCE4 and surely also in KDE / GNOME.
nvidia-brightness.sh:
#!/bin/sh
# Tested only with nvidia-settings-319.12 and nvidia-drivers-319.17 on Funtoo Linux running XFCE 4.10
#
# Requirements:
# - NVIDIA Drivers (e.g. nvidia-current in Ubuntu)
# - NVIDIA Settings (nvidia-settings in Ubuntu)
# - xrandr (used by default to determine the correct display name)
#
# This script can be used to change the brightness on systems with an NVIDIA graphics card
# that lack the support for changing the brightness (probably needing acpi backlight).
# It uses "nvidia-settings -a" to assign new gamma or brightness values to the display.
#
# "nvidia-brightness.sh" may be run from the command line or can be assigned to the brightness keys on your Keyboard
# e.g. in XFCE4.
#
# Type "nvidia-brightness.sh --help" for valid options.
usage ()
{
cat << ENDMSG
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -gu ] or [ --gamma-up ] increase gamma by 0.1
[ -gd ] or [ --gamma-down ] decrease gamma by 0.1
[ -bu ] or [ --brightness-up ] increase brightness by 0.1
[ -bd ] or [ --brightness-down ] decrease brightness by 0.1
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
gamma will be set to 1.0 and brightness to 0.0
(NVIDIA Standard).
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -gd this will decrease gamma by 0.1
nvidia-brightness -bu -gd this will increase brightness by 0.1 and decrease gamma by 0.1
ENDMSG
}
case $1 in
-h|--help)
usage
exit 0
esac
if [ "$1" != "-i" -a "$1" != "--initialize" ]; then
if [ ! -f ~/.nvidia-brightness.cfg ]; then
echo 'You must run this script with the --initialize option once to create the settings file.'
echo 'Type "nvidia-brightness.sh --help" for more information.';
exit 1
fi
fi
#### INITIALIZE ####
initialize_cfg ()
{
CONNECTED="[`xrandr | grep " connected" | awk '{ print $1 }'`]"
#CONNECTED="`cat ~/.nvidia-settings-rc | grep RedBrightness | grep -o "[.*]"`"
#CONNECTED="[DVI-I-1]"
#CONNECTED="[dpy:2]"
#CONNECTED="0"
if [ -f ~/.nvidia-settings-rc ]; then
if [ "`grep RedGamma ~/.nvidia-settings-rc`" != "" ]; then
if [ "`grep RedBrightness ~/.nvidia-settings-rc`" != "" ]; then
GAMMA_TEMP=`grep RedGamma= ~/.nvidia-settings-rc | sed s/^.*=//`
BRIGHTNESS_TEMP=`grep RedBrightness= ~/.nvidia-settings-rc | sed s/^.*=//`
NVIDIA_SETTINGS_OK=1
fi
fi
fi
[ "$NVIDIA_SETTINGS_OK" != "1" ] &&
GAMMA_TEMP=1.000000
BRIGHTNESS_TEMP=0.000000
echo "
CONNECTED_DISPLAY=$CONNECTED
GAMMA=$GAMMA_TEMP
BRIGHTNESS=$BRIGHTNESS_TEMP" > ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
GAMMACOMMA=`echo $GAMMA | sed s/"."/","/`
BRIGHTNESSCOMMA=`echo $BRIGHTNESS | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
}
#### LOAD CONFIGURATION ####
load_cfg ()
{
source ~/.nvidia-brightness.cfg
GAMMACOMMA=`echo $GAMMA | sed s/"."/","/`
BRIGHTNESSCOMMA=`echo $BRIGHTNESS | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
}
#### GAMMA CHANGE ####
gamma_up ()
{
source ~/.nvidia-brightness.cfg
GAMMANEW=`echo $GAMMA | awk '{printf "%f", $GAMMA + 0.100000}'`
GAMMACOMMA=`echo $GAMMANEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA 1>/dev/null
sed -i s/.*GAMMA=.*/GAMMA=$GAMMANEW/g ~/.nvidia-brightness.cfg
}
gamma_down ()
{
source ~/.nvidia-brightness.cfg
GAMMANEW=`echo $GAMMA | awk '{printf "%f", $GAMMA - 0.100000}'`
GAMMACOMMA=`echo $GAMMANEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA 1>/dev/null
sed -i s/.*GAMMA=.*/GAMMA=$GAMMANEW/g ~/.nvidia-brightness.cfg
}
#### BRIGHTNESS CHANGE ####
brightness_up ()
{
source ~/.nvidia-brightness.cfg
BRIGHTNESSNEW=`echo $BRIGHTNESS | awk '{printf "%f", $BRIGHTNESS + 0.100000}'`
BRIGHTNESSCOMMA=`echo $BRIGHTNESSNEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
}
brightness_down ()
{
source ~/.nvidia-brightness.cfg
BRIGHTNESSNEW=`echo $BRIGHTNESS | awk '{printf "%f", $BRIGHTNESS - 0.100000}'`
BRIGHTNESSCOMMA=`echo $BRIGHTNESSNEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
}
if [ "$3" != "" ]; then
usage
exit 1
fi
error_mixed_gamma ()
{
echo "Error: [ --gamma-up ] and [ --gamma-down ] can't be used together."
}
error_mixed_brightness ()
{
echo "Error: [ --brightness-up ] and [ --brightness-down ] can't be used together."
}
if [ "$2" != "" ]; then
[ "$2" != "-bu" -a "$2" != "--brightness-up" -a "$2" != "-bd" -a "$2" != "--brightness-down"
-a "$2" != "-gu" -a "$2" != "--gamma-up" -a "$2" != "-gd" -a "$2" != "--gamma-down" ] && usage && exit 1
fi
case $1 in
-gu|--gamma-up)
[ "$2" == "-gd" ] && error_mixed_gamma && exit 1
[ "$2" == "--gamma-down" ] && error_mixed_gamma && exit 1
gamma_up
;;
-gd|--gamma-down)
[ "$2" == "-gu" ] && error_mixed_gamma && exit 1
[ "$2" == "--gamma-up" ] && error_mixed_gamma && exit 1
gamma_down
;;
-bu|--brightness-up)
[ "$2" == "-bd" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-down" ] && error_mixed_brightness && exit 1
brightness_up
;;
-bd|--brightness-down)
[ "$2" == "-bu" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-up" ] && error_mixed_brightness && exit 1
brightness_down
;;
-h|--help)
usage
exit 0
;;
-i|--initialize)
if [ "$2" != "" ]; then usage; exit 1; fi
initialize_cfg
exit 0
;;
-l|--load-config)
if [ "$2" != "" ]; then usage; exit 1; fi
load_cfg
exit 0
;;
*)
usage
exit 1
esac
case $2 in
-gu|--gamma-up)
gamma_up
;;
-gd|--gamma-down)
gamma_down
;;
-bu|--brightness-up)
brightness_up
;;
-bd|--brightness-down)
brightness_down
;;
-h|--help)
usage
exit 0
;;
"")
;;
*)
usage
exit 1
esac
Usage:
Save the file somewhere in your PATH e.g.
/usr/local/bin/nvidia-brightness.sh
Don't forget to
chmod +x /usr/local/bin/nvidia-brightness.sh
Before you can use it you have to type
nvidia-brightness.sh -i
This will create the settings file and can also be used to reset the brightness at any time.
Type
nvidia-settings.sh --help
for more options:
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -gu ] or [ --gamma-up ] increase gamma by 0.1
[ -gd ] or [ --gamma-down ] decrease gamma by 0.1
[ -bu ] or [ --brightness-up ] increase brightness by 0.1
[ -bd ] or [ --brightness-down ] decrease brightness by 0.1
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
gamma will be set to 1.0 and brightness to 0.0
(NVIDIA Standard).
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -gd this will decrease gamma by 0.1
nvidia-brightness -bu -gd this will increase brightness by 0.1 and decrease gamma by 0.1
This looks exactly what I'm looking for but I get an error: ERROR: Error parsing assignment '/Gamma=' (No attribute value specified).
– James
Oct 9 '13 at 20:25
add a comment |
Im using NVIDIA Graphic Card and having problem like you.
But i tried this thing and it's work :
1. Install NVIDIA Driver with command :
sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current
2. Then, reboot
3. Done.
Source : http://noob-tech.blogspot.co.id/2015/04/Install-VGA-Driver-On-Ubuntu.html
add a comment |
I had the same problem in Ubuntu 16.10, after upgrading from 16.04. In the xorg.conf file (/usr/share/doc/xserver-xorg-video-intel/), I changed the driver from "intel" to "nvidia".
1
Thanks for trying to help! Would you mind describing the process a bit?
– earthmeLon
Jan 31 '17 at 20:33
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f76081%2fbrightness-not-working-after-installing-nvidia-driver%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
11 Answers
11
active
oldest
votes
11 Answers
11
active
oldest
votes
active
oldest
votes
active
oldest
votes
I was able to get my brightness keys working on my Lenovo W530 on Ubuntu 12.04.
These days X automatically configures itself, so creating an xorg.conf file might make your system inflexible. Instead you can add a section to a file in /usr/share/X11/xorg.conf.d/ and X will include that section in the configuration that it automatically generates.
So to get the screen brightness keys working with your Nvidia graphics card, create a file in the xorg.conf.d directory, e.g:
sudo gedit /usr/share/X11/xorg.conf.d/10-nvidia-brightness.conf
Paste the following into the file:
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro K1000M"
Option "RegistryDwords" "EnableBrightnessControl=1"
EndSection
Log out and log back in, or reboot, and your brightness keys should now work!
(I blogged this here)
Thank you, it works for me on Ubuntu 14.04 on Lenovo W530 with official nvidia driver (downloaded from nvidia site).
– Saeed Zarinfam
May 9 '15 at 7:10
I have a W530 machine with linux mint 17.3, this solution applies directly (for me just logging out and logging in works, no reboot needed).
– user22363
Dec 19 '16 at 22:01
Worked perfectly, this should be marked as the correct answer
– OKAN
Mar 9 '17 at 7:57
Worked for me on Lubuntu 16.04 after rebooting the system.
– Andritchi Alexei
Mar 13 '17 at 13:00
1
How to find out BoardName? Might sound stupid, but this might be the reason I don't get it to work.
– davidbaumann
Sep 23 '17 at 14:12
|
show 3 more comments
I was able to get my brightness keys working on my Lenovo W530 on Ubuntu 12.04.
These days X automatically configures itself, so creating an xorg.conf file might make your system inflexible. Instead you can add a section to a file in /usr/share/X11/xorg.conf.d/ and X will include that section in the configuration that it automatically generates.
So to get the screen brightness keys working with your Nvidia graphics card, create a file in the xorg.conf.d directory, e.g:
sudo gedit /usr/share/X11/xorg.conf.d/10-nvidia-brightness.conf
Paste the following into the file:
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro K1000M"
Option "RegistryDwords" "EnableBrightnessControl=1"
EndSection
Log out and log back in, or reboot, and your brightness keys should now work!
(I blogged this here)
Thank you, it works for me on Ubuntu 14.04 on Lenovo W530 with official nvidia driver (downloaded from nvidia site).
– Saeed Zarinfam
May 9 '15 at 7:10
I have a W530 machine with linux mint 17.3, this solution applies directly (for me just logging out and logging in works, no reboot needed).
– user22363
Dec 19 '16 at 22:01
Worked perfectly, this should be marked as the correct answer
– OKAN
Mar 9 '17 at 7:57
Worked for me on Lubuntu 16.04 after rebooting the system.
– Andritchi Alexei
Mar 13 '17 at 13:00
1
How to find out BoardName? Might sound stupid, but this might be the reason I don't get it to work.
– davidbaumann
Sep 23 '17 at 14:12
|
show 3 more comments
I was able to get my brightness keys working on my Lenovo W530 on Ubuntu 12.04.
These days X automatically configures itself, so creating an xorg.conf file might make your system inflexible. Instead you can add a section to a file in /usr/share/X11/xorg.conf.d/ and X will include that section in the configuration that it automatically generates.
So to get the screen brightness keys working with your Nvidia graphics card, create a file in the xorg.conf.d directory, e.g:
sudo gedit /usr/share/X11/xorg.conf.d/10-nvidia-brightness.conf
Paste the following into the file:
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro K1000M"
Option "RegistryDwords" "EnableBrightnessControl=1"
EndSection
Log out and log back in, or reboot, and your brightness keys should now work!
(I blogged this here)
I was able to get my brightness keys working on my Lenovo W530 on Ubuntu 12.04.
These days X automatically configures itself, so creating an xorg.conf file might make your system inflexible. Instead you can add a section to a file in /usr/share/X11/xorg.conf.d/ and X will include that section in the configuration that it automatically generates.
So to get the screen brightness keys working with your Nvidia graphics card, create a file in the xorg.conf.d directory, e.g:
sudo gedit /usr/share/X11/xorg.conf.d/10-nvidia-brightness.conf
Paste the following into the file:
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro K1000M"
Option "RegistryDwords" "EnableBrightnessControl=1"
EndSection
Log out and log back in, or reboot, and your brightness keys should now work!
(I blogged this here)
edited Oct 13 '12 at 11:34
user61928
answered Oct 13 '12 at 11:23
Chris Pearce
44152
44152
Thank you, it works for me on Ubuntu 14.04 on Lenovo W530 with official nvidia driver (downloaded from nvidia site).
– Saeed Zarinfam
May 9 '15 at 7:10
I have a W530 machine with linux mint 17.3, this solution applies directly (for me just logging out and logging in works, no reboot needed).
– user22363
Dec 19 '16 at 22:01
Worked perfectly, this should be marked as the correct answer
– OKAN
Mar 9 '17 at 7:57
Worked for me on Lubuntu 16.04 after rebooting the system.
– Andritchi Alexei
Mar 13 '17 at 13:00
1
How to find out BoardName? Might sound stupid, but this might be the reason I don't get it to work.
– davidbaumann
Sep 23 '17 at 14:12
|
show 3 more comments
Thank you, it works for me on Ubuntu 14.04 on Lenovo W530 with official nvidia driver (downloaded from nvidia site).
– Saeed Zarinfam
May 9 '15 at 7:10
I have a W530 machine with linux mint 17.3, this solution applies directly (for me just logging out and logging in works, no reboot needed).
– user22363
Dec 19 '16 at 22:01
Worked perfectly, this should be marked as the correct answer
– OKAN
Mar 9 '17 at 7:57
Worked for me on Lubuntu 16.04 after rebooting the system.
– Andritchi Alexei
Mar 13 '17 at 13:00
1
How to find out BoardName? Might sound stupid, but this might be the reason I don't get it to work.
– davidbaumann
Sep 23 '17 at 14:12
Thank you, it works for me on Ubuntu 14.04 on Lenovo W530 with official nvidia driver (downloaded from nvidia site).
– Saeed Zarinfam
May 9 '15 at 7:10
Thank you, it works for me on Ubuntu 14.04 on Lenovo W530 with official nvidia driver (downloaded from nvidia site).
– Saeed Zarinfam
May 9 '15 at 7:10
I have a W530 machine with linux mint 17.3, this solution applies directly (for me just logging out and logging in works, no reboot needed).
– user22363
Dec 19 '16 at 22:01
I have a W530 machine with linux mint 17.3, this solution applies directly (for me just logging out and logging in works, no reboot needed).
– user22363
Dec 19 '16 at 22:01
Worked perfectly, this should be marked as the correct answer
– OKAN
Mar 9 '17 at 7:57
Worked perfectly, this should be marked as the correct answer
– OKAN
Mar 9 '17 at 7:57
Worked for me on Lubuntu 16.04 after rebooting the system.
– Andritchi Alexei
Mar 13 '17 at 13:00
Worked for me on Lubuntu 16.04 after rebooting the system.
– Andritchi Alexei
Mar 13 '17 at 13:00
1
1
How to find out BoardName? Might sound stupid, but this might be the reason I don't get it to work.
– davidbaumann
Sep 23 '17 at 14:12
How to find out BoardName? Might sound stupid, but this might be the reason I don't get it to work.
– davidbaumann
Sep 23 '17 at 14:12
|
show 3 more comments
I had a similar issue with my laptop, there is an option you need to add to your /etc/X11/xorg.conf
Run command:
sudo nano /etc/X11/xorg.conf
Find the line Section "Device" and add the following
Option "RegistryDwords" "EnableBrightnessControl=1"
This fixed it for me. Thanks.
– Cerin
Mar 11 '12 at 19:44
This also works with Ubuntu 12.04
– shaneonabike
Sep 25 '13 at 19:21
Xubuntu 12.04 works as well
– Stasik
Aug 17 '14 at 15:01
This doesn't work for me in 12.04.
– Cerin
Apr 6 '15 at 12:57
This doesn't work for me in 18.04
– Hany Alsamman
Aug 28 '18 at 16:06
add a comment |
I had a similar issue with my laptop, there is an option you need to add to your /etc/X11/xorg.conf
Run command:
sudo nano /etc/X11/xorg.conf
Find the line Section "Device" and add the following
Option "RegistryDwords" "EnableBrightnessControl=1"
This fixed it for me. Thanks.
– Cerin
Mar 11 '12 at 19:44
This also works with Ubuntu 12.04
– shaneonabike
Sep 25 '13 at 19:21
Xubuntu 12.04 works as well
– Stasik
Aug 17 '14 at 15:01
This doesn't work for me in 12.04.
– Cerin
Apr 6 '15 at 12:57
This doesn't work for me in 18.04
– Hany Alsamman
Aug 28 '18 at 16:06
add a comment |
I had a similar issue with my laptop, there is an option you need to add to your /etc/X11/xorg.conf
Run command:
sudo nano /etc/X11/xorg.conf
Find the line Section "Device" and add the following
Option "RegistryDwords" "EnableBrightnessControl=1"
I had a similar issue with my laptop, there is an option you need to add to your /etc/X11/xorg.conf
Run command:
sudo nano /etc/X11/xorg.conf
Find the line Section "Device" and add the following
Option "RegistryDwords" "EnableBrightnessControl=1"
edited Feb 14 '17 at 6:17
d a i s y
3,26782344
3,26782344
answered Dec 14 '11 at 2:22
Mike
20917
20917
This fixed it for me. Thanks.
– Cerin
Mar 11 '12 at 19:44
This also works with Ubuntu 12.04
– shaneonabike
Sep 25 '13 at 19:21
Xubuntu 12.04 works as well
– Stasik
Aug 17 '14 at 15:01
This doesn't work for me in 12.04.
– Cerin
Apr 6 '15 at 12:57
This doesn't work for me in 18.04
– Hany Alsamman
Aug 28 '18 at 16:06
add a comment |
This fixed it for me. Thanks.
– Cerin
Mar 11 '12 at 19:44
This also works with Ubuntu 12.04
– shaneonabike
Sep 25 '13 at 19:21
Xubuntu 12.04 works as well
– Stasik
Aug 17 '14 at 15:01
This doesn't work for me in 12.04.
– Cerin
Apr 6 '15 at 12:57
This doesn't work for me in 18.04
– Hany Alsamman
Aug 28 '18 at 16:06
This fixed it for me. Thanks.
– Cerin
Mar 11 '12 at 19:44
This fixed it for me. Thanks.
– Cerin
Mar 11 '12 at 19:44
This also works with Ubuntu 12.04
– shaneonabike
Sep 25 '13 at 19:21
This also works with Ubuntu 12.04
– shaneonabike
Sep 25 '13 at 19:21
Xubuntu 12.04 works as well
– Stasik
Aug 17 '14 at 15:01
Xubuntu 12.04 works as well
– Stasik
Aug 17 '14 at 15:01
This doesn't work for me in 12.04.
– Cerin
Apr 6 '15 at 12:57
This doesn't work for me in 12.04.
– Cerin
Apr 6 '15 at 12:57
This doesn't work for me in 18.04
– Hany Alsamman
Aug 28 '18 at 16:06
This doesn't work for me in 18.04
– Hany Alsamman
Aug 28 '18 at 16:06
add a comment |
You need to enable Brightness Control.
Open terminal and type sudo gedit /etc/x11/xorg.conf
And then add Option "RegistryDwords" "EnableBrightnessControl=1" inside the device section, paste it in a new line.
Then restart your computer and everything should be fine.
add a comment |
You need to enable Brightness Control.
Open terminal and type sudo gedit /etc/x11/xorg.conf
And then add Option "RegistryDwords" "EnableBrightnessControl=1" inside the device section, paste it in a new line.
Then restart your computer and everything should be fine.
add a comment |
You need to enable Brightness Control.
Open terminal and type sudo gedit /etc/x11/xorg.conf
And then add Option "RegistryDwords" "EnableBrightnessControl=1" inside the device section, paste it in a new line.
Then restart your computer and everything should be fine.
You need to enable Brightness Control.
Open terminal and type sudo gedit /etc/x11/xorg.conf
And then add Option "RegistryDwords" "EnableBrightnessControl=1" inside the device section, paste it in a new line.
Then restart your computer and everything should be fine.
edited Aug 7 '17 at 3:12
Community♦
1
1
answered Dec 19 '11 at 19:36
Gundars Mēness
1871212
1871212
add a comment |
add a comment |
Thank you for providing the great script qgj. It's sad that this bug still persists and the work-around is needed. I had the same issue as James getting an error due to the options no longer being valid with nvidia-settings for my specific display type. As luck would have it, there is a better setting available for backlight brightness. I have modified the bash script to use this setting instead.
#!/bin/bash
# This script was originally created by 'qgj' from askubuntu. It has been modified
# to work using the BacklightBrighness setting available for some displays on the currrent nvidia driver
# It has also been modified to remove display specific configuration, instead applying the setting to all
# active displays which support the BacklightBrightness setting.
# Tested only with nvidia-settings-319.12 and nvidia-drivers-331.20 on Linux Mint 17 Mate
#
# Requirements:
# - NVIDIA Drivers (e.g. nvidia-current in Ubuntu)
# - NVIDIA Settings (nvidia-settings in Ubuntu)
#
# This script can be used to change the brightness on systems with an NVIDIA graphics card
# that lack the support for changing the brightness (probably needing acpi backlight).
# It uses "nvidia-settings -a" to assign new gamma or brightness values to the display.
#
# If this script fails, your display likely does not support the 'BacklightBrightness' option.
# In that event, execute 'nvidia-settings -n -q all' to see which options are available for the displays
#
# "nvidia-brightness.sh" may be run from the command line or can be assigned to the brightness keys on your Keyboard
# Type "nvidia-brightness.sh --help" for valid options.
if [ -z "${BASH}" ] ; then
echo "please run this script with the BASH shell"
exit 1
fi
usage ()
{
cat << ENDMSG
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -bu ] or [ --brightness-up ] increase brightness by 10
[ -bu <no> ] or
[ --brightness-up <no> ] increase brightness by specified <no>
[ -bd ] or [ --brightness-down ] decrease brightness by 10
[ -bd <no> ] or
[ --brightness-down <no> ] decrease brightness by specified <no>
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
brightness will be set to 100.
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -bd this will decrease gamma by 10
nvidia-brightness -bu 15 this will increase brightness by 15
ENDMSG
}
case $1 in
-h|--help)
usage
exit 0
esac
if [ "$1" != "-i" -a "$1" != "--initialize" ] ; then
if [[ ! -f ~/.nvidia-brightness.cfg ]]; then
echo 'You must run this script with the --initialize option once to create the settings file.'
echo 'Type "nvidia-brightness.sh --help" for more information.';
exit 1
fi
fi
#### INITIALIZE ####
initialize_cfg ()
{
BRIGHTNESS_TEMP=100
echo "BRIGHTNESS=$BRIGHTNESS_TEMP" > ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
# Valid BacklightBrightness values are between 0 and 100
# Example: nvidia-settings -n -a BacklightBrightness=80
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
exit $?
}
#### LOAD CONFIGURATION ####
load_cfg ()
{
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
#### BRIGHTNESS CHANGE ####
brightness_up ()
{
source ~/.nvidia-brightness.cfg
[[ -z $1 ]] && BRIGHTNESS_INC=10 || BRIGHTNESS_INC=$1
BRIGHTNESSNEW=$(( $BRIGHTNESS + $BRIGHTNESS_INC ))
[[ $BRIGHTNESSNEW -gt 100 ]] && BRIGHTNESSNEW=100
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
brightness_down ()
{
source ~/.nvidia-brightness.cfg
[[ -z $1 ]] && BRIGHTNESS_INC=10 || BRIGHTNESS_INC=$1
BRIGHTNESSNEW=$(( $BRIGHTNESS - $BRIGHTNESS_INC ))
[[ $BRIGHTNESSNEW -lt 0 ]] && BRIGHTNESSNEW=0
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
if [[ "$3" != "" ]]; then
usage
exit 1
fi
error_mixed_brightness ()
{
echo "Error: [ --brightness-up ] and [ --brightness-down ] can't be used together."
}
if [[ "$2" != "" ]]; then
[[ ! "$2" == ?(-)+([0-9]) ]] && usage && exit 1
fi
case $1 in
-bu|--brightness-up)
[ "$2" == "-bd" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-down" ] && error_mixed_brightness && exit 1
brightness_up $2
;;
-bd|--brightness-down)
[ "$2" == "-bu" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-up" ] && error_mixed_brightness && exit 1
brightness_down $2
;;
-h|--help)
usage
exit 0
;;
-i|--initialize)
if [ "$2" != "" ]; then usage; exit 1; fi
initialize_cfg
exit $?
;;
-l|--load-config)
if [ "$2" != "" ]; then usage; exit 1; fi
load_cfg
exit 0
;;
*)
usage
exit 1
esac
Your mileage may vary with this script as some displays/adapters support different options. If you encounter issues with it please read the help and comments in the script.
Hope it helps someone!
add a comment |
Thank you for providing the great script qgj. It's sad that this bug still persists and the work-around is needed. I had the same issue as James getting an error due to the options no longer being valid with nvidia-settings for my specific display type. As luck would have it, there is a better setting available for backlight brightness. I have modified the bash script to use this setting instead.
#!/bin/bash
# This script was originally created by 'qgj' from askubuntu. It has been modified
# to work using the BacklightBrighness setting available for some displays on the currrent nvidia driver
# It has also been modified to remove display specific configuration, instead applying the setting to all
# active displays which support the BacklightBrightness setting.
# Tested only with nvidia-settings-319.12 and nvidia-drivers-331.20 on Linux Mint 17 Mate
#
# Requirements:
# - NVIDIA Drivers (e.g. nvidia-current in Ubuntu)
# - NVIDIA Settings (nvidia-settings in Ubuntu)
#
# This script can be used to change the brightness on systems with an NVIDIA graphics card
# that lack the support for changing the brightness (probably needing acpi backlight).
# It uses "nvidia-settings -a" to assign new gamma or brightness values to the display.
#
# If this script fails, your display likely does not support the 'BacklightBrightness' option.
# In that event, execute 'nvidia-settings -n -q all' to see which options are available for the displays
#
# "nvidia-brightness.sh" may be run from the command line or can be assigned to the brightness keys on your Keyboard
# Type "nvidia-brightness.sh --help" for valid options.
if [ -z "${BASH}" ] ; then
echo "please run this script with the BASH shell"
exit 1
fi
usage ()
{
cat << ENDMSG
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -bu ] or [ --brightness-up ] increase brightness by 10
[ -bu <no> ] or
[ --brightness-up <no> ] increase brightness by specified <no>
[ -bd ] or [ --brightness-down ] decrease brightness by 10
[ -bd <no> ] or
[ --brightness-down <no> ] decrease brightness by specified <no>
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
brightness will be set to 100.
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -bd this will decrease gamma by 10
nvidia-brightness -bu 15 this will increase brightness by 15
ENDMSG
}
case $1 in
-h|--help)
usage
exit 0
esac
if [ "$1" != "-i" -a "$1" != "--initialize" ] ; then
if [[ ! -f ~/.nvidia-brightness.cfg ]]; then
echo 'You must run this script with the --initialize option once to create the settings file.'
echo 'Type "nvidia-brightness.sh --help" for more information.';
exit 1
fi
fi
#### INITIALIZE ####
initialize_cfg ()
{
BRIGHTNESS_TEMP=100
echo "BRIGHTNESS=$BRIGHTNESS_TEMP" > ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
# Valid BacklightBrightness values are between 0 and 100
# Example: nvidia-settings -n -a BacklightBrightness=80
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
exit $?
}
#### LOAD CONFIGURATION ####
load_cfg ()
{
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
#### BRIGHTNESS CHANGE ####
brightness_up ()
{
source ~/.nvidia-brightness.cfg
[[ -z $1 ]] && BRIGHTNESS_INC=10 || BRIGHTNESS_INC=$1
BRIGHTNESSNEW=$(( $BRIGHTNESS + $BRIGHTNESS_INC ))
[[ $BRIGHTNESSNEW -gt 100 ]] && BRIGHTNESSNEW=100
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
brightness_down ()
{
source ~/.nvidia-brightness.cfg
[[ -z $1 ]] && BRIGHTNESS_INC=10 || BRIGHTNESS_INC=$1
BRIGHTNESSNEW=$(( $BRIGHTNESS - $BRIGHTNESS_INC ))
[[ $BRIGHTNESSNEW -lt 0 ]] && BRIGHTNESSNEW=0
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
if [[ "$3" != "" ]]; then
usage
exit 1
fi
error_mixed_brightness ()
{
echo "Error: [ --brightness-up ] and [ --brightness-down ] can't be used together."
}
if [[ "$2" != "" ]]; then
[[ ! "$2" == ?(-)+([0-9]) ]] && usage && exit 1
fi
case $1 in
-bu|--brightness-up)
[ "$2" == "-bd" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-down" ] && error_mixed_brightness && exit 1
brightness_up $2
;;
-bd|--brightness-down)
[ "$2" == "-bu" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-up" ] && error_mixed_brightness && exit 1
brightness_down $2
;;
-h|--help)
usage
exit 0
;;
-i|--initialize)
if [ "$2" != "" ]; then usage; exit 1; fi
initialize_cfg
exit $?
;;
-l|--load-config)
if [ "$2" != "" ]; then usage; exit 1; fi
load_cfg
exit 0
;;
*)
usage
exit 1
esac
Your mileage may vary with this script as some displays/adapters support different options. If you encounter issues with it please read the help and comments in the script.
Hope it helps someone!
add a comment |
Thank you for providing the great script qgj. It's sad that this bug still persists and the work-around is needed. I had the same issue as James getting an error due to the options no longer being valid with nvidia-settings for my specific display type. As luck would have it, there is a better setting available for backlight brightness. I have modified the bash script to use this setting instead.
#!/bin/bash
# This script was originally created by 'qgj' from askubuntu. It has been modified
# to work using the BacklightBrighness setting available for some displays on the currrent nvidia driver
# It has also been modified to remove display specific configuration, instead applying the setting to all
# active displays which support the BacklightBrightness setting.
# Tested only with nvidia-settings-319.12 and nvidia-drivers-331.20 on Linux Mint 17 Mate
#
# Requirements:
# - NVIDIA Drivers (e.g. nvidia-current in Ubuntu)
# - NVIDIA Settings (nvidia-settings in Ubuntu)
#
# This script can be used to change the brightness on systems with an NVIDIA graphics card
# that lack the support for changing the brightness (probably needing acpi backlight).
# It uses "nvidia-settings -a" to assign new gamma or brightness values to the display.
#
# If this script fails, your display likely does not support the 'BacklightBrightness' option.
# In that event, execute 'nvidia-settings -n -q all' to see which options are available for the displays
#
# "nvidia-brightness.sh" may be run from the command line or can be assigned to the brightness keys on your Keyboard
# Type "nvidia-brightness.sh --help" for valid options.
if [ -z "${BASH}" ] ; then
echo "please run this script with the BASH shell"
exit 1
fi
usage ()
{
cat << ENDMSG
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -bu ] or [ --brightness-up ] increase brightness by 10
[ -bu <no> ] or
[ --brightness-up <no> ] increase brightness by specified <no>
[ -bd ] or [ --brightness-down ] decrease brightness by 10
[ -bd <no> ] or
[ --brightness-down <no> ] decrease brightness by specified <no>
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
brightness will be set to 100.
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -bd this will decrease gamma by 10
nvidia-brightness -bu 15 this will increase brightness by 15
ENDMSG
}
case $1 in
-h|--help)
usage
exit 0
esac
if [ "$1" != "-i" -a "$1" != "--initialize" ] ; then
if [[ ! -f ~/.nvidia-brightness.cfg ]]; then
echo 'You must run this script with the --initialize option once to create the settings file.'
echo 'Type "nvidia-brightness.sh --help" for more information.';
exit 1
fi
fi
#### INITIALIZE ####
initialize_cfg ()
{
BRIGHTNESS_TEMP=100
echo "BRIGHTNESS=$BRIGHTNESS_TEMP" > ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
# Valid BacklightBrightness values are between 0 and 100
# Example: nvidia-settings -n -a BacklightBrightness=80
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
exit $?
}
#### LOAD CONFIGURATION ####
load_cfg ()
{
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
#### BRIGHTNESS CHANGE ####
brightness_up ()
{
source ~/.nvidia-brightness.cfg
[[ -z $1 ]] && BRIGHTNESS_INC=10 || BRIGHTNESS_INC=$1
BRIGHTNESSNEW=$(( $BRIGHTNESS + $BRIGHTNESS_INC ))
[[ $BRIGHTNESSNEW -gt 100 ]] && BRIGHTNESSNEW=100
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
brightness_down ()
{
source ~/.nvidia-brightness.cfg
[[ -z $1 ]] && BRIGHTNESS_INC=10 || BRIGHTNESS_INC=$1
BRIGHTNESSNEW=$(( $BRIGHTNESS - $BRIGHTNESS_INC ))
[[ $BRIGHTNESSNEW -lt 0 ]] && BRIGHTNESSNEW=0
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
if [[ "$3" != "" ]]; then
usage
exit 1
fi
error_mixed_brightness ()
{
echo "Error: [ --brightness-up ] and [ --brightness-down ] can't be used together."
}
if [[ "$2" != "" ]]; then
[[ ! "$2" == ?(-)+([0-9]) ]] && usage && exit 1
fi
case $1 in
-bu|--brightness-up)
[ "$2" == "-bd" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-down" ] && error_mixed_brightness && exit 1
brightness_up $2
;;
-bd|--brightness-down)
[ "$2" == "-bu" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-up" ] && error_mixed_brightness && exit 1
brightness_down $2
;;
-h|--help)
usage
exit 0
;;
-i|--initialize)
if [ "$2" != "" ]; then usage; exit 1; fi
initialize_cfg
exit $?
;;
-l|--load-config)
if [ "$2" != "" ]; then usage; exit 1; fi
load_cfg
exit 0
;;
*)
usage
exit 1
esac
Your mileage may vary with this script as some displays/adapters support different options. If you encounter issues with it please read the help and comments in the script.
Hope it helps someone!
Thank you for providing the great script qgj. It's sad that this bug still persists and the work-around is needed. I had the same issue as James getting an error due to the options no longer being valid with nvidia-settings for my specific display type. As luck would have it, there is a better setting available for backlight brightness. I have modified the bash script to use this setting instead.
#!/bin/bash
# This script was originally created by 'qgj' from askubuntu. It has been modified
# to work using the BacklightBrighness setting available for some displays on the currrent nvidia driver
# It has also been modified to remove display specific configuration, instead applying the setting to all
# active displays which support the BacklightBrightness setting.
# Tested only with nvidia-settings-319.12 and nvidia-drivers-331.20 on Linux Mint 17 Mate
#
# Requirements:
# - NVIDIA Drivers (e.g. nvidia-current in Ubuntu)
# - NVIDIA Settings (nvidia-settings in Ubuntu)
#
# This script can be used to change the brightness on systems with an NVIDIA graphics card
# that lack the support for changing the brightness (probably needing acpi backlight).
# It uses "nvidia-settings -a" to assign new gamma or brightness values to the display.
#
# If this script fails, your display likely does not support the 'BacklightBrightness' option.
# In that event, execute 'nvidia-settings -n -q all' to see which options are available for the displays
#
# "nvidia-brightness.sh" may be run from the command line or can be assigned to the brightness keys on your Keyboard
# Type "nvidia-brightness.sh --help" for valid options.
if [ -z "${BASH}" ] ; then
echo "please run this script with the BASH shell"
exit 1
fi
usage ()
{
cat << ENDMSG
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -bu ] or [ --brightness-up ] increase brightness by 10
[ -bu <no> ] or
[ --brightness-up <no> ] increase brightness by specified <no>
[ -bd ] or [ --brightness-down ] decrease brightness by 10
[ -bd <no> ] or
[ --brightness-down <no> ] decrease brightness by specified <no>
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
brightness will be set to 100.
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -bd this will decrease gamma by 10
nvidia-brightness -bu 15 this will increase brightness by 15
ENDMSG
}
case $1 in
-h|--help)
usage
exit 0
esac
if [ "$1" != "-i" -a "$1" != "--initialize" ] ; then
if [[ ! -f ~/.nvidia-brightness.cfg ]]; then
echo 'You must run this script with the --initialize option once to create the settings file.'
echo 'Type "nvidia-brightness.sh --help" for more information.';
exit 1
fi
fi
#### INITIALIZE ####
initialize_cfg ()
{
BRIGHTNESS_TEMP=100
echo "BRIGHTNESS=$BRIGHTNESS_TEMP" > ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
# Valid BacklightBrightness values are between 0 and 100
# Example: nvidia-settings -n -a BacklightBrightness=80
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
exit $?
}
#### LOAD CONFIGURATION ####
load_cfg ()
{
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
#### BRIGHTNESS CHANGE ####
brightness_up ()
{
source ~/.nvidia-brightness.cfg
[[ -z $1 ]] && BRIGHTNESS_INC=10 || BRIGHTNESS_INC=$1
BRIGHTNESSNEW=$(( $BRIGHTNESS + $BRIGHTNESS_INC ))
[[ $BRIGHTNESSNEW -gt 100 ]] && BRIGHTNESSNEW=100
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
brightness_down ()
{
source ~/.nvidia-brightness.cfg
[[ -z $1 ]] && BRIGHTNESS_INC=10 || BRIGHTNESS_INC=$1
BRIGHTNESSNEW=$(( $BRIGHTNESS - $BRIGHTNESS_INC ))
[[ $BRIGHTNESSNEW -lt 0 ]] && BRIGHTNESSNEW=0
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
echo "BRIGHTNESS: $BRIGHTNESS"
nvidia-settings -n -a BacklightBrightness=$BRIGHTNESS 1>/dev/null
}
if [[ "$3" != "" ]]; then
usage
exit 1
fi
error_mixed_brightness ()
{
echo "Error: [ --brightness-up ] and [ --brightness-down ] can't be used together."
}
if [[ "$2" != "" ]]; then
[[ ! "$2" == ?(-)+([0-9]) ]] && usage && exit 1
fi
case $1 in
-bu|--brightness-up)
[ "$2" == "-bd" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-down" ] && error_mixed_brightness && exit 1
brightness_up $2
;;
-bd|--brightness-down)
[ "$2" == "-bu" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-up" ] && error_mixed_brightness && exit 1
brightness_down $2
;;
-h|--help)
usage
exit 0
;;
-i|--initialize)
if [ "$2" != "" ]; then usage; exit 1; fi
initialize_cfg
exit $?
;;
-l|--load-config)
if [ "$2" != "" ]; then usage; exit 1; fi
load_cfg
exit 0
;;
*)
usage
exit 1
esac
Your mileage may vary with this script as some displays/adapters support different options. If you encounter issues with it please read the help and comments in the script.
Hope it helps someone!
answered Sep 25 '14 at 16:10
xhalarin
213
213
add a comment |
add a comment |
There are some computers, such as my Lenovo W520, that don't with the Option "RegistryDwords" "EnableBrightnessControl=1" line. If you are one of those unlucky ones, you can try the nvidiabl driver (link here).
The nvidiabl driver provides a proper way to change the screen brightness. On some laptops the Option "RegistryDwords" "EnableBrightnessControl=1" hack will cause the backlight controller or your GPU to emit a high pitched noise.
Just download and install the latest Deb file from here: https://github.com/downloads/guillaumezin/nvidiabl/nvidiabl-dkms_0.72_all.deb
and run:
echo "nvidiabl" | sudo tee -a /etc/modules
to ensure that the module will be loaded when the computer boots.
add a comment |
There are some computers, such as my Lenovo W520, that don't with the Option "RegistryDwords" "EnableBrightnessControl=1" line. If you are one of those unlucky ones, you can try the nvidiabl driver (link here).
The nvidiabl driver provides a proper way to change the screen brightness. On some laptops the Option "RegistryDwords" "EnableBrightnessControl=1" hack will cause the backlight controller or your GPU to emit a high pitched noise.
Just download and install the latest Deb file from here: https://github.com/downloads/guillaumezin/nvidiabl/nvidiabl-dkms_0.72_all.deb
and run:
echo "nvidiabl" | sudo tee -a /etc/modules
to ensure that the module will be loaded when the computer boots.
add a comment |
There are some computers, such as my Lenovo W520, that don't with the Option "RegistryDwords" "EnableBrightnessControl=1" line. If you are one of those unlucky ones, you can try the nvidiabl driver (link here).
The nvidiabl driver provides a proper way to change the screen brightness. On some laptops the Option "RegistryDwords" "EnableBrightnessControl=1" hack will cause the backlight controller or your GPU to emit a high pitched noise.
Just download and install the latest Deb file from here: https://github.com/downloads/guillaumezin/nvidiabl/nvidiabl-dkms_0.72_all.deb
and run:
echo "nvidiabl" | sudo tee -a /etc/modules
to ensure that the module will be loaded when the computer boots.
There are some computers, such as my Lenovo W520, that don't with the Option "RegistryDwords" "EnableBrightnessControl=1" line. If you are one of those unlucky ones, you can try the nvidiabl driver (link here).
The nvidiabl driver provides a proper way to change the screen brightness. On some laptops the Option "RegistryDwords" "EnableBrightnessControl=1" hack will cause the backlight controller or your GPU to emit a high pitched noise.
Just download and install the latest Deb file from here: https://github.com/downloads/guillaumezin/nvidiabl/nvidiabl-dkms_0.72_all.deb
and run:
echo "nvidiabl" | sudo tee -a /etc/modules
to ensure that the module will be loaded when the computer boots.
answered Dec 20 '11 at 17:33
Andrew Gunnerson
3,60332221
3,60332221
add a comment |
add a comment |
Im personally using Vaio VPCCW21FX (Nvidia Graphic) and Ubuntu Studio 11.10 ..
I tried many solutions and nothing could resolve my problem with LCD brightness!
Finally wrote these two perl files to manually set brightness/Contrast and Gamma functions inside Nvidia driver config file.
This will be helpfull only if you are able to change brightness within Nvidia X Server Settings
Step 1: create this file and name it "Brightness-Up.pl"
(you can use any text editing tool like : gedit,nano,vi,etc.. copy & paste)
### Code by forgottenrip@yahoo.com ###
my $find1 = "0/RedBrightness=";my $find2 = "0/RedGamma=";
open FILE, "<Nvidia-Settings.cfg";
my @lines = <FILE>;
for (@lines) {
if ($_ =~ /$find1/) { chomp $_;$value= substr($_,16,5); }
if ($_ =~ /$find2/) { chomp $_;$value2= substr($_,11,5);}
}
my @Lines;
if ( $value > 0.0) { $value = $value - 0.30 };
if ( $value2 > 1.1) { $value2 = $value2 - 0.08 };
$last_value = $value + 0.30;
$Lines[0] ="0/RedBrightness=".$last_value;
$Lines[1] ="0/GreenBrightness=".$last_value;;
$Lines[2] ="0/BlueBrightness=".$last_value;;
$last_value = $value + 0.30;
$Lines[3] ="0/RedContrast=".$last_value;;
$Lines[4] ="0/GreenContrast=".$last_value;;
$Lines[5] ="0/BlueContrast=".$last_value;;
$last_value = $value2 + 0.08;
$Lines[6] ="0/RedGamma=".$last_value;;
$Lines[7] ="0/GreenGamma=".$last_value;;
$Lines[8] ="0/BlueGamma=".$last_value;;
$filename = "Nvidia-Settings.cfg";
open fh2,'>',$filename or die ("can't open '$filename': $! n");
foreach ( @Lines )
{ chomp;print "$_n";print fh2 "$_n"; };
close fh2;
`nvidia-settings -l --config=Nvidia-Settings.cfg`;
Step 2: then make another file, name it "Brightness-Down.pl" and fill with this code:
### Code by forgottenrip@yahoo.com ###
my $find1 = "0/RedBrightness=";my $find2 = "0/RedGamma=";
open FILE, "<Nvidia-Settings.cfg";
my @lines = <FILE>;
for (@lines) {
if ($_ =~ /$find1/) {chomp $_;$value= substr($_,16,5);}
if ($_ =~ /$find2/) {chomp $_;$value2= substr($_,11,5);}
}
my @Lines;
if ( $value < -0.80) { $value = $value + 0.30 };
if ( $value2 < 0.8) { $value2 = $value2 + 0.08 };
$last_value = $value - 0.30;
$Lines[0] ="0/RedBrightness=".$last_value;
$Lines[1] ="0/GreenBrightness=".$last_value;;
$Lines[2] ="0/BlueBrightness=".$last_value;;
$last_value = $value - 0.30;
$Lines[3] ="0/RedContrast=".$last_value;;
$Lines[4] ="0/GreenContrast=".$last_value;;
$Lines[5] ="0/BlueContrast=".$last_value;;
$last_value = $value2 - 0.08;
$Lines[6] ="0/RedGamma=".$last_value;;
$Lines[7] ="0/GreenGamma=".$last_value;;
$Lines[8] ="0/BlueGamma=".$last_value;;
$filename = "Nvidia-Settings.cfg";
open fh2,'>',$filename or die ("can't open '$filename': $! n");
foreach ( @Lines )
{ chomp;print "$_n";print fh2 "$_n"; };
close fh2;
`nvidia-settings -l --config=Nvidia-Settings.cfg`;
Step 3: You need to create another file which contains Nvidia Settings..
name it "Nvidia-Settings.cfg" its important that you write name exactly same.
fill with:
0/RedBrightness=0.1
0/GreenBrightness=0.1
0/BlueBrightness=0.1
0/RedContrast=0.1
0/GreenContrast=0.1
0/BlueContrast=0.1
0/RedGamma=1.14
0/GreenGamma=1.14
0/BlueGamma=1.14
Thats it! now place these files in unique folder.. you have to bind your Function Keys to these two perl file.you can use Compiz>commands to do that.
Run below command to install the compizconfig-settings-manager
sudo apt-get install compizconfig-settings-manager
or even you can run seperately with these two commands in shell (terminal):
user$ perl Brightness/Brightness-Up.pl
user$ perl Brightness/Brightness-Down.pl
where Brightness is folder I put those files in it.
add a comment |
Im personally using Vaio VPCCW21FX (Nvidia Graphic) and Ubuntu Studio 11.10 ..
I tried many solutions and nothing could resolve my problem with LCD brightness!
Finally wrote these two perl files to manually set brightness/Contrast and Gamma functions inside Nvidia driver config file.
This will be helpfull only if you are able to change brightness within Nvidia X Server Settings
Step 1: create this file and name it "Brightness-Up.pl"
(you can use any text editing tool like : gedit,nano,vi,etc.. copy & paste)
### Code by forgottenrip@yahoo.com ###
my $find1 = "0/RedBrightness=";my $find2 = "0/RedGamma=";
open FILE, "<Nvidia-Settings.cfg";
my @lines = <FILE>;
for (@lines) {
if ($_ =~ /$find1/) { chomp $_;$value= substr($_,16,5); }
if ($_ =~ /$find2/) { chomp $_;$value2= substr($_,11,5);}
}
my @Lines;
if ( $value > 0.0) { $value = $value - 0.30 };
if ( $value2 > 1.1) { $value2 = $value2 - 0.08 };
$last_value = $value + 0.30;
$Lines[0] ="0/RedBrightness=".$last_value;
$Lines[1] ="0/GreenBrightness=".$last_value;;
$Lines[2] ="0/BlueBrightness=".$last_value;;
$last_value = $value + 0.30;
$Lines[3] ="0/RedContrast=".$last_value;;
$Lines[4] ="0/GreenContrast=".$last_value;;
$Lines[5] ="0/BlueContrast=".$last_value;;
$last_value = $value2 + 0.08;
$Lines[6] ="0/RedGamma=".$last_value;;
$Lines[7] ="0/GreenGamma=".$last_value;;
$Lines[8] ="0/BlueGamma=".$last_value;;
$filename = "Nvidia-Settings.cfg";
open fh2,'>',$filename or die ("can't open '$filename': $! n");
foreach ( @Lines )
{ chomp;print "$_n";print fh2 "$_n"; };
close fh2;
`nvidia-settings -l --config=Nvidia-Settings.cfg`;
Step 2: then make another file, name it "Brightness-Down.pl" and fill with this code:
### Code by forgottenrip@yahoo.com ###
my $find1 = "0/RedBrightness=";my $find2 = "0/RedGamma=";
open FILE, "<Nvidia-Settings.cfg";
my @lines = <FILE>;
for (@lines) {
if ($_ =~ /$find1/) {chomp $_;$value= substr($_,16,5);}
if ($_ =~ /$find2/) {chomp $_;$value2= substr($_,11,5);}
}
my @Lines;
if ( $value < -0.80) { $value = $value + 0.30 };
if ( $value2 < 0.8) { $value2 = $value2 + 0.08 };
$last_value = $value - 0.30;
$Lines[0] ="0/RedBrightness=".$last_value;
$Lines[1] ="0/GreenBrightness=".$last_value;;
$Lines[2] ="0/BlueBrightness=".$last_value;;
$last_value = $value - 0.30;
$Lines[3] ="0/RedContrast=".$last_value;;
$Lines[4] ="0/GreenContrast=".$last_value;;
$Lines[5] ="0/BlueContrast=".$last_value;;
$last_value = $value2 - 0.08;
$Lines[6] ="0/RedGamma=".$last_value;;
$Lines[7] ="0/GreenGamma=".$last_value;;
$Lines[8] ="0/BlueGamma=".$last_value;;
$filename = "Nvidia-Settings.cfg";
open fh2,'>',$filename or die ("can't open '$filename': $! n");
foreach ( @Lines )
{ chomp;print "$_n";print fh2 "$_n"; };
close fh2;
`nvidia-settings -l --config=Nvidia-Settings.cfg`;
Step 3: You need to create another file which contains Nvidia Settings..
name it "Nvidia-Settings.cfg" its important that you write name exactly same.
fill with:
0/RedBrightness=0.1
0/GreenBrightness=0.1
0/BlueBrightness=0.1
0/RedContrast=0.1
0/GreenContrast=0.1
0/BlueContrast=0.1
0/RedGamma=1.14
0/GreenGamma=1.14
0/BlueGamma=1.14
Thats it! now place these files in unique folder.. you have to bind your Function Keys to these two perl file.you can use Compiz>commands to do that.
Run below command to install the compizconfig-settings-manager
sudo apt-get install compizconfig-settings-manager
or even you can run seperately with these two commands in shell (terminal):
user$ perl Brightness/Brightness-Up.pl
user$ perl Brightness/Brightness-Down.pl
where Brightness is folder I put those files in it.
add a comment |
Im personally using Vaio VPCCW21FX (Nvidia Graphic) and Ubuntu Studio 11.10 ..
I tried many solutions and nothing could resolve my problem with LCD brightness!
Finally wrote these two perl files to manually set brightness/Contrast and Gamma functions inside Nvidia driver config file.
This will be helpfull only if you are able to change brightness within Nvidia X Server Settings
Step 1: create this file and name it "Brightness-Up.pl"
(you can use any text editing tool like : gedit,nano,vi,etc.. copy & paste)
### Code by forgottenrip@yahoo.com ###
my $find1 = "0/RedBrightness=";my $find2 = "0/RedGamma=";
open FILE, "<Nvidia-Settings.cfg";
my @lines = <FILE>;
for (@lines) {
if ($_ =~ /$find1/) { chomp $_;$value= substr($_,16,5); }
if ($_ =~ /$find2/) { chomp $_;$value2= substr($_,11,5);}
}
my @Lines;
if ( $value > 0.0) { $value = $value - 0.30 };
if ( $value2 > 1.1) { $value2 = $value2 - 0.08 };
$last_value = $value + 0.30;
$Lines[0] ="0/RedBrightness=".$last_value;
$Lines[1] ="0/GreenBrightness=".$last_value;;
$Lines[2] ="0/BlueBrightness=".$last_value;;
$last_value = $value + 0.30;
$Lines[3] ="0/RedContrast=".$last_value;;
$Lines[4] ="0/GreenContrast=".$last_value;;
$Lines[5] ="0/BlueContrast=".$last_value;;
$last_value = $value2 + 0.08;
$Lines[6] ="0/RedGamma=".$last_value;;
$Lines[7] ="0/GreenGamma=".$last_value;;
$Lines[8] ="0/BlueGamma=".$last_value;;
$filename = "Nvidia-Settings.cfg";
open fh2,'>',$filename or die ("can't open '$filename': $! n");
foreach ( @Lines )
{ chomp;print "$_n";print fh2 "$_n"; };
close fh2;
`nvidia-settings -l --config=Nvidia-Settings.cfg`;
Step 2: then make another file, name it "Brightness-Down.pl" and fill with this code:
### Code by forgottenrip@yahoo.com ###
my $find1 = "0/RedBrightness=";my $find2 = "0/RedGamma=";
open FILE, "<Nvidia-Settings.cfg";
my @lines = <FILE>;
for (@lines) {
if ($_ =~ /$find1/) {chomp $_;$value= substr($_,16,5);}
if ($_ =~ /$find2/) {chomp $_;$value2= substr($_,11,5);}
}
my @Lines;
if ( $value < -0.80) { $value = $value + 0.30 };
if ( $value2 < 0.8) { $value2 = $value2 + 0.08 };
$last_value = $value - 0.30;
$Lines[0] ="0/RedBrightness=".$last_value;
$Lines[1] ="0/GreenBrightness=".$last_value;;
$Lines[2] ="0/BlueBrightness=".$last_value;;
$last_value = $value - 0.30;
$Lines[3] ="0/RedContrast=".$last_value;;
$Lines[4] ="0/GreenContrast=".$last_value;;
$Lines[5] ="0/BlueContrast=".$last_value;;
$last_value = $value2 - 0.08;
$Lines[6] ="0/RedGamma=".$last_value;;
$Lines[7] ="0/GreenGamma=".$last_value;;
$Lines[8] ="0/BlueGamma=".$last_value;;
$filename = "Nvidia-Settings.cfg";
open fh2,'>',$filename or die ("can't open '$filename': $! n");
foreach ( @Lines )
{ chomp;print "$_n";print fh2 "$_n"; };
close fh2;
`nvidia-settings -l --config=Nvidia-Settings.cfg`;
Step 3: You need to create another file which contains Nvidia Settings..
name it "Nvidia-Settings.cfg" its important that you write name exactly same.
fill with:
0/RedBrightness=0.1
0/GreenBrightness=0.1
0/BlueBrightness=0.1
0/RedContrast=0.1
0/GreenContrast=0.1
0/BlueContrast=0.1
0/RedGamma=1.14
0/GreenGamma=1.14
0/BlueGamma=1.14
Thats it! now place these files in unique folder.. you have to bind your Function Keys to these two perl file.you can use Compiz>commands to do that.
Run below command to install the compizconfig-settings-manager
sudo apt-get install compizconfig-settings-manager
or even you can run seperately with these two commands in shell (terminal):
user$ perl Brightness/Brightness-Up.pl
user$ perl Brightness/Brightness-Down.pl
where Brightness is folder I put those files in it.
Im personally using Vaio VPCCW21FX (Nvidia Graphic) and Ubuntu Studio 11.10 ..
I tried many solutions and nothing could resolve my problem with LCD brightness!
Finally wrote these two perl files to manually set brightness/Contrast and Gamma functions inside Nvidia driver config file.
This will be helpfull only if you are able to change brightness within Nvidia X Server Settings
Step 1: create this file and name it "Brightness-Up.pl"
(you can use any text editing tool like : gedit,nano,vi,etc.. copy & paste)
### Code by forgottenrip@yahoo.com ###
my $find1 = "0/RedBrightness=";my $find2 = "0/RedGamma=";
open FILE, "<Nvidia-Settings.cfg";
my @lines = <FILE>;
for (@lines) {
if ($_ =~ /$find1/) { chomp $_;$value= substr($_,16,5); }
if ($_ =~ /$find2/) { chomp $_;$value2= substr($_,11,5);}
}
my @Lines;
if ( $value > 0.0) { $value = $value - 0.30 };
if ( $value2 > 1.1) { $value2 = $value2 - 0.08 };
$last_value = $value + 0.30;
$Lines[0] ="0/RedBrightness=".$last_value;
$Lines[1] ="0/GreenBrightness=".$last_value;;
$Lines[2] ="0/BlueBrightness=".$last_value;;
$last_value = $value + 0.30;
$Lines[3] ="0/RedContrast=".$last_value;;
$Lines[4] ="0/GreenContrast=".$last_value;;
$Lines[5] ="0/BlueContrast=".$last_value;;
$last_value = $value2 + 0.08;
$Lines[6] ="0/RedGamma=".$last_value;;
$Lines[7] ="0/GreenGamma=".$last_value;;
$Lines[8] ="0/BlueGamma=".$last_value;;
$filename = "Nvidia-Settings.cfg";
open fh2,'>',$filename or die ("can't open '$filename': $! n");
foreach ( @Lines )
{ chomp;print "$_n";print fh2 "$_n"; };
close fh2;
`nvidia-settings -l --config=Nvidia-Settings.cfg`;
Step 2: then make another file, name it "Brightness-Down.pl" and fill with this code:
### Code by forgottenrip@yahoo.com ###
my $find1 = "0/RedBrightness=";my $find2 = "0/RedGamma=";
open FILE, "<Nvidia-Settings.cfg";
my @lines = <FILE>;
for (@lines) {
if ($_ =~ /$find1/) {chomp $_;$value= substr($_,16,5);}
if ($_ =~ /$find2/) {chomp $_;$value2= substr($_,11,5);}
}
my @Lines;
if ( $value < -0.80) { $value = $value + 0.30 };
if ( $value2 < 0.8) { $value2 = $value2 + 0.08 };
$last_value = $value - 0.30;
$Lines[0] ="0/RedBrightness=".$last_value;
$Lines[1] ="0/GreenBrightness=".$last_value;;
$Lines[2] ="0/BlueBrightness=".$last_value;;
$last_value = $value - 0.30;
$Lines[3] ="0/RedContrast=".$last_value;;
$Lines[4] ="0/GreenContrast=".$last_value;;
$Lines[5] ="0/BlueContrast=".$last_value;;
$last_value = $value2 - 0.08;
$Lines[6] ="0/RedGamma=".$last_value;;
$Lines[7] ="0/GreenGamma=".$last_value;;
$Lines[8] ="0/BlueGamma=".$last_value;;
$filename = "Nvidia-Settings.cfg";
open fh2,'>',$filename or die ("can't open '$filename': $! n");
foreach ( @Lines )
{ chomp;print "$_n";print fh2 "$_n"; };
close fh2;
`nvidia-settings -l --config=Nvidia-Settings.cfg`;
Step 3: You need to create another file which contains Nvidia Settings..
name it "Nvidia-Settings.cfg" its important that you write name exactly same.
fill with:
0/RedBrightness=0.1
0/GreenBrightness=0.1
0/BlueBrightness=0.1
0/RedContrast=0.1
0/GreenContrast=0.1
0/BlueContrast=0.1
0/RedGamma=1.14
0/GreenGamma=1.14
0/BlueGamma=1.14
Thats it! now place these files in unique folder.. you have to bind your Function Keys to these two perl file.you can use Compiz>commands to do that.
Run below command to install the compizconfig-settings-manager
sudo apt-get install compizconfig-settings-manager
or even you can run seperately with these two commands in shell (terminal):
user$ perl Brightness/Brightness-Up.pl
user$ perl Brightness/Brightness-Down.pl
where Brightness is folder I put those files in it.
edited Aug 23 '12 at 13:14
answered Aug 22 '12 at 15:49
Amir Reza Adib
149110
149110
add a comment |
add a comment |
The other answers are good steps to try, but note that some combinations of Ubuntu/Linux Kernel and the Nvidia driver just won't work. I used 12.04 for years, and even though I tried all the above answers, I couldn't get any of the Nvidia drivers to support screen dimming on my Macbook Pro 5,5.
When I finally upgraded to 14.04, I tried the Nouveau driver, which did support screen dimming, and was generally faster and more reliable and Nvidia. Unfortunately, it doesn't support suspend/resume, making it useless on a laptop. I switched back to Nvidia, but several drivers caused X/lightdm to crash, preventing me from even logging in. I finally found that the Nvidia 340 driver was stable with my Macbook Pro 5,5 and Ubuntu 14.04 and also supported dimming.
add a comment |
The other answers are good steps to try, but note that some combinations of Ubuntu/Linux Kernel and the Nvidia driver just won't work. I used 12.04 for years, and even though I tried all the above answers, I couldn't get any of the Nvidia drivers to support screen dimming on my Macbook Pro 5,5.
When I finally upgraded to 14.04, I tried the Nouveau driver, which did support screen dimming, and was generally faster and more reliable and Nvidia. Unfortunately, it doesn't support suspend/resume, making it useless on a laptop. I switched back to Nvidia, but several drivers caused X/lightdm to crash, preventing me from even logging in. I finally found that the Nvidia 340 driver was stable with my Macbook Pro 5,5 and Ubuntu 14.04 and also supported dimming.
add a comment |
The other answers are good steps to try, but note that some combinations of Ubuntu/Linux Kernel and the Nvidia driver just won't work. I used 12.04 for years, and even though I tried all the above answers, I couldn't get any of the Nvidia drivers to support screen dimming on my Macbook Pro 5,5.
When I finally upgraded to 14.04, I tried the Nouveau driver, which did support screen dimming, and was generally faster and more reliable and Nvidia. Unfortunately, it doesn't support suspend/resume, making it useless on a laptop. I switched back to Nvidia, but several drivers caused X/lightdm to crash, preventing me from even logging in. I finally found that the Nvidia 340 driver was stable with my Macbook Pro 5,5 and Ubuntu 14.04 and also supported dimming.
The other answers are good steps to try, but note that some combinations of Ubuntu/Linux Kernel and the Nvidia driver just won't work. I used 12.04 for years, and even though I tried all the above answers, I couldn't get any of the Nvidia drivers to support screen dimming on my Macbook Pro 5,5.
When I finally upgraded to 14.04, I tried the Nouveau driver, which did support screen dimming, and was generally faster and more reliable and Nvidia. Unfortunately, it doesn't support suspend/resume, making it useless on a laptop. I switched back to Nvidia, but several drivers caused X/lightdm to crash, preventing me from even logging in. I finally found that the Nvidia 340 driver was stable with my Macbook Pro 5,5 and Ubuntu 14.04 and also supported dimming.
answered May 1 '15 at 13:09
Cerin
2,23684073
2,23684073
add a comment |
add a comment |
FYI, just worked through this on a Lenovo W520, and the addition of the simple line
Option "RegistryDwords" "EnableBrightnessControl=1"
to xorg.conf was enough - no need for any of the other bogosity, and all works fine with a current NVidia release (specifically, running 346.35)
add a comment |
FYI, just worked through this on a Lenovo W520, and the addition of the simple line
Option "RegistryDwords" "EnableBrightnessControl=1"
to xorg.conf was enough - no need for any of the other bogosity, and all works fine with a current NVidia release (specifically, running 346.35)
add a comment |
FYI, just worked through this on a Lenovo W520, and the addition of the simple line
Option "RegistryDwords" "EnableBrightnessControl=1"
to xorg.conf was enough - no need for any of the other bogosity, and all works fine with a current NVidia release (specifically, running 346.35)
FYI, just worked through this on a Lenovo W520, and the addition of the simple line
Option "RegistryDwords" "EnableBrightnessControl=1"
to xorg.conf was enough - no need for any of the other bogosity, and all works fine with a current NVidia release (specifically, running 346.35)
answered Apr 28 '16 at 16:56
Tim Dawson
111
111
add a comment |
add a comment |
NVIDIA brightness bash script
The above perl script didnt work for me so I wrote my own script as a bash script (since I don't know perl). It got a bit long but it creates the settings file by itself and can be used with command line options to adjust brightness or gamma or both at the same time.
I use it with the --brightness-up and --brightness-down switches for the brightness keys on my Keyboard. Easy to assign in XFCE4 and surely also in KDE / GNOME.
nvidia-brightness.sh:
#!/bin/sh
# Tested only with nvidia-settings-319.12 and nvidia-drivers-319.17 on Funtoo Linux running XFCE 4.10
#
# Requirements:
# - NVIDIA Drivers (e.g. nvidia-current in Ubuntu)
# - NVIDIA Settings (nvidia-settings in Ubuntu)
# - xrandr (used by default to determine the correct display name)
#
# This script can be used to change the brightness on systems with an NVIDIA graphics card
# that lack the support for changing the brightness (probably needing acpi backlight).
# It uses "nvidia-settings -a" to assign new gamma or brightness values to the display.
#
# "nvidia-brightness.sh" may be run from the command line or can be assigned to the brightness keys on your Keyboard
# e.g. in XFCE4.
#
# Type "nvidia-brightness.sh --help" for valid options.
usage ()
{
cat << ENDMSG
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -gu ] or [ --gamma-up ] increase gamma by 0.1
[ -gd ] or [ --gamma-down ] decrease gamma by 0.1
[ -bu ] or [ --brightness-up ] increase brightness by 0.1
[ -bd ] or [ --brightness-down ] decrease brightness by 0.1
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
gamma will be set to 1.0 and brightness to 0.0
(NVIDIA Standard).
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -gd this will decrease gamma by 0.1
nvidia-brightness -bu -gd this will increase brightness by 0.1 and decrease gamma by 0.1
ENDMSG
}
case $1 in
-h|--help)
usage
exit 0
esac
if [ "$1" != "-i" -a "$1" != "--initialize" ]; then
if [ ! -f ~/.nvidia-brightness.cfg ]; then
echo 'You must run this script with the --initialize option once to create the settings file.'
echo 'Type "nvidia-brightness.sh --help" for more information.';
exit 1
fi
fi
#### INITIALIZE ####
initialize_cfg ()
{
CONNECTED="[`xrandr | grep " connected" | awk '{ print $1 }'`]"
#CONNECTED="`cat ~/.nvidia-settings-rc | grep RedBrightness | grep -o "[.*]"`"
#CONNECTED="[DVI-I-1]"
#CONNECTED="[dpy:2]"
#CONNECTED="0"
if [ -f ~/.nvidia-settings-rc ]; then
if [ "`grep RedGamma ~/.nvidia-settings-rc`" != "" ]; then
if [ "`grep RedBrightness ~/.nvidia-settings-rc`" != "" ]; then
GAMMA_TEMP=`grep RedGamma= ~/.nvidia-settings-rc | sed s/^.*=//`
BRIGHTNESS_TEMP=`grep RedBrightness= ~/.nvidia-settings-rc | sed s/^.*=//`
NVIDIA_SETTINGS_OK=1
fi
fi
fi
[ "$NVIDIA_SETTINGS_OK" != "1" ] &&
GAMMA_TEMP=1.000000
BRIGHTNESS_TEMP=0.000000
echo "
CONNECTED_DISPLAY=$CONNECTED
GAMMA=$GAMMA_TEMP
BRIGHTNESS=$BRIGHTNESS_TEMP" > ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
GAMMACOMMA=`echo $GAMMA | sed s/"."/","/`
BRIGHTNESSCOMMA=`echo $BRIGHTNESS | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
}
#### LOAD CONFIGURATION ####
load_cfg ()
{
source ~/.nvidia-brightness.cfg
GAMMACOMMA=`echo $GAMMA | sed s/"."/","/`
BRIGHTNESSCOMMA=`echo $BRIGHTNESS | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
}
#### GAMMA CHANGE ####
gamma_up ()
{
source ~/.nvidia-brightness.cfg
GAMMANEW=`echo $GAMMA | awk '{printf "%f", $GAMMA + 0.100000}'`
GAMMACOMMA=`echo $GAMMANEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA 1>/dev/null
sed -i s/.*GAMMA=.*/GAMMA=$GAMMANEW/g ~/.nvidia-brightness.cfg
}
gamma_down ()
{
source ~/.nvidia-brightness.cfg
GAMMANEW=`echo $GAMMA | awk '{printf "%f", $GAMMA - 0.100000}'`
GAMMACOMMA=`echo $GAMMANEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA 1>/dev/null
sed -i s/.*GAMMA=.*/GAMMA=$GAMMANEW/g ~/.nvidia-brightness.cfg
}
#### BRIGHTNESS CHANGE ####
brightness_up ()
{
source ~/.nvidia-brightness.cfg
BRIGHTNESSNEW=`echo $BRIGHTNESS | awk '{printf "%f", $BRIGHTNESS + 0.100000}'`
BRIGHTNESSCOMMA=`echo $BRIGHTNESSNEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
}
brightness_down ()
{
source ~/.nvidia-brightness.cfg
BRIGHTNESSNEW=`echo $BRIGHTNESS | awk '{printf "%f", $BRIGHTNESS - 0.100000}'`
BRIGHTNESSCOMMA=`echo $BRIGHTNESSNEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
}
if [ "$3" != "" ]; then
usage
exit 1
fi
error_mixed_gamma ()
{
echo "Error: [ --gamma-up ] and [ --gamma-down ] can't be used together."
}
error_mixed_brightness ()
{
echo "Error: [ --brightness-up ] and [ --brightness-down ] can't be used together."
}
if [ "$2" != "" ]; then
[ "$2" != "-bu" -a "$2" != "--brightness-up" -a "$2" != "-bd" -a "$2" != "--brightness-down"
-a "$2" != "-gu" -a "$2" != "--gamma-up" -a "$2" != "-gd" -a "$2" != "--gamma-down" ] && usage && exit 1
fi
case $1 in
-gu|--gamma-up)
[ "$2" == "-gd" ] && error_mixed_gamma && exit 1
[ "$2" == "--gamma-down" ] && error_mixed_gamma && exit 1
gamma_up
;;
-gd|--gamma-down)
[ "$2" == "-gu" ] && error_mixed_gamma && exit 1
[ "$2" == "--gamma-up" ] && error_mixed_gamma && exit 1
gamma_down
;;
-bu|--brightness-up)
[ "$2" == "-bd" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-down" ] && error_mixed_brightness && exit 1
brightness_up
;;
-bd|--brightness-down)
[ "$2" == "-bu" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-up" ] && error_mixed_brightness && exit 1
brightness_down
;;
-h|--help)
usage
exit 0
;;
-i|--initialize)
if [ "$2" != "" ]; then usage; exit 1; fi
initialize_cfg
exit 0
;;
-l|--load-config)
if [ "$2" != "" ]; then usage; exit 1; fi
load_cfg
exit 0
;;
*)
usage
exit 1
esac
case $2 in
-gu|--gamma-up)
gamma_up
;;
-gd|--gamma-down)
gamma_down
;;
-bu|--brightness-up)
brightness_up
;;
-bd|--brightness-down)
brightness_down
;;
-h|--help)
usage
exit 0
;;
"")
;;
*)
usage
exit 1
esac
Usage:
Save the file somewhere in your PATH e.g.
/usr/local/bin/nvidia-brightness.sh
Don't forget to
chmod +x /usr/local/bin/nvidia-brightness.sh
Before you can use it you have to type
nvidia-brightness.sh -i
This will create the settings file and can also be used to reset the brightness at any time.
Type
nvidia-settings.sh --help
for more options:
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -gu ] or [ --gamma-up ] increase gamma by 0.1
[ -gd ] or [ --gamma-down ] decrease gamma by 0.1
[ -bu ] or [ --brightness-up ] increase brightness by 0.1
[ -bd ] or [ --brightness-down ] decrease brightness by 0.1
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
gamma will be set to 1.0 and brightness to 0.0
(NVIDIA Standard).
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -gd this will decrease gamma by 0.1
nvidia-brightness -bu -gd this will increase brightness by 0.1 and decrease gamma by 0.1
This looks exactly what I'm looking for but I get an error: ERROR: Error parsing assignment '/Gamma=' (No attribute value specified).
– James
Oct 9 '13 at 20:25
add a comment |
NVIDIA brightness bash script
The above perl script didnt work for me so I wrote my own script as a bash script (since I don't know perl). It got a bit long but it creates the settings file by itself and can be used with command line options to adjust brightness or gamma or both at the same time.
I use it with the --brightness-up and --brightness-down switches for the brightness keys on my Keyboard. Easy to assign in XFCE4 and surely also in KDE / GNOME.
nvidia-brightness.sh:
#!/bin/sh
# Tested only with nvidia-settings-319.12 and nvidia-drivers-319.17 on Funtoo Linux running XFCE 4.10
#
# Requirements:
# - NVIDIA Drivers (e.g. nvidia-current in Ubuntu)
# - NVIDIA Settings (nvidia-settings in Ubuntu)
# - xrandr (used by default to determine the correct display name)
#
# This script can be used to change the brightness on systems with an NVIDIA graphics card
# that lack the support for changing the brightness (probably needing acpi backlight).
# It uses "nvidia-settings -a" to assign new gamma or brightness values to the display.
#
# "nvidia-brightness.sh" may be run from the command line or can be assigned to the brightness keys on your Keyboard
# e.g. in XFCE4.
#
# Type "nvidia-brightness.sh --help" for valid options.
usage ()
{
cat << ENDMSG
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -gu ] or [ --gamma-up ] increase gamma by 0.1
[ -gd ] or [ --gamma-down ] decrease gamma by 0.1
[ -bu ] or [ --brightness-up ] increase brightness by 0.1
[ -bd ] or [ --brightness-down ] decrease brightness by 0.1
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
gamma will be set to 1.0 and brightness to 0.0
(NVIDIA Standard).
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -gd this will decrease gamma by 0.1
nvidia-brightness -bu -gd this will increase brightness by 0.1 and decrease gamma by 0.1
ENDMSG
}
case $1 in
-h|--help)
usage
exit 0
esac
if [ "$1" != "-i" -a "$1" != "--initialize" ]; then
if [ ! -f ~/.nvidia-brightness.cfg ]; then
echo 'You must run this script with the --initialize option once to create the settings file.'
echo 'Type "nvidia-brightness.sh --help" for more information.';
exit 1
fi
fi
#### INITIALIZE ####
initialize_cfg ()
{
CONNECTED="[`xrandr | grep " connected" | awk '{ print $1 }'`]"
#CONNECTED="`cat ~/.nvidia-settings-rc | grep RedBrightness | grep -o "[.*]"`"
#CONNECTED="[DVI-I-1]"
#CONNECTED="[dpy:2]"
#CONNECTED="0"
if [ -f ~/.nvidia-settings-rc ]; then
if [ "`grep RedGamma ~/.nvidia-settings-rc`" != "" ]; then
if [ "`grep RedBrightness ~/.nvidia-settings-rc`" != "" ]; then
GAMMA_TEMP=`grep RedGamma= ~/.nvidia-settings-rc | sed s/^.*=//`
BRIGHTNESS_TEMP=`grep RedBrightness= ~/.nvidia-settings-rc | sed s/^.*=//`
NVIDIA_SETTINGS_OK=1
fi
fi
fi
[ "$NVIDIA_SETTINGS_OK" != "1" ] &&
GAMMA_TEMP=1.000000
BRIGHTNESS_TEMP=0.000000
echo "
CONNECTED_DISPLAY=$CONNECTED
GAMMA=$GAMMA_TEMP
BRIGHTNESS=$BRIGHTNESS_TEMP" > ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
GAMMACOMMA=`echo $GAMMA | sed s/"."/","/`
BRIGHTNESSCOMMA=`echo $BRIGHTNESS | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
}
#### LOAD CONFIGURATION ####
load_cfg ()
{
source ~/.nvidia-brightness.cfg
GAMMACOMMA=`echo $GAMMA | sed s/"."/","/`
BRIGHTNESSCOMMA=`echo $BRIGHTNESS | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
}
#### GAMMA CHANGE ####
gamma_up ()
{
source ~/.nvidia-brightness.cfg
GAMMANEW=`echo $GAMMA | awk '{printf "%f", $GAMMA + 0.100000}'`
GAMMACOMMA=`echo $GAMMANEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA 1>/dev/null
sed -i s/.*GAMMA=.*/GAMMA=$GAMMANEW/g ~/.nvidia-brightness.cfg
}
gamma_down ()
{
source ~/.nvidia-brightness.cfg
GAMMANEW=`echo $GAMMA | awk '{printf "%f", $GAMMA - 0.100000}'`
GAMMACOMMA=`echo $GAMMANEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA 1>/dev/null
sed -i s/.*GAMMA=.*/GAMMA=$GAMMANEW/g ~/.nvidia-brightness.cfg
}
#### BRIGHTNESS CHANGE ####
brightness_up ()
{
source ~/.nvidia-brightness.cfg
BRIGHTNESSNEW=`echo $BRIGHTNESS | awk '{printf "%f", $BRIGHTNESS + 0.100000}'`
BRIGHTNESSCOMMA=`echo $BRIGHTNESSNEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
}
brightness_down ()
{
source ~/.nvidia-brightness.cfg
BRIGHTNESSNEW=`echo $BRIGHTNESS | awk '{printf "%f", $BRIGHTNESS - 0.100000}'`
BRIGHTNESSCOMMA=`echo $BRIGHTNESSNEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
}
if [ "$3" != "" ]; then
usage
exit 1
fi
error_mixed_gamma ()
{
echo "Error: [ --gamma-up ] and [ --gamma-down ] can't be used together."
}
error_mixed_brightness ()
{
echo "Error: [ --brightness-up ] and [ --brightness-down ] can't be used together."
}
if [ "$2" != "" ]; then
[ "$2" != "-bu" -a "$2" != "--brightness-up" -a "$2" != "-bd" -a "$2" != "--brightness-down"
-a "$2" != "-gu" -a "$2" != "--gamma-up" -a "$2" != "-gd" -a "$2" != "--gamma-down" ] && usage && exit 1
fi
case $1 in
-gu|--gamma-up)
[ "$2" == "-gd" ] && error_mixed_gamma && exit 1
[ "$2" == "--gamma-down" ] && error_mixed_gamma && exit 1
gamma_up
;;
-gd|--gamma-down)
[ "$2" == "-gu" ] && error_mixed_gamma && exit 1
[ "$2" == "--gamma-up" ] && error_mixed_gamma && exit 1
gamma_down
;;
-bu|--brightness-up)
[ "$2" == "-bd" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-down" ] && error_mixed_brightness && exit 1
brightness_up
;;
-bd|--brightness-down)
[ "$2" == "-bu" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-up" ] && error_mixed_brightness && exit 1
brightness_down
;;
-h|--help)
usage
exit 0
;;
-i|--initialize)
if [ "$2" != "" ]; then usage; exit 1; fi
initialize_cfg
exit 0
;;
-l|--load-config)
if [ "$2" != "" ]; then usage; exit 1; fi
load_cfg
exit 0
;;
*)
usage
exit 1
esac
case $2 in
-gu|--gamma-up)
gamma_up
;;
-gd|--gamma-down)
gamma_down
;;
-bu|--brightness-up)
brightness_up
;;
-bd|--brightness-down)
brightness_down
;;
-h|--help)
usage
exit 0
;;
"")
;;
*)
usage
exit 1
esac
Usage:
Save the file somewhere in your PATH e.g.
/usr/local/bin/nvidia-brightness.sh
Don't forget to
chmod +x /usr/local/bin/nvidia-brightness.sh
Before you can use it you have to type
nvidia-brightness.sh -i
This will create the settings file and can also be used to reset the brightness at any time.
Type
nvidia-settings.sh --help
for more options:
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -gu ] or [ --gamma-up ] increase gamma by 0.1
[ -gd ] or [ --gamma-down ] decrease gamma by 0.1
[ -bu ] or [ --brightness-up ] increase brightness by 0.1
[ -bd ] or [ --brightness-down ] decrease brightness by 0.1
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
gamma will be set to 1.0 and brightness to 0.0
(NVIDIA Standard).
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -gd this will decrease gamma by 0.1
nvidia-brightness -bu -gd this will increase brightness by 0.1 and decrease gamma by 0.1
This looks exactly what I'm looking for but I get an error: ERROR: Error parsing assignment '/Gamma=' (No attribute value specified).
– James
Oct 9 '13 at 20:25
add a comment |
NVIDIA brightness bash script
The above perl script didnt work for me so I wrote my own script as a bash script (since I don't know perl). It got a bit long but it creates the settings file by itself and can be used with command line options to adjust brightness or gamma or both at the same time.
I use it with the --brightness-up and --brightness-down switches for the brightness keys on my Keyboard. Easy to assign in XFCE4 and surely also in KDE / GNOME.
nvidia-brightness.sh:
#!/bin/sh
# Tested only with nvidia-settings-319.12 and nvidia-drivers-319.17 on Funtoo Linux running XFCE 4.10
#
# Requirements:
# - NVIDIA Drivers (e.g. nvidia-current in Ubuntu)
# - NVIDIA Settings (nvidia-settings in Ubuntu)
# - xrandr (used by default to determine the correct display name)
#
# This script can be used to change the brightness on systems with an NVIDIA graphics card
# that lack the support for changing the brightness (probably needing acpi backlight).
# It uses "nvidia-settings -a" to assign new gamma or brightness values to the display.
#
# "nvidia-brightness.sh" may be run from the command line or can be assigned to the brightness keys on your Keyboard
# e.g. in XFCE4.
#
# Type "nvidia-brightness.sh --help" for valid options.
usage ()
{
cat << ENDMSG
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -gu ] or [ --gamma-up ] increase gamma by 0.1
[ -gd ] or [ --gamma-down ] decrease gamma by 0.1
[ -bu ] or [ --brightness-up ] increase brightness by 0.1
[ -bd ] or [ --brightness-down ] decrease brightness by 0.1
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
gamma will be set to 1.0 and brightness to 0.0
(NVIDIA Standard).
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -gd this will decrease gamma by 0.1
nvidia-brightness -bu -gd this will increase brightness by 0.1 and decrease gamma by 0.1
ENDMSG
}
case $1 in
-h|--help)
usage
exit 0
esac
if [ "$1" != "-i" -a "$1" != "--initialize" ]; then
if [ ! -f ~/.nvidia-brightness.cfg ]; then
echo 'You must run this script with the --initialize option once to create the settings file.'
echo 'Type "nvidia-brightness.sh --help" for more information.';
exit 1
fi
fi
#### INITIALIZE ####
initialize_cfg ()
{
CONNECTED="[`xrandr | grep " connected" | awk '{ print $1 }'`]"
#CONNECTED="`cat ~/.nvidia-settings-rc | grep RedBrightness | grep -o "[.*]"`"
#CONNECTED="[DVI-I-1]"
#CONNECTED="[dpy:2]"
#CONNECTED="0"
if [ -f ~/.nvidia-settings-rc ]; then
if [ "`grep RedGamma ~/.nvidia-settings-rc`" != "" ]; then
if [ "`grep RedBrightness ~/.nvidia-settings-rc`" != "" ]; then
GAMMA_TEMP=`grep RedGamma= ~/.nvidia-settings-rc | sed s/^.*=//`
BRIGHTNESS_TEMP=`grep RedBrightness= ~/.nvidia-settings-rc | sed s/^.*=//`
NVIDIA_SETTINGS_OK=1
fi
fi
fi
[ "$NVIDIA_SETTINGS_OK" != "1" ] &&
GAMMA_TEMP=1.000000
BRIGHTNESS_TEMP=0.000000
echo "
CONNECTED_DISPLAY=$CONNECTED
GAMMA=$GAMMA_TEMP
BRIGHTNESS=$BRIGHTNESS_TEMP" > ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
GAMMACOMMA=`echo $GAMMA | sed s/"."/","/`
BRIGHTNESSCOMMA=`echo $BRIGHTNESS | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
}
#### LOAD CONFIGURATION ####
load_cfg ()
{
source ~/.nvidia-brightness.cfg
GAMMACOMMA=`echo $GAMMA | sed s/"."/","/`
BRIGHTNESSCOMMA=`echo $BRIGHTNESS | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
}
#### GAMMA CHANGE ####
gamma_up ()
{
source ~/.nvidia-brightness.cfg
GAMMANEW=`echo $GAMMA | awk '{printf "%f", $GAMMA + 0.100000}'`
GAMMACOMMA=`echo $GAMMANEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA 1>/dev/null
sed -i s/.*GAMMA=.*/GAMMA=$GAMMANEW/g ~/.nvidia-brightness.cfg
}
gamma_down ()
{
source ~/.nvidia-brightness.cfg
GAMMANEW=`echo $GAMMA | awk '{printf "%f", $GAMMA - 0.100000}'`
GAMMACOMMA=`echo $GAMMANEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA 1>/dev/null
sed -i s/.*GAMMA=.*/GAMMA=$GAMMANEW/g ~/.nvidia-brightness.cfg
}
#### BRIGHTNESS CHANGE ####
brightness_up ()
{
source ~/.nvidia-brightness.cfg
BRIGHTNESSNEW=`echo $BRIGHTNESS | awk '{printf "%f", $BRIGHTNESS + 0.100000}'`
BRIGHTNESSCOMMA=`echo $BRIGHTNESSNEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
}
brightness_down ()
{
source ~/.nvidia-brightness.cfg
BRIGHTNESSNEW=`echo $BRIGHTNESS | awk '{printf "%f", $BRIGHTNESS - 0.100000}'`
BRIGHTNESSCOMMA=`echo $BRIGHTNESSNEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
}
if [ "$3" != "" ]; then
usage
exit 1
fi
error_mixed_gamma ()
{
echo "Error: [ --gamma-up ] and [ --gamma-down ] can't be used together."
}
error_mixed_brightness ()
{
echo "Error: [ --brightness-up ] and [ --brightness-down ] can't be used together."
}
if [ "$2" != "" ]; then
[ "$2" != "-bu" -a "$2" != "--brightness-up" -a "$2" != "-bd" -a "$2" != "--brightness-down"
-a "$2" != "-gu" -a "$2" != "--gamma-up" -a "$2" != "-gd" -a "$2" != "--gamma-down" ] && usage && exit 1
fi
case $1 in
-gu|--gamma-up)
[ "$2" == "-gd" ] && error_mixed_gamma && exit 1
[ "$2" == "--gamma-down" ] && error_mixed_gamma && exit 1
gamma_up
;;
-gd|--gamma-down)
[ "$2" == "-gu" ] && error_mixed_gamma && exit 1
[ "$2" == "--gamma-up" ] && error_mixed_gamma && exit 1
gamma_down
;;
-bu|--brightness-up)
[ "$2" == "-bd" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-down" ] && error_mixed_brightness && exit 1
brightness_up
;;
-bd|--brightness-down)
[ "$2" == "-bu" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-up" ] && error_mixed_brightness && exit 1
brightness_down
;;
-h|--help)
usage
exit 0
;;
-i|--initialize)
if [ "$2" != "" ]; then usage; exit 1; fi
initialize_cfg
exit 0
;;
-l|--load-config)
if [ "$2" != "" ]; then usage; exit 1; fi
load_cfg
exit 0
;;
*)
usage
exit 1
esac
case $2 in
-gu|--gamma-up)
gamma_up
;;
-gd|--gamma-down)
gamma_down
;;
-bu|--brightness-up)
brightness_up
;;
-bd|--brightness-down)
brightness_down
;;
-h|--help)
usage
exit 0
;;
"")
;;
*)
usage
exit 1
esac
Usage:
Save the file somewhere in your PATH e.g.
/usr/local/bin/nvidia-brightness.sh
Don't forget to
chmod +x /usr/local/bin/nvidia-brightness.sh
Before you can use it you have to type
nvidia-brightness.sh -i
This will create the settings file and can also be used to reset the brightness at any time.
Type
nvidia-settings.sh --help
for more options:
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -gu ] or [ --gamma-up ] increase gamma by 0.1
[ -gd ] or [ --gamma-down ] decrease gamma by 0.1
[ -bu ] or [ --brightness-up ] increase brightness by 0.1
[ -bd ] or [ --brightness-down ] decrease brightness by 0.1
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
gamma will be set to 1.0 and brightness to 0.0
(NVIDIA Standard).
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -gd this will decrease gamma by 0.1
nvidia-brightness -bu -gd this will increase brightness by 0.1 and decrease gamma by 0.1
NVIDIA brightness bash script
The above perl script didnt work for me so I wrote my own script as a bash script (since I don't know perl). It got a bit long but it creates the settings file by itself and can be used with command line options to adjust brightness or gamma or both at the same time.
I use it with the --brightness-up and --brightness-down switches for the brightness keys on my Keyboard. Easy to assign in XFCE4 and surely also in KDE / GNOME.
nvidia-brightness.sh:
#!/bin/sh
# Tested only with nvidia-settings-319.12 and nvidia-drivers-319.17 on Funtoo Linux running XFCE 4.10
#
# Requirements:
# - NVIDIA Drivers (e.g. nvidia-current in Ubuntu)
# - NVIDIA Settings (nvidia-settings in Ubuntu)
# - xrandr (used by default to determine the correct display name)
#
# This script can be used to change the brightness on systems with an NVIDIA graphics card
# that lack the support for changing the brightness (probably needing acpi backlight).
# It uses "nvidia-settings -a" to assign new gamma or brightness values to the display.
#
# "nvidia-brightness.sh" may be run from the command line or can be assigned to the brightness keys on your Keyboard
# e.g. in XFCE4.
#
# Type "nvidia-brightness.sh --help" for valid options.
usage ()
{
cat << ENDMSG
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -gu ] or [ --gamma-up ] increase gamma by 0.1
[ -gd ] or [ --gamma-down ] decrease gamma by 0.1
[ -bu ] or [ --brightness-up ] increase brightness by 0.1
[ -bd ] or [ --brightness-down ] decrease brightness by 0.1
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
gamma will be set to 1.0 and brightness to 0.0
(NVIDIA Standard).
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -gd this will decrease gamma by 0.1
nvidia-brightness -bu -gd this will increase brightness by 0.1 and decrease gamma by 0.1
ENDMSG
}
case $1 in
-h|--help)
usage
exit 0
esac
if [ "$1" != "-i" -a "$1" != "--initialize" ]; then
if [ ! -f ~/.nvidia-brightness.cfg ]; then
echo 'You must run this script with the --initialize option once to create the settings file.'
echo 'Type "nvidia-brightness.sh --help" for more information.';
exit 1
fi
fi
#### INITIALIZE ####
initialize_cfg ()
{
CONNECTED="[`xrandr | grep " connected" | awk '{ print $1 }'`]"
#CONNECTED="`cat ~/.nvidia-settings-rc | grep RedBrightness | grep -o "[.*]"`"
#CONNECTED="[DVI-I-1]"
#CONNECTED="[dpy:2]"
#CONNECTED="0"
if [ -f ~/.nvidia-settings-rc ]; then
if [ "`grep RedGamma ~/.nvidia-settings-rc`" != "" ]; then
if [ "`grep RedBrightness ~/.nvidia-settings-rc`" != "" ]; then
GAMMA_TEMP=`grep RedGamma= ~/.nvidia-settings-rc | sed s/^.*=//`
BRIGHTNESS_TEMP=`grep RedBrightness= ~/.nvidia-settings-rc | sed s/^.*=//`
NVIDIA_SETTINGS_OK=1
fi
fi
fi
[ "$NVIDIA_SETTINGS_OK" != "1" ] &&
GAMMA_TEMP=1.000000
BRIGHTNESS_TEMP=0.000000
echo "
CONNECTED_DISPLAY=$CONNECTED
GAMMA=$GAMMA_TEMP
BRIGHTNESS=$BRIGHTNESS_TEMP" > ~/.nvidia-brightness.cfg
source ~/.nvidia-brightness.cfg
GAMMACOMMA=`echo $GAMMA | sed s/"."/","/`
BRIGHTNESSCOMMA=`echo $BRIGHTNESS | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
}
#### LOAD CONFIGURATION ####
load_cfg ()
{
source ~/.nvidia-brightness.cfg
GAMMACOMMA=`echo $GAMMA | sed s/"."/","/`
BRIGHTNESSCOMMA=`echo $BRIGHTNESS | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
}
#### GAMMA CHANGE ####
gamma_up ()
{
source ~/.nvidia-brightness.cfg
GAMMANEW=`echo $GAMMA | awk '{printf "%f", $GAMMA + 0.100000}'`
GAMMACOMMA=`echo $GAMMANEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA 1>/dev/null
sed -i s/.*GAMMA=.*/GAMMA=$GAMMANEW/g ~/.nvidia-brightness.cfg
}
gamma_down ()
{
source ~/.nvidia-brightness.cfg
GAMMANEW=`echo $GAMMA | awk '{printf "%f", $GAMMA - 0.100000}'`
GAMMACOMMA=`echo $GAMMANEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Gamma=$GAMMACOMMA 1>/dev/null
sed -i s/.*GAMMA=.*/GAMMA=$GAMMANEW/g ~/.nvidia-brightness.cfg
}
#### BRIGHTNESS CHANGE ####
brightness_up ()
{
source ~/.nvidia-brightness.cfg
BRIGHTNESSNEW=`echo $BRIGHTNESS | awk '{printf "%f", $BRIGHTNESS + 0.100000}'`
BRIGHTNESSCOMMA=`echo $BRIGHTNESSNEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
}
brightness_down ()
{
source ~/.nvidia-brightness.cfg
BRIGHTNESSNEW=`echo $BRIGHTNESS | awk '{printf "%f", $BRIGHTNESS - 0.100000}'`
BRIGHTNESSCOMMA=`echo $BRIGHTNESSNEW | sed s/"."/","/`
nvidia-settings -n -a $CONNECTED_DISPLAY/Brightness=$BRIGHTNESSCOMMA 1>/dev/null
sed -i s/.*BRIGHTNESS=.*/BRIGHTNESS=$BRIGHTNESSNEW/g ~/.nvidia-brightness.cfg
}
if [ "$3" != "" ]; then
usage
exit 1
fi
error_mixed_gamma ()
{
echo "Error: [ --gamma-up ] and [ --gamma-down ] can't be used together."
}
error_mixed_brightness ()
{
echo "Error: [ --brightness-up ] and [ --brightness-down ] can't be used together."
}
if [ "$2" != "" ]; then
[ "$2" != "-bu" -a "$2" != "--brightness-up" -a "$2" != "-bd" -a "$2" != "--brightness-down"
-a "$2" != "-gu" -a "$2" != "--gamma-up" -a "$2" != "-gd" -a "$2" != "--gamma-down" ] && usage && exit 1
fi
case $1 in
-gu|--gamma-up)
[ "$2" == "-gd" ] && error_mixed_gamma && exit 1
[ "$2" == "--gamma-down" ] && error_mixed_gamma && exit 1
gamma_up
;;
-gd|--gamma-down)
[ "$2" == "-gu" ] && error_mixed_gamma && exit 1
[ "$2" == "--gamma-up" ] && error_mixed_gamma && exit 1
gamma_down
;;
-bu|--brightness-up)
[ "$2" == "-bd" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-down" ] && error_mixed_brightness && exit 1
brightness_up
;;
-bd|--brightness-down)
[ "$2" == "-bu" ] && error_mixed_brightness && exit 1
[ "$2" == "--brightness-up" ] && error_mixed_brightness && exit 1
brightness_down
;;
-h|--help)
usage
exit 0
;;
-i|--initialize)
if [ "$2" != "" ]; then usage; exit 1; fi
initialize_cfg
exit 0
;;
-l|--load-config)
if [ "$2" != "" ]; then usage; exit 1; fi
load_cfg
exit 0
;;
*)
usage
exit 1
esac
case $2 in
-gu|--gamma-up)
gamma_up
;;
-gd|--gamma-down)
gamma_down
;;
-bu|--brightness-up)
brightness_up
;;
-bd|--brightness-down)
brightness_down
;;
-h|--help)
usage
exit 0
;;
"")
;;
*)
usage
exit 1
esac
Usage:
Save the file somewhere in your PATH e.g.
/usr/local/bin/nvidia-brightness.sh
Don't forget to
chmod +x /usr/local/bin/nvidia-brightness.sh
Before you can use it you have to type
nvidia-brightness.sh -i
This will create the settings file and can also be used to reset the brightness at any time.
Type
nvidia-settings.sh --help
for more options:
Usage:
nvidia-brightness.sh [ options ]
Options:
[ -gu ] or [ --gamma-up ] increase gamma by 0.1
[ -gd ] or [ --gamma-down ] decrease gamma by 0.1
[ -bu ] or [ --brightness-up ] increase brightness by 0.1
[ -bd ] or [ --brightness-down ] decrease brightness by 0.1
[ -i ] or [ --initialize ] Must be run once to create the settings file
(~/.nvidia-brightness.cfg).
Brightness settings from ~/.nvidia-settings-rc
will be used if file exists, otherwise
gamma will be set to 1.0 and brightness to 0.0
(NVIDIA Standard).
[ -l ] or [ --load-config ] Load current settings from ~/.nvidia-brightness.cfg
(e.g. as X11 autostart script)
Examples:
nvidia-brightness -gd this will decrease gamma by 0.1
nvidia-brightness -bu -gd this will increase brightness by 0.1 and decrease gamma by 0.1
edited May 25 '13 at 19:51
community wiki
17 revs
qgj
This looks exactly what I'm looking for but I get an error: ERROR: Error parsing assignment '/Gamma=' (No attribute value specified).
– James
Oct 9 '13 at 20:25
add a comment |
This looks exactly what I'm looking for but I get an error: ERROR: Error parsing assignment '/Gamma=' (No attribute value specified).
– James
Oct 9 '13 at 20:25
This looks exactly what I'm looking for but I get an error: ERROR: Error parsing assignment '/Gamma=' (No attribute value specified).
– James
Oct 9 '13 at 20:25
This looks exactly what I'm looking for but I get an error: ERROR: Error parsing assignment '/Gamma=' (No attribute value specified).
– James
Oct 9 '13 at 20:25
add a comment |
Im using NVIDIA Graphic Card and having problem like you.
But i tried this thing and it's work :
1. Install NVIDIA Driver with command :
sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current
2. Then, reboot
3. Done.
Source : http://noob-tech.blogspot.co.id/2015/04/Install-VGA-Driver-On-Ubuntu.html
add a comment |
Im using NVIDIA Graphic Card and having problem like you.
But i tried this thing and it's work :
1. Install NVIDIA Driver with command :
sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current
2. Then, reboot
3. Done.
Source : http://noob-tech.blogspot.co.id/2015/04/Install-VGA-Driver-On-Ubuntu.html
add a comment |
Im using NVIDIA Graphic Card and having problem like you.
But i tried this thing and it's work :
1. Install NVIDIA Driver with command :
sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current
2. Then, reboot
3. Done.
Source : http://noob-tech.blogspot.co.id/2015/04/Install-VGA-Driver-On-Ubuntu.html
Im using NVIDIA Graphic Card and having problem like you.
But i tried this thing and it's work :
1. Install NVIDIA Driver with command :
sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current
2. Then, reboot
3. Done.
Source : http://noob-tech.blogspot.co.id/2015/04/Install-VGA-Driver-On-Ubuntu.html
answered Jul 9 '17 at 18:13
Lazy Cat
11
11
add a comment |
add a comment |
I had the same problem in Ubuntu 16.10, after upgrading from 16.04. In the xorg.conf file (/usr/share/doc/xserver-xorg-video-intel/), I changed the driver from "intel" to "nvidia".
1
Thanks for trying to help! Would you mind describing the process a bit?
– earthmeLon
Jan 31 '17 at 20:33
add a comment |
I had the same problem in Ubuntu 16.10, after upgrading from 16.04. In the xorg.conf file (/usr/share/doc/xserver-xorg-video-intel/), I changed the driver from "intel" to "nvidia".
1
Thanks for trying to help! Would you mind describing the process a bit?
– earthmeLon
Jan 31 '17 at 20:33
add a comment |
I had the same problem in Ubuntu 16.10, after upgrading from 16.04. In the xorg.conf file (/usr/share/doc/xserver-xorg-video-intel/), I changed the driver from "intel" to "nvidia".
I had the same problem in Ubuntu 16.10, after upgrading from 16.04. In the xorg.conf file (/usr/share/doc/xserver-xorg-video-intel/), I changed the driver from "intel" to "nvidia".
edited Aug 18 '17 at 13:26
Community♦
1
1
answered Jan 31 '17 at 18:27
Shankar Sivarajan
11
11
1
Thanks for trying to help! Would you mind describing the process a bit?
– earthmeLon
Jan 31 '17 at 20:33
add a comment |
1
Thanks for trying to help! Would you mind describing the process a bit?
– earthmeLon
Jan 31 '17 at 20:33
1
1
Thanks for trying to help! Would you mind describing the process a bit?
– earthmeLon
Jan 31 '17 at 20:33
Thanks for trying to help! Would you mind describing the process a bit?
– earthmeLon
Jan 31 '17 at 20:33
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f76081%2fbrightness-not-working-after-installing-nvidia-driver%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Same thing happened to me on a MacBook Pro 5,5.
– Cerin
Mar 11 '12 at 18:20
Just a followup, I tried all the documented solutions, and nothing ever worked, including using the most recent Nvida driver. However, when I purged the Nvidia driver and used the open source Nouveau driver, screen dimming immediately started working.
– Cerin
Apr 15 '15 at 13:21
@Cerin why not write that up as an answer including all the steps so that a novice user could follow it? Drop me a comment when you've done so and if it's a good answer, I'll upvote it, and it will likely help others as well.
– Elder Geek
May 1 '15 at 1:23
1
@ElderGeek, Unfortunately, Nouveau doesn't support suspend/resume, making it useless for a laptop, which is a shame because it was otherwise better than the Nvidia driver. I upgraded to 14.04 and the Nvidia 340 driver, and now screen dimming works.
– Cerin
May 1 '15 at 13:02