Software & AppsOperating SystemLinux

How To Stop Laptop Screen Brightness from Changing When Plugged In

Ubuntu 10

In this article, we will discuss several methods to stop your laptop screen brightness from changing when you plug it in. This is a common issue experienced by many laptop users, and it can be quite frustrating. However, there are several solutions that you can try to resolve this problem.

Quick Answer

To stop your laptop screen brightness from changing when plugged in, you can try several solutions. One option is to create a script file in the /etc/pm/power.d/ directory that adjusts the brightness settings based on the power source. Another solution is to adjust the BIOS settings to prevent the screen from dimming. Additionally, you can manually set the brightness using a script or use the dconf editor to adjust the brightness settings. Editing the grub file can also help in controlling the screen brightness.

Solution 1: Create a script file in /etc/pm/power.d/

One of the most effective ways to control your laptop’s screen brightness is by creating a script file in the /etc/pm/power.d/ directory. This script will run each time your laptop switches between AC and battery power, ensuring your brightness settings remain consistent.

To create this script, follow these steps:

  1. Open a terminal. You can do this by pressing Ctrl + Alt + T on your keyboard.
  2. Create a new script file by running the following command:
sudo vi /etc/pm/power.d/run_after_pwrmanagmt.sh
  1. Copy and paste the following code into the file:
case "${1}" in
 true) #battery_mode
 xinput set-int-prop 12 277 8 2 3 0 0 1 3 2
 echo 4000 > /sys/class/backlight/intel_backlight/brightness
;;
 false) #ac_mode
 xinput set-int-prop 12 277 8 2 3 0 0 1 3 2
 echo 4000 > /sys/class/backlight/intel_backlight/brightness
esac

In this script, the case statement checks whether the laptop is running on battery (true) or AC power (false). The xinput command is used to set input device properties. The echo command is used to set the brightness level. The number 4000 represents the brightness level, and you can adjust this number to your preference.

  1. Save the file and exit the text editor.
  2. Make the script executable by running the following command:
sudo chmod +x /etc/pm/power.d/run_after_pwrmanagmt.sh

The chmod command is used to change the permissions of a file. The +x option makes the file executable.

Solution 2: Adjust BIOS Settings

Another solution is to adjust your laptop’s BIOS settings. BIOS stands for Basic Input/Output System, and it controls the hardware of your computer.

To adjust your BIOS settings, follow these steps:

  1. Restart your laptop and press the BIOS key during startup. This is usually F2 or Del, but it may vary depending on your laptop model.
  2. Look for a setting related to screen brightness in the Config-Display section.
  3. Adjust this setting to prevent the screen from dimming when the laptop is unplugged.

Solution 3: Manually Set Brightness Using a Script

You can also manually set your laptop’s brightness using a script. This script will set the brightness to its maximum value each time it is run.

To create this script, follow these steps:

  1. Open a terminal.
  2. Run the following commands:
me=`whoami`
max=`cat /sys/class/backlight/radeon_bl0/max_brightness`
sudo chown ${me}:${me} /sys/class/backlight/radeon_bl0/brightness
sudo chmod o+x /sys/class/backlight/radeon_bl0/brightness
echo ${max} > /sys/class/backlight/radeon_bl0/brightness
sudo chmod 444 /sys/class/backlight/radeon_bl0/brightness
sudo chown root:root /sys/class/backlight/radeon_bl0/brightness
exit

In this script, the whoami command is used to get the current user’s username. The cat command is used to get the maximum brightness level. The chown and chmod commands are used to change the ownership and permissions of the brightness file, respectively. The echo command is used to set the brightness level.

Solution 4: Use the dconf Editor

The dconf editor is a powerful tool that can be used to adjust various settings on your laptop. To use the dconf editor to adjust your brightness settings, follow these steps:

  1. Install the dconf editor if you don’t have it already. You can do this by running the following command in a terminal:
sudo apt-get install dconf-editor
  1. Open the dconf editor and navigate to org/gnome/shell/extensions/dim-on-battery.
  2. Set the key legacy-mode to On. This will make your laptop remember your last brightness settings when using the brightness control.

Solution 5: Edit the grub File

The grub file is a configuration file used by the GRUB bootloader. By editing this file, you can adjust your laptop’s brightness settings.

To edit the grub file, follow these steps:

  1. Open the file /etc/default/grub in a text editor. You can do this by running the following command in a terminal:
sudo vi /etc/default/grub
  1. Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT and add acpi_backlight=vendor to the end of the line.
  2. Save the file and run the following command in the terminal to update the GRUB configuration:
sudo update-grub
  1. Restart your laptop for the changes to take effect.

By following these solutions, you should be able to stop your laptop screen brightness from changing when you plug it in. If you’re still experiencing issues, it may be worth seeking further assistance from a professional or your laptop’s manufacturer.

Why does my laptop screen brightness change when I plug it in?

This issue occurs because laptops often have different power profiles for when they are running on battery power versus when they are plugged into an outlet. These power profiles can include changes to screen brightness to optimize battery life or provide a better viewing experience when plugged in.

Can I stop my laptop screen brightness from changing when I plug it in?

Yes, there are several solutions you can try to prevent your laptop screen brightness from changing when you plug it in. The methods mentioned in this article include creating a script file, adjusting BIOS settings, manually setting brightness using a script, using the dconf editor, and editing the grub file.

How do I create a script file in `/etc/pm/power.d/`?

To create a script file in the /etc/pm/power.d/ directory, open a terminal and run the command sudo vi /etc/pm/power.d/run_after_pwrmanagmt.sh. This will open a text editor where you can paste the script code provided in the article. Save the file and make it executable using the command sudo chmod +x /etc/pm/power.d/run_after_pwrmanagmt.sh.

How do I adjust BIOS settings to stop screen brightness changes?

To adjust BIOS settings, restart your laptop and press the BIOS key during startup (usually F2 or Del). Look for a setting related to screen brightness in the Config-Display section and adjust it to prevent the screen from dimming when the laptop is unplugged.

How do I manually set brightness using a script?

To manually set brightness using a script, open a terminal and run the provided commands mentioned in the article. These commands will set the brightness to its maximum value each time the script is run.

How do I use the dconf editor to adjust brightness settings?

First, install the dconf editor by running sudo apt-get install dconf-editor in a terminal. Then, open the dconf editor and navigate to org/gnome/shell/extensions/dim-on-battery. Set the key legacy-mode to On to make your laptop remember your last brightness settings when using the brightness control.

How do I edit the grub file to adjust brightness settings?

Open the file /etc/default/grub in a text editor using the command sudo vi /etc/default/grub. Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT and add acpi_backlight=vendor to the end of the line. Save the file and run sudo update-grub in the terminal to update the GRUB configuration. Restart your laptop for the changes to take effect.

Leave a Comment

Your email address will not be published. Required fields are marked *